Page 1 of 1

Simulation

PostPosted: Thu Jan 12, 2012 9:25 pm
by icebear
Hi,

This is probably aslked/covered in a thread somewhere so excuse me if I am bringing up old questions...

I just thought it would be nice to simulate the routes planned in the Gluon Control Station.

Are there any plans to implement such a feature to do a simulation of a planned route?

Thanks,

Bjorn

Re: Simulation

PostPosted: Thu Jan 12, 2012 9:44 pm
by Tom
Hi Bjorn,

Yes I know it would be cool. I would like to have a hardware-in-the-loop simulator, this would allow me to test the firmware too :-)
I already tried it with flightgear, but for some reason it's not going very smooth... I guess I will implement a simple simulator in the GCS itself instead of using an external one.

It will come, but not yet :-)

Re: Simulation

PostPosted: Thu Mar 01, 2012 9:15 am
by rohr_manuel
Hi Tom,

first of all I have to say: Great autopilot, and especially great ground control station. I really like the functionality and opportunities of it. It's nice what you have managed the last few years. So now to the reason of my post:

If you are still interested in creating a HIL simulator with FlightGear I might help. Last week I have successfully accomplished a working hardware-in-the-loop simulator with FlightGear and my own Autopilot (not Gluonpilot).

Short explanation what I've done:
My setup takes the following sensor data of FlightGear and sends them to the autipilot:
  • Roll, Pitch, Yaw
  • Rollrate, Pitchrate, Yawrate
  • Altitude, Airspeed, GPS (North, East)

The autopilot is believing it flies really in the air and is creating the actuator outputs (PWMs) depending on its attitude. These outputs will be send back to Flightgears Aileron, Elevator and Rudder controls. The update rate of sensor data and actuators (PWM Signals) are all 50ms = 20Hz.
I managed the communication via a C# socket parser. So Flightgear is talking to the parser over a socket (TCP), and the parser is transferring the data into UART messages, sending and receiving them to and from the autopilot.

FlightGear also provides accelerometer and gyroscope data, so it is also possible to input data before the Kalman filter and let the filter calculate the roll, pitch, ... data. This gives you the opportunity to compare and check the functionality of the filters attitude output o the autopilot with the real attitude created by FlighGear.

I have no problems displaying the simulation; in fact even with the small update rate of 20Hz it runs very smooth. It's really funny and cool to simulate the hardware and the PID controllers with FlightGear, cause it provides you with such great functionality. E.g. you can test your system from light to heavy wind, can test landing and start algorithms from an airstrip, ...

If it's still a matter of concern I am looking forward to help you if there are any questions.

Regards,
Manuel

Re: Simulation

PostPosted: Thu Mar 01, 2012 3:01 pm
by Tom
Hi Manual,

That is really cool, I tried that too but never succeeded in controlling a flightgear plane really well. I always assumed my sockets <-> COM port links had some delay somewhere but didn't have time to really look into it. In the end it was easier to write a simple simulator myself :-)

Since I also use C#: are you sharing the code somewhere?

Re: Simulation

PostPosted: Fri Mar 02, 2012 9:22 am
by rohr_manuel
Hi Tom,

currently I've no website of my running projects (to share the code), but I'm working on it :).
I gladly share the code with you, I just write you a PM with a packaged file, containing the C# source code and the xml files for FlighGear (input.xml, output.xml).

If you have any questions concering my source code, just ask!

Regards,
Manuel