![]() ( throttle! 1) wait for a little while and you should be airbourne ( starter! true) wait until engine started So instead I fired up the REPL, connected to the flight simulator over the telnet port and started issuing command. I could write a few Clojure functions to control the airplane, but I dont know how responsive it will be. You may have a newer version of Clojure than in the above example. lein new my-flightĮditing the my-flight/project.clj project file, I added a dependency on Dale’s flightgear project project.clj 1 I created a basic Clojure project using Leingen, of course. Now you should see a plane cockpit, ready and waiting for you to jump into the controls. I am assuming this is what the library uses to communicate with. Following Dale’s guide, I ran the emulator with a specific Telnet port. Whilst there are GUI tools to run FlightGear, I just went for the command line. You can of course use apt-get on the command line too: sudo apt-get install flightgear Be aware that the file is 635MB in size (1.3GB once installed), so you need a decent Internet connection and a fair bit of space. I am using Ubuntu 12.10 and FlightGear is in the software center, so its easy to add it. I took Dale’s project for a test flight and here are my experiences! Getting set up Now, Dale has not yet connected this to a real plane, instead he is using the open source flight simulator, FlightGear. ), but it should be trivial to make it more general purpose.This should provide a complete framework with which to write an autopilot controller in C.Comments please! udpserver.c output_protocol.xml input_protocol.Dale Thatcher from the London Clojure community created a Clojure project that allows you to fly a plane in real time. 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. 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. I chose UDP for ease.Here is how I ran FlightGear:fgfs -httpd=5500 -generic=socket,out,40,localhost,5000,udp,output_protocol -generic=socket,in,45,localhost,5010,udp,input_protocolI 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.The -generic option allows one to specify a generic protocol, which was defined in the. xml protocol files which I used (copy to FlightGear's data/Protocol directory).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. I did this to figure out the sign convention for different properties.The property tree can be read from and written to using a "Protocol". ![]() Alternatively, in FlightGear you can type "/", and the property tree viewer will pop up and you can view the values changing in real time. 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. Figured out how to close the loop!Programs can interface with FlightGear through FlightGear's property tree.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |