OK
So I've put together the file as best I can, and I know it isn't correct, I want to thank everyone who pitches in to help in advance I really appreciated it. Lets start with the inputs first.
Inputs
What I am trying to accomplish is very simple, I want to allow my HiL to control the plane from point A to point B, and I figure that all I really need to accomplish this in the way of inputs are a few controls, like throttle, gear, steering, control surfaces and thats about it. OK so I think I found those and put them in the file properly but I am a little lost on a few things.
1. Most of the planes I'll be flying will have more that one rudder, they will have a left and a right rudder --> F14, B2, and the SR-71 BlackBird. I only found an input for one rudder in the tree, and I want to understand better exactly how I can control both rudders with only one input, because for example in the case of the B2, there are scenarios where I'll need to open up both of the rudders at the same time during landing for example, how do I accomplish this with one input. I have the same question and problem with the input for the ailerons.
2. Also I need all these inputs to be integers and if possible I'd like to define the range, can I do this?
Outputs
Now for the outputs, have several questions here, first a little about what I am trying to accomplish. I am designing an autopilot system using some custom hardware and of course I want to use FlightGear to simulate a flight using my hardware and software. I would like to as much as possible have the outputs from flightgear mimic the actual outputs my hardware will be getting from the real GPS, and IMU sensors it will be using once its is in the field, that way the simulations will be as close as possible to the real thing, and I won't have to make major changes to my software going from simulation to actual hardware test. OK with that said here are my concerns.
1. For the Gyro Angular rates I need the outputs to be integers with a sensitivity factor of 14.375 LSB/(º/s) just as the actual gyro sensor I am using will give them to me. When I pull the values in I'll convert the to floating point by simple dividing each angular rate by 14.375. And I simply have no idea how to do this in xml.
2. For the Accelerometer magnitudes I need the outputs to be integers The conversion is based on a +/-4G range just as the actual accelerometer sensor I am using will give them to me. When I pull the values in I'll convert the to floating point by multiplying each value by 0.0078.
3. Lastly I would actually like to receive the GPS data as an actual GPS sentences and not just grabbing the lon/lat/alt. Don't get me wrong I like the simplicity here but again I am trying to mimic the sensors and gps I'll actually be using in the field as close as possible so I actually need the information send out as GPS sentences in binary format.
OK when you look at the code below you are going to see me use the factor option like <factor>0.0174532925199433</factor>, and sometimes the format option like this for example <format>rudder=%.6f</format>, I have no idea what these things do, I put this file together by using parts of other files that I have come across and my limited understanding of what I read on the wiki.
Your help is much appreciated!!
- Code: Select all
<?xml version="1.0"?>
<PropertyList>
<generic>
<!-- INPUT CONTROLS -->
<input>
<line_separator></line_separator>
<var_separator></var_separator>
<chunk>
<name>Steering (rad)</name>
<format>steering=%.6f</format>
<type>float</type>
<node>/controls/gear/steering</node>
<factor>0.0174532925199433</factor>
</chunk>
<chunk>
<name>Gears (rad)</name>
<format>gears=%.6f</format>
<type>float</type>
<node>/controls/gear/gear-down</node>
<factor>0.0174532925199433</factor>
</chunk>
<chunk>
<name>Throttle (rad)</name>
<format>throttle=%.6f</format>
<type>float</type>
<node>/controls/engines/engine[%d]/throttle</node>
<factor>0.0174532925199433</factor>
</chunk>
<chunk>
<name>Aileron (rad)</name>
<format>aileron=%.6f</format>
<type>float</type>
<node>/controls/flight/aileron</node>
<factor>0.0174532925199433</factor>
</chunk>
<chunk>
<name>Elevator (rad)</name>
<format>elevator=%.6f</format>
<type>float</type>
<node>/controls/flight/elevator</node>
<factor>0.0174532925199433</factor>
</chunk>
<chunk>
<name>rudder (rad)</name>
<format>rudder=%.6f</format>
<type>float</type>
<node>/controls/flight/rudder</node>
<factor>0.0174532925199433</factor>
</chunk>
</input>
<output>
<line_separator>newline</line_separator>
<var_separator>newline</var_separator>
<binary_mode>false</binary_mode>
<!-- GPS output of course to allow the plane to actually fly to it destination, and for some angle calculations -->
<chunk>
<name>Speed</name>
<format>V=%d</format>
<type>float</type>
<node>/velocities/airspeed-kt</node>
</chunk>
<chunk>
<name>Altitude (rad)</name>
<format>A=%.6f</format>
<type>float</type>
<node>/position/altitude-ft</node>
<factor>0.0174532925199433</factor>
</chunk>
<chunk>
<name>Latitude-deg (rad)</name>
<format>Lat=%.6f</format>
<type>float</type>
<node>/position/latitude-deg</node>
<factor>0.0174532925199433</factor>
</chunk>
<chunk>
<name>Longitude-deg (rad)</name>
<format>Lon=%.6f</format>
<type>float</type>
<node>/position/longitude-deg</node>
<factor>0.0174532925199433</factor>
</chunk>
<!-- Orientation Angles output for comparason with calculated angles done by my HiL -->
<chunk>
<name>Roll Angle (deg)</name>
<format>RD=%03.2f</format>
<node>/orientation/roll-deg</node>
</chunk>
<chunk>
<name>Pitch Angle (deg)</name>
<format>PD=%03.2f</format>
<node>/orientation/pitch-deg</node>
</chunk>
<chunk>
<name>Yaw Rate (deg)</name>
<format>YD=%03.2f</format>
<node>/orientation/yaw-deg</node>
</chunk>
<!-- Orientation angular rate outputs to allow my HiL to calculate the orientation angles -->
<chunk>
<name>Pitch rate (deg per sec)</name>
<format>PR=%03.2f</format>
<node>/orientation/pitch-rate-degps</node>
</chunk>
<chunk>
<name>Roll rate (deg per sec)</name>
<format>RR=%03.2f</format>
<node>/orientation/roll-rate-degps</node>
</chunk>
<chunk>
<name>Yaw Rate (deg per sec )</name>
<format>YR=%03.2f</format>
<node>/orientation/yaw-rate-degps</node>
</chunk>
<!-- Accelerometer magnitude outputs to allow my HiL to calculate the orientation angles -->
<chunk>
<name>Accelerometer X (ft per sec)</name>
<format>AX=%03.2f</format>
<node>/accelerations/x-accel-fps_sec</node>
</chunk>
<chunk>
<name>Accelerometer Y (ft per sec)</name>
<format>AY=%03.2f</format>
<node>/accelerations/y-accel-fps_sec</node>
</chunk>
<chunk>
<name>Accelerometer Z (ft per sec)</name>
<format>AZ=%03.2f</format>
<node>/accelerations/z-accel-fps_sec</node>
</chunk>
</output>
</generic>
</PropertyList>