
Setting General - Control - joystick or auto does not help.Īs opposed to the number of buttons in the xml file the joystick actually has 9 buttons and a thrust lever. FG loads fine, but when trying to use my old Logitech Wingman Force it does not register in FG even though there is an xml written for it. This should provide a complete framework with which to write an autopilot controller in C.Hi, I've just downloaded FG v. ), but it should be trivial to make it more general purpose. Currently, everything is hardcoded (port numbers, etc.

Then it loops again, waiting for another packet from FlightGear. It waits until it receives a new packet, processes it, and sends a packet with control inputs back to FlightGear.
#FLIGHTGEAR JOYSTICK XML ENGINE CODE#
The code makes a blocking call to read UDP data. I've implemented simple proportional control for roll and pitch to stabilize the aircraft. c program which I wrote to interact with the property tree and provide feedback controls to FlightGear. The -generic option allows one to specify a generic protocol, which was defined in the. I made the input data rate faster than the output data rate, because I would rather have FlightGear waiting for a new input value (when it doesn't get a new input, the last one persists) than the input being buffered. I chose UDP for ease.įgfs -httpd=5500 -generic=socket,out,40,localhost,5000,udp,output_protocol -generic=socket,in,45,localhost,5010,udp,input_protocol
#FLIGHTGEAR JOYSTICK XML ENGINE SERIAL#
The data can be passed through several means, serial port, tcp, udp, etc. You identify the nodes in the property tree which you want to interact with, the data types, the string formatting, and voila! Attached are the input and output. The protocol basically defines the format in which data is exchanged. The property tree can be read from and written to using a "Protocol". I did this to figure out the sign convention for different properties. Alternatively, in FlightGear you can type "/", and the property tree viewer will pop up and you can view the values changing in real time. If you run FlightGear with the -httpd= option, it will run a webserver on where you can browse the property tree and refresh the current values.

Programs can interface with FlightGear through FlightGear's property tree. Are these properties the ones I should use to generate the correct sensor data, emulating an ArduIMU? How can I get the values I need out of FlightGear (I read that a UDP socket is used?).*Gyro sensors*/orientation/roll-rate-degps/orientation/pitch-rate-degps/orientation/yaw-rate-degps*Accelerometers*/accelerations/pilot/x-accel-fps_sec/accelerations/pilot/y-accel-fps_sec/accelerations/pilot/z-accel-fps_sec*ground truth data to be logged and compared with my own AHRS output*/orientation/roll-deg/orientation/pitch-deg/orientation/heading-degHow does everyone here test their algorithms before sending it up in the air? Anyone else run their autopilot code in a closed loop with a flight dynamics model? If not, I wouldn't mind putting in some extra effort to make this interface nice/easy-to-use so that it can be used by the community out of the box for autopilot testing.Thanks in advance! Has this been done before? I've looked around a bit and it seems that FlightGear is well suited for this type of hackery. Use the autopilot to accept sensor inputs from the FDM, and send back control surface inputs.Right now I'm concentrating on Phase 1. My AHRS code would read in the sensor log, compute the pitch-roll-yaw angles, and would allow me to compare it with the "ground truth" data generated by the FDM.Phase 2: Close the loop. The FDM would generate and log the sensor readings and the "ground truth" pitch-roll-yaw angles.

I would load the simulation and fly an airplane around in some pattern. This would not require the flight dynamics model to accept control surface input from the autopilot. Tuning/experimenting with the AHRS algorithm. I want to be able to code in C, so I can use the code directly in the hardware autopilot when I reach that point.I want to use a flight dynamics model to generate sensor inputs to the autopilot (3 axis gyro, 3 axis accelerometer, GPS - just like ArduIMU), and have the autopilot generate control surface inputs to the simulated plane in the flight dynamics model.Phase 1: Open loop. So, while I'm saving for the hardware, I want to play with the various algorithms out there in a simulation environment - to gain a deeper understanding and feel for it. I don't have the cash right now to buy a plane, ArduIMU, an auto pilot, and associated hardware.
