March 9, 200620 yr has anyone out there done any joystick automation using flightgear. Meaning has anyone set it up so that keycommands and joysticks commands are done in code?thanks for the help
March 9, 200620 yr >has anyone out there done any joystick automation using>flightgear. Meaning has anyone set it up so that keycommands>and joysticks commands are done in code?>>thanks for the helpThat's easy: everything in FlightGear is centered around the so called "property tree", meaning that the majority of all I/O goes through the property tree manager, which exposes all state variables in a tree-like fashion, using path (variables) and value pairs.So, joystick input is written to the property tree, which is then in turn used in order to write corresponding values (i.e. surface deflections) to another property tree location, which results in the aircraft changing its state (FDM,3D model animation etc.).Thus, if you only want to replace the joystick I/O with some sort of automated logics, you simply have to manipulate the corresponding properties directly. You can either do this using an external program/script and access FlightGear's property tree via network, or simply use FlightGear's integrated scripting language "Nasal". Basically, you could even write an entirely convincing autopilot implementation using this approach.You will probably want to have a look into the property browser, so that you can view all available state variables, accessing these is a matter of simply using the available fgcommands (see $FG_ROOT/README.commands) or using the aforementioned scripting language (which is much more powerful and largely also cleaner). By placing a new script file named "autotest.nas" under $FG_ROOT/Nasal, this file will be automatically loaded and executed during FlightGear startup. So, you could drop there all your stuff, in order to do things like:1) release brakes2) set takeoff flaps3)push throttle in4) maintain runway heading5) pitch up aircraft after takeoff speed has been reached6) retract flaps once airspeed has increased etc.Probably, we could come up with some code snippets if you tell us what EXACTLY you want to do.However, doing all this is mainly a matter of doing comparisons of property values at fixed intervals. So, you will primarily use the getprop() and setprop() functions to manipulate the property tree (comparing the real state vs. the state that you desire). Using a callback function that runs at regular intervals, you can ensure that your checker functions are executed continously.The Nasal reference is available at http://www.plausible.org/nasal
March 11, 200620 yr Thanks for the response....what i want to do is since i am going to be working with someone who is going to be doing some flight dynamics for a glider and i want to repeatedly do the same thing over and over to see if adjusting the dynamics one way changes how it flies. if you have any example nasal things of doing something with pitch and roll that would be awesome i could prob figure it out from there.thanks again man
Create an account or sign in to comment