Board index FlightGear Support Interfacing

protocol and data type

Connecting two computers, using generic protocol, connecting with Matlab?

protocol and data type

Postby bill516 » Thu Feb 20, 2020 5:16 pm

Looked at the examples for generic protocol and thought I understood it but now I'm not too sure. How do I tell if the data format is %d or %f, why have some of the formats got a letter= %n.nnf or even %.nf.

<chunk>
<name>heading (rad)</name>
<format>H=%.6f</format>
<type>float</type>
<node>/orientation/heading-deg</node>
<factor>0.0174532925199433</factor> <!-- degrees to radians -->
</chunk>

<chunk>
<name>pitch angle (deg)</name>
<format>P=%03.2f</format>
<node>/orientation/pitch-deg</node>
</chunk>

Another question is why do some of the values in the property tree node have [%d] in them .



Bill
bill516
 
Posts: 8
Joined: Tue Jun 25, 2019 4:20 pm

Re: protocol and data type

Postby Hooray » Thu Feb 20, 2020 5:18 pm

Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11835
Joined: Tue Mar 25, 2008 8:40 am

Re: protocol and data type

Postby bill516 » Fri Feb 21, 2020 11:27 am

Ok got that thanks.

[%d] is where there are multiple items i.e engines, fuel tanks etc .
X= places a letter before the data item
%n.nnf is a float with a leading zero and two decimal places, etc.

How do I tell if the data is a number or a float?

Bill
bill516
 
Posts: 8
Joined: Tue Jun 25, 2019 4:20 pm

Re: protocol and data type

Postby SurferTim » Fri Feb 21, 2020 11:29 am

Look in the internal properties for that property. It will tell you what data type it is.
Be careful. I found that using a float if the data type is a double will cause rounding errors.
Fly low, fly slow, land on a dime. Twin Otter DHC6-300+. https://github.com/SurferTim/dhc6p
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 949
Joined: Sun Dec 09, 2018 5:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2019.2.0
OS: Ubuntu 18.04

Re: protocol and data type

Postby Hooray » Fri Feb 21, 2020 12:40 pm

See: http://wiki.flightgear.org/Property_Browser - specifically: "To toggle verbose/developer mode ctrl-click an "." entry."

Image

(admittedly, the wiki could use a corresponding screen shot showing the verbose/developer mode)
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11835
Joined: Tue Mar 25, 2008 8:40 am

Re: protocol and data type

Postby bill516 » Sun Feb 23, 2020 10:27 pm

Thank s Hooray I think its all sunk in now,
bill516
 
Posts: 8
Joined: Tue Jun 25, 2019 4:20 pm

Re: protocol and data type

Postby Hooray » Mon Feb 24, 2020 11:07 am

If you think that this covers grounds that isn't currently covered in the wiki, please do feel invited to add to the wiki accordingly - e.g. by updating the wiki as needed, to add your examples and/or by creating a dedicated little "tutorial" or "howto" - you could also add your example to the newsletter. Again, everything around here is a community-driven effort, so it's your decision to get actively involved in sharing information and contributing your knowledge, so that others can benefit - some of whom may stumble across your postings or articles, even in years to come :D
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11835
Joined: Tue Mar 25, 2008 8:40 am


Return to Interfacing

Who is online

Users browsing this forum: Applebot [Bot], Google [Bot] and 1 guest