 |
|
 |
Hi All,
Thanks Guillaume for some great software. I have modified DemoWinow() to use a WinSock TCP/IP connection to direct network output of instrument data from the Flight Gear simulator. It works very well.
I have removed the user controls, added a few additional dials (e.g. for engine) and am in the process of mounting the display in a physical aircraft mockup that will include 2 degrees of freedom motion, with motors driven via x,y,z acceleration outputs from Flightgear.
Guillaume, if you read this, would it be ok to photo and publish the 'new' software?
I can be emailed thrugh this site.
Many thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
This is very good Gauges for Windows form. Can you please tell me how to use these controls in C#,ASP.NET
Regards Girish
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
How would you add the controls to another project? I keep getting failed to create component error
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
 |
Nice looking controls. Just a remark : i think the Graphics class can do the exact rotation by using TranslateTransform to change the rotation center.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Excellent controls Chootair.
NicolasG, since transformation matrices can be combined together I also think it would work if we translate the rotation point to origin, rotate and then translate back. e.g. the following would work in case of Attitude control where the rotation is about the mid point say 150,150:
GraphicsState oldState = graphics.Save(); // save existing matrices
// make rotation point the origin graphics.TranslateTransform(-150, -150);
// rotate graphics.RotateTransform((float)(alphaRot * 180 / Math.PI), MatrixOrder.Append);
// translate back graphics.TranslateTransform(150, 150, MatrixOrder.Append);
// code to draw image comes here .... ....
graphics.Restore(oldState); // restore old
In any case, the controls work great as is.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Nice job!
A few things;
Plural of foot is feet, not "feet's" (trivial I know, but I hold an ATPL so the more realistic it is the better 
An altimeter has a window to set the ambient pressure with the standard ISA atmosphere being 1013 hPa or 29.92 millibars (US).
Would be really cool to custom draw atleast the ASI, so you can set various V speeds, also building a Pitot Static interface so you can demonstrate what would happen if your Pitot or Static sources are blocked during an climb or decent.
Heading bugs and V speed bugs would also be awesome.
Drawing Flight Director bars and/or LOC/GS bars to show what an analog display looks like would be cool too. 
Al
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
Nice job but you left one thing out...
I am a pilot and I fly fixed and rotary wing, and lots of different aircraft....
You left out "shudder" !!!!
All flight instruments I have seen have "shudder" where the needle is never pegged but vibrates around a value... adding shudder would give your controls a sense of realism....
Bill
The Infomercial King(tm)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Have you tried A/C with "Glass Cockpits" display systems? I wounder if a A380 pilot would want "shudder" on is display, but I am not a pilot... 
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
I am a pilot and not an engineer but I think the "shudder" in the prop planes and jets I have flown is due to the vibration... even a gentle vibration in a Lear or Falcon or Tri-Star jet will cause the needle to of non-digital displays to shudder.
I guess I should have also mention that you don't have shudder with all digital displays but with real needles they vibrate.
Great controls!
Bill
The Infomercial King(tm)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I changed the Horizon Bitmap so you can display a full +/-90 degree pitch angle, i.e. a loop. I had to stretch the image to include 90 degree and past that point to 60 and -60 degrees in both directions. Then I had to modify the OnPaint method as below
protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe);
Point ptBoule = new Point(25, - 330); Point ptRotation = new Point(150, 150);
float scale = (float)this.Width / bmpCadran.Width;
bmpCadran.MakeTransparent(Color.Yellow); bmpAvion.MakeTransparent(Color.Yellow);
RotateAndTranslate(pe, bmpBoule, RollAngle, 0, ptBoule, (int)(4*PitchAngle), ptRotation, scale);
Pen maskPen = new Pen(this.BackColor,30*scale); pe.Graphics.DrawRectangle(maskPen, 0, 0, bmpCadran.Width * scale, bmpCadran.Height * scale);
pe.Graphics.DrawImage(bmpCadran, 0, 0, (float)(bmpCadran.Width * scale), (float)(bmpCadran.Height * scale));
pe.Graphics.DrawImage(bmpAvion, (float)((0.5 * bmpCadran.Width - 0.5 * bmpAvion.Width) * scale), (float)((0.5 * bmpCadran.Height - 0.5 * bmpAvion.Height) * scale), (float)(bmpAvion.Width * scale), (float)(bmpAvion.Height * scale));
}
It would also be nice if the altitude digits scrolled more smoothly, instead of just on step based on the previous decade digit. e.g It should scroll for values around 10 feet before the digit must change.
This is what I did for the altimeter I did a while bac, which is fairly similar. I also use a background image to do the drawing before painting it to the current canvas. It helps with
private void Altimeter_Paint(object sender, PaintEventArgs e) { try { SolidBrush NeedleBrush = new SolidBrush(Color.Yellow); // Draw the background Image this.BackgroundImage = new Bitmap(this.Width, this.Height); Graphics Background = Graphics.FromImage(this.BackgroundImage); // Draw the dial Background.DrawImage(this.DialImage, 0, 0); // Draw the scrolling numbers float imageIndex;
// First the 10s numbers imageIndex = this.mAltitude % 100; imageIndex = imageIndex / 10; float lowDigit = imageIndex; imageIndex = (imageIndex * this.DigitHeight_10) + this.DigitStart_10; Background.DrawImage(this.TensImage, this.DigitRect_10, new Rectangle(0, (int)imageIndex, this.TensImage.Width, this.DigitRect_10.Height), GraphicsUnit.Pixel);
// Then the 100s imageIndex = this.mAltitude / 100; imageIndex = imageIndex % 10; imageIndex = (float)Math.Floor(imageIndex); imageIndex = (imageIndex * this.DigitHeight_10) + this.DigitStart_100; // Slowly shift this digit when it reaches 90 feet if (lowDigit > 9) { float shift = (lowDigit - 9) * this.DigitHeight_10; imageIndex += shift; } // Draw the digit Background.DrawImage(this.HundredsImage, this.DigitRect_100, new Rectangle(0, (int)imageIndex, this.HundredsImage.Width, this.DigitRect_100.Height), GraphicsUnit.Pixel);
// Then the 1000s if (this.mAltitude < 990) { Background.DrawImage(this.FlagImage, this.DigitRect_1000, new Rectangle(0, 0, this.FlagImage.Width, this.FlagImage.Height), GraphicsUnit.Pixel); } else { imageIndex = this.mAltitude / 1000; imageIndex = imageIndex % 10; // Check to see this digit is moving bool updateDigit = false; if ((imageIndex % 1) > 0.99) { updateDigit = true; } imageIndex = (float)Math.Floor(imageIndex); imageIndex = (imageIndex * this.DigitHeight_1000) + this.DigitStart_1000; // Slowly shift this digit when it reaches 90 feet if ((lowDigit > 9) && updateDigit) { float shift = (lowDigit - 9) * this.DigitHeight_1000; imageIndex += shift; } Background.DrawImage(this.ThousandsImage, this.DigitRect_1000, new Rectangle(0, (int)imageIndex, this.ThousandsImage.Width, this.DigitRect_1000.Height), GraphicsUnit.Pixel); }
// Finally the 10,000s, if there is no 10,000s, then display the number as flagged if (this.mAltitude < 9990) { Background.DrawImage(this.FlagImage, this.DigitRect_10000, new Rectangle(0, 0, this.FlagImage.Width, this.FlagImage.Height), GraphicsUnit.Pixel); } else { imageIndex = this.mAltitude / 10000; // Check to see this digit is moving bool updateDigit = false; if ((imageIndex % 1) > 0.999) { updateDigit = true; } imageIndex = (float)Math.Floor(imageIndex); imageIndex = (imageIndex * this.DigitHeight_1000) + this.DigitStart_1000; // Slowly shift this digit when it reaches 90 feet if ((lowDigit > 9) && updateDigit) { float shift = (lowDigit - 9) * this.DigitHeight_1000; imageIndex += shift; } Background.DrawImage(this.ThousandsImage, this.DigitRect_10000, new Rectangle(0, (int)imageIndex, this.ThousandsImage.Width, this.DigitRect_10000.Height), GraphicsUnit.Pixel); }
// Draw the pointer float altNeedleAngle = (((this.mAltitude % 100) / 100.0F) * 360.0F) - 90.0F; // Work out the needle endpoint Point altPoint = new Point(); altPoint.X = this.dialCentre.X + (int)Math.Round(this.NeedleLength * Math.Cos(altNeedleAngle * Math.PI / 180)); altPoint.Y = this.dialCentre.Y + (int)Math.Round(this.NeedleLength * Math.Sin(altNeedleAngle * Math.PI / 180)); Point TipPoint1 = new Point(); TipPoint1.X = this.dialCentre.X + (int)Math.Round((this.NeedleLength - 8) * Math.Cos((altNeedleAngle - 5) * Math.PI / 180)); TipPoint1.Y = this.dialCentre.Y + (int)Math.Round((this.NeedleLength - 8) * Math.Sin((altNeedleAngle - 5) * Math.PI / 180)); Point TipPoint2 = new Point(); TipPoint2.X = this.dialCentre.X + (int)Math.Round((this.NeedleLength - 8) * Math.Cos((altNeedleAngle + 5) * Math.PI / 180)); TipPoint2.Y = this.dialCentre.Y + (int)Math.Round((this.NeedleLength - 8) * Math.Sin((altNeedleAngle + 5) * Math.PI / 180)); Point TipPoint3 = new Point(); TipPoint3.X = this.dialCentre.X + (int)Math.Round(this.NeedleStart * Math.Cos(altNeedleAngle * Math.PI / 180)); TipPoint3.Y = this.dialCentre.Y + (int)Math.Round(this.NeedleStart * Math.Sin(altNeedleAngle * Math.PI / 180));
// Create the polygon with the points Point[] altNeedle = { altPoint, // The end of the needle TipPoint1, // The left side pint TipPoint3, // The inner tip point TipPoint2 }; // The right side other side // Draw the polygon Background.FillPolygon(NeedleBrush, altNeedle); // Paste the image to the control e.Graphics.DrawImage(this.BackgroundImage, 0, 0);
// Freeup the resources NeedleBrush.Dispose(); this.BackgroundImage.Dispose(); Background.Dispose(); } catch (Exception ex) { if (ex.Message != "") { } } }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Thank you for your improvements on the code, it is cool. About the altimeter scrolling it is true that is not as smooth as on real instrument. I tried several solution and I finally chose to just offset the draw of the "9". In fact my main constraint was that the number of digits could be defined as a function parameter so I do not difference the unit digit, the ten digit, the hundred digit ect... there are draw equals. But I'll try to improve that, inspired by your solution.
Merci, A plus.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I have been working on aircraft instrument for some time now as well. These are well done. I used photographs of the actual instrument and edited it in GIMP so I can draw the mechanics. Nice to see someone else is also keen on this. I should add my code some time as well. I built mine for a pocket PC, but will work for any DotNet platform. Transparency is a problem for the Pocket PC, so I had to draw the needles with polygons.
Regards, Jeff
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
This is superb code. Only the artificial horizon needs to be able to go to 90° (so that you can fly upside down...
Have a nice life!!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
but the plural of foot is feet, not feets. This is not easy to change as it is on a bitmap, but it would drive me crazy. Other than that trivial little typo, this is very impressive work.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
I don't know if this is really an article because there is not much text BUT this is an awesome gadget!
Rafferty
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Wow, this is great.
I wrote a commercial instrument flight simulator 10 years ago in MFC C++... nothing was as neat as your controls are, thank you for sharing!

|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
But it lacks an article. If you give some background on the real controls, how you've simulated them in a UI and other interesting notes, it would be great! I don't recall seeing anything else like it here on cp.
Definitely a good start and idea.
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
 |
Altimeter should have pressure setting window - normally where you output digital alt reading. Otherwise - very impressive set of controls 
|
| Sign In·View Thread·PermaLink | 3.80/5 (5 votes) |
|
|
|
 |