Posted by Curt Olson on December 2, 2009 at 1:30pm
I'm almost embarrassed to post this video. It was done almost entirely with open-source software, so it's obviously way behind what people are doing with commercial software and commercial systems. But I have fun and entertain myself with this stuff, so I thought I'd share a brief snippet.https://www.youtube.com/watch?v=yIDQq93cpcoWhat you are seeing is FlightGear (http://www.flightgear.org). I have a FlightGear model of a Sig Rascal 110 (which I've flown in real life many times.) The 3d model and the flight dynamics model are also open-source so of course are also subpar from anything that would be done commercially. The FlightGear flight dynamics engine is outputting gyro, accelerometer, and gps data to an external embedded computer running MicoGear. MicroGear takes the "sensor" data, runs it through a 15 state kalman filter (the one piece here that isn't open-source) and estimates roll, pitch, yaw, and location.Because this is FlightGear I already know the true pitch, roll, and yaw, but I promise I'm not cheating here. The kalman filter on the embedded board is estimating these values and using them as input to the autopilot and routing algorithms also running on the embedded board. The only difference between this and real life from the microgear/embedded-processor point of view is that it's not getting it's data from the onboard sensors and it's not driving servos directly. Instead it sends the servo commands back to FlightGear and the control surfaces are moved over there in the simulator.This turns out to be a really nice hardware in the loop testing platform and many subtle issues that show up in real life, also show up in the simulator. Because this is FlightGear, a person can throw a variety of weather conditions at the system, turbulence, high winds, etc. You can disable fuel consumption and run for hours or days if you like.I am very tempted to turn in a "virtual" entry into one of the upcoming DIY drones contests. :-) Oops, I almost started to crack a smile there. Ok, I'm back to my long, sullen, down trodden facial expression, because after all this is all pretty much all open-source software -- which just sucks -- total crap I know -- sorry to even waste your time and bandwidth with any of this guys. I won't post anything ever again until I have something actually useful or interesting to show.Curt.
I am Tejeshwi from India. I have just completed my B.Tech in mechanical engineering at IIT Delhi. Currently, i am working on a project at LEC, ETH Zurich. The objective of the project is to simulate a Funjet which works with an brushless electric pusher-prop engine. I am using JSBSim to simulate the flight dynamics. Now, since electric engine engine.xml files do not come as a template when you download JSBSim, i was wondering how to author this file. I learned from Tom that you have developed some rascal JSBSim model which apparently models a brushless motor. could you kindly share with some of an overview of the rascal JSBSim model and enlighten me a bit on authoring the engine file for an electric engine.
The new documentation is clearer than the previous model (2005-2009).
With GPS coordinates (WSG-84), you can obtain the values of the magnetic field at this point. After this you only have to rotate it according to the attitude angles FROM the simulator (not from your estimator ofc :P), add some noise and that's it.
FlightGear does not actually have a magnetometer model at the moment either. It's on my todo list if someone else doesn't beat me to it first. If we did add something, it would very likely be based on the world magnetic model too.
We have a flightgear developer working on a flight dynamics model for the easystar glider so we'll have that and a Sig Rascal that are well modeled in FlightGear.
I have some questions since I'm using X-Plane instead FG.
X-Plane doesn't have means to measure magnetometers. Actually I have to emul this measures from a world magnetic model.
Does FG have it? (magnetometers in mG or something like this).
How it is the FG community/support for RC vehicles? X-Plane is nice if you have to make one, but there are a few models in the web to download, test etc
Thanks Curt,
This is fantastic... I am just using serial at 10hz output from FG over 57600 baud and my DCM code is generating the correct pitch and roll over serial output to my VB simple GS artificial horizon indicator... Now I can work on reducing impacts of accelerations etc on accelerometers to get better attitude estimates in turns etc... really neat... get it close in sim then should be close in real... just using the clean data at this time and have not worried about adding some noise to the signals until I get the DCM and 7 state Kalman attitude estimates close... then add that additional issue... Then add navigation routine output FG and see if it works... Thanks for all the information... this is a great tool!
Sean
Hi Sean, depending on your bandwidth available, you could send the flightgear truth data to your hardware along with the raw sensor values. Then when you log your ahrs data, you can log the truth values simultaneously.
You can send arbitrary data to FlightGear as well and then log that, so yes, you could send your ahrs data back to flightgear, stuff that in a corner some where (pick your own property names) and then do the logging of the truth plus your data from the FlightGear side.
Hi Curt,
The sim is great as Mark has said. I also saw you youtube video with Rascal flying figure of 8... wow... I have a long way to go...but I have had success with sending my hardware data over serial to flightgear. I changed the flightgear speed of data input to something like 50hz, probably could be lower, but hey now it works. It still has an initial startup delay in realtime changes, but after about 20 seconds I have the orientations reflected in Flightgear on a realtime basis. I should now change my firmware to read serial data in from flightgear (I set up another xml file that sends out GPS lat long gpsheading alt airspeed accels (xyz) gyro (xyz)) and see what my ahrs tells me and compare it to flightgear... I intend to log flightgear truth values to a file and send my ahrs estimates to a file over another serial port for later analysis.. just need to match them up re timing which may be an issue.
Does this sound ok? Any suggestions?
Is one able to send data to flightgear into user variables so that it may be output to same file with truth data, so as to avoid the need for later processing and trying to get both data sets to match re timing etc.?
I don't have any ethernet on my hardware so I have to use serial data in and out.
With the flightgear command line option you use to read in the serial data, try specifying an update rate that is 2x what you are actually sending. If you are sending 5hz data, try sending the data at 10hz. It's possible that the data is getting buffered and that FlightGear isn't clearing it fast enough. If that is the issue, then this will be good evidence, and also it should serve as a pretty good work around.
I downloaded version 2.0 of flightgear and have found that using serial data input, this new version still has a significant delay in processing of the serial data. I found that with my hardware output at 5hz 38400baud, using simple xml file (formatted with new line and comma separated data for latitude, longitude, altitude, roll, pitch and heading), I get very long delays around 30 seconds before the the flightgear updates the attitude. When it does update the attitude, it seems to do so at normal speed. I selected "external" or "null" as FG model to use, left defaults for 120Hz and 1x realtime speed. I wish to have plane stay stationary and just move in roll,pitch and yaw... first steps in testing my 7 state kalman and DCM with FG. I may just try Faisal's trick and make FG read input data at say 25hz or 50hz while my external hardware sends data at 5hz.
I wondered if this bug had been fixed in version 2.0, but perhaps not, for serial data input it seem. Perhaps I need to should write a simple VB or VC program that reads my hardware serial data and outputs UDP for use into FG, but never tried that in VB or VC... I may take a look at Faisal's c code...
Comments
I am Tejeshwi from India. I have just completed my B.Tech in mechanical engineering at IIT Delhi. Currently, i am working on a project at LEC, ETH Zurich. The objective of the project is to simulate a Funjet which works with an brushless electric pusher-prop engine. I am using JSBSim to simulate the flight dynamics. Now, since electric engine engine.xml files do not come as a template when you download JSBSim, i was wondering how to author this file. I learned from Tom that you have developed some rascal JSBSim model which apparently models a brushless motor. could you kindly share with some of an overview of the rascal JSBSim model and enlighten me a bit on authoring the engine file for an electric engine.
Cheers,
Tejeshwi
http://www.ngdc.noaa.gov/cgi-bin/hazard/reroute.pl?urltable=segweb....
And what about the RC models in FG? When the scale is getting lower, the Reynolds number tends to low as well, and the simulation is not so accurate.
In XP is about 95% realistic in my opinion and experience xD.
Regards
Download the WMM from:
http://www.diydrones.com/profiles/blogs/microgear-hardware-in-the-l...
The new documentation is clearer than the previous model (2005-2009).
With GPS coordinates (WSG-84), you can obtain the values of the magnetic field at this point. After this you only have to rotate it according to the attitude angles FROM the simulator (not from your estimator ofc :P), add some noise and that's it.
FlightGear does not actually have a magnetometer model at the moment either. It's on my todo list if someone else doesn't beat me to it first. If we did add something, it would very likely be based on the world magnetic model too.
We have a flightgear developer working on a flight dynamics model for the easystar glider so we'll have that and a Sig Rascal that are well modeled in FlightGear.
Regards,
Curt.
I have some questions since I'm using X-Plane instead FG.
X-Plane doesn't have means to measure magnetometers. Actually I have to emul this measures from a world magnetic model.
Does FG have it? (magnetometers in mG or something like this).
How it is the FG community/support for RC vehicles? X-Plane is nice if you have to make one, but there are a few models in the web to download, test etc
Thank you so much!
This is fantastic... I am just using serial at 10hz output from FG over 57600 baud and my DCM code is generating the correct pitch and roll over serial output to my VB simple GS artificial horizon indicator... Now I can work on reducing impacts of accelerations etc on accelerometers to get better attitude estimates in turns etc... really neat... get it close in sim then should be close in real... just using the clean data at this time and have not worried about adding some noise to the signals until I get the DCM and 7 state Kalman attitude estimates close... then add that additional issue... Then add navigation routine output FG and see if it works... Thanks for all the information... this is a great tool!
Sean
You can send arbitrary data to FlightGear as well and then log that, so yes, you could send your ahrs data back to flightgear, stuff that in a corner some where (pick your own property names) and then do the logging of the truth plus your data from the FlightGear side.
Curt.
The sim is great as Mark has said. I also saw you youtube video with Rascal flying figure of 8... wow... I have a long way to go...but I have had success with sending my hardware data over serial to flightgear. I changed the flightgear speed of data input to something like 50hz, probably could be lower, but hey now it works. It still has an initial startup delay in realtime changes, but after about 20 seconds I have the orientations reflected in Flightgear on a realtime basis. I should now change my firmware to read serial data in from flightgear (I set up another xml file that sends out GPS lat long gpsheading alt airspeed accels (xyz) gyro (xyz)) and see what my ahrs tells me and compare it to flightgear... I intend to log flightgear truth values to a file and send my ahrs estimates to a file over another serial port for later analysis.. just need to match them up re timing which may be an issue.
Does this sound ok? Any suggestions?
Is one able to send data to flightgear into user variables so that it may be output to same file with truth data, so as to avoid the need for later processing and trying to get both data sets to match re timing etc.?
I don't have any ethernet on my hardware so I have to use serial data in and out.
Thanks for your help.
Sean
With the flightgear command line option you use to read in the serial data, try specifying an update rate that is 2x what you are actually sending. If you are sending 5hz data, try sending the data at 10hz. It's possible that the data is getting buffered and that FlightGear isn't clearing it fast enough. If that is the issue, then this will be good evidence, and also it should serve as a pretty good work around.
I downloaded version 2.0 of flightgear and have found that using serial data input, this new version still has a significant delay in processing of the serial data. I found that with my hardware output at 5hz 38400baud, using simple xml file (formatted with new line and comma separated data for latitude, longitude, altitude, roll, pitch and heading), I get very long delays around 30 seconds before the the flightgear updates the attitude. When it does update the attitude, it seems to do so at normal speed. I selected "external" or "null" as FG model to use, left defaults for 120Hz and 1x realtime speed. I wish to have plane stay stationary and just move in roll,pitch and yaw... first steps in testing my 7 state kalman and DCM with FG. I may just try Faisal's trick and make FG read input data at say 25hz or 50hz while my external hardware sends data at 5hz.
I wondered if this bug had been fixed in version 2.0, but perhaps not, for serial data input it seem. Perhaps I need to should write a simple VB or VC program that reads my hardware serial data and outputs UDP for use into FG, but never tried that in VB or VC... I may take a look at Faisal's c code...
Thanks
Sean