Anders

  I have included the following line in my generic xml file

<output>
      <binary_mode>true</binary_mode>
      <byte_order>network</byte_order>

  My C++ code looks like this now.

float gps_vdummy, gps_xdummy, gps_ydummy, gps_zdummy;

if ( (quik_silva_status_reg & 0x00001000) != 0 ) { //CHECK TO SEE IF
SIMULATOR DATA IS AVAIABLE

     gps_vdummy  = rs232_uart1_fp;
     gps_zdummy = rs232_uart1_fp;
     gps_xdummy = rs232_uart1_fp;
     gps_ydummy = rs232_uart1_fp;
     etc ...

  My hardware is returning a 32bit floating point word, in hardware what is
happening is my UART is taking in the bytes one at a time of course and
shifting the into a 32bit register a byte at a time, and returning that
32bit value.  Soooo if FG is sending the data MSB(most significant byte
first), then I should be getting the correct value, right?




On Tue, Aug 16, 2011 at 1:37 PM, Anders Gidenstam
<anders-...@gidenstam.org>wrote:

> On Tue, 16 Aug 2011, Derrick Washington wrote:
>
> > OK so I have to specify wether or not FG should be using host or network
> > byte order.  OK, I don't have the source code I just downloaded the
> > executable, so I'll have to figure out some way of checking it.  OK then
> > once I specify this I have to somehow check to see exactly what that
> > order box is using MSB first, or LSB first.
> >
> > BTW in my generic protocol file I didn't not have this specified at all,
> I
> > wasn't aware that I had to do that, maybe I over looked something, but I
> > haven't seen this before.  The battle continues, thanks for your input.
>
> If you don't specify byte order, host order will be used. Anything x86 is
> very likely to use LSB order (a PC certainly is).
>
> If you post how your code decode the value we might be able to spot the
> problem. Have you verified that your code does not receive the
> expected value?
>
> Your earlier code, with my correction, should receive float values in
> network order (if reading the rs232_uart1 variable really gives you the
> next byte from the serial port each time - I would have expected some sort
> of handshaking or waiting between the bytes?):
>
> for ( int i = 0; i <= 3; i++ )
>   { dummy_var = (dummy_var << 8) | rs232_uart1; }
>
> return *(float *)&dummy_var;
>
>
> Cheers,
>
> Anders
> --
> ---------------------------------------------------------------------------
> Anders Gidenstam
> WWW: http://www.gidenstam.org/FlightGear/
>
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at:  http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>
<?xml version="1.0"?> 
<PropertyList>
<generic>

   <output>
      <binary_mode>true</binary_mode>
      <byte_order>network</byte_order>
	
<!--  GPS output of course to allow the plane to actually fly to it's destination, and for some angle calculations -->

     <chunk>
       <name>Speed</name>
       <node>/velocities/airspeed-kt</node>
     </chunk>

     <chunk>
       <name>Altitude </name>
       <node>/position/altitude-ft</node>  
     </chunk>

      <chunk>
       <name>Latitude-deg </name>
       <node>/position/latitude-deg</node> 
     </chunk>

     <chunk>
       <name>Longitude-deg (rad)</name>
       <node>/position/longitude-deg</node> 
     </chunk>

<!--  Orientation angular rate outputs to allow my HiL to calculate the orientation angles -->

    <chunk>
       <name>Pitch rate (deg per sec)</name>
       <node>/orientation/pitch-rate-degps</node>
     </chunk>

     <chunk>
       <name>Roll rate (deg per sec)</name>
       <node>/orientation/roll-rate-degps</node>
     </chunk>

     <chunk>
       <name>Yaw Rate (deg per sec )</name>
       <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>
       <node>/accelerations/x-accel-fps_sec</node>
     </chunk>

     <chunk>
       <name>Accelerometer Y (ft per sec)</name>
       <node>/accelerations/y-accel-fps_sec</node>
     </chunk>

     <chunk>
       <name>Accelerometer Z (ft per sec)</name>
       <node>/accelerations/z-accel-fps_sec</node>
     </chunk>

<!--  Orientation Angles output for comparason with calculated angles done by my HiL 

     <chunk>
       <name>Roll Angle (deg)</name>
       <node>/orientation/roll-deg</node>
     </chunk>

     <chunk>
       <name>Pitch Angle (deg)</name>
       <node>/orientation/pitch-deg</node>
     </chunk>

     <chunk>
       <name>Yaw Rate (deg)</name>
       <node>/orientation/yaw-deg</node>
     </chunk>
                   -->
  </output>

</generic>
</PropertyList>
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to