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 6: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 5:20 pm

Re: protocol and data type

Postby Hooray » Thu Feb 20, 2020 6: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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: protocol and data type

Postby bill516 » Fri Feb 21, 2020 12:27 pm

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 5:20 pm

Re: protocol and data type

Postby SurferTim » Fri Feb 21, 2020 12:29 pm

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. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1718
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: protocol and data type

Postby Hooray » Fri Feb 21, 2020 1: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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: protocol and data type

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

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

Re: protocol and data type

Postby Hooray » Mon Feb 24, 2020 12:07 pm

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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 4 guests