Board index FlightGear Support Interfacing

Telnet 'dump' data missing?

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

Telnet 'dump' data missing?

Postby zogulus » Thu Mar 21, 2013 11:42 pm

I'm using the telnet interface on MacOS with FlightGear 2.10.0. If I use the dump command for a path like '/velocities' I get all the data listed by an ls. But if I request some instrumentation some values are not shown in the XML.

e.g. 'dump /instrumentation/airspeed-indicator/'

gives the output:

<?xml version="1.0"?>

<PropertyList>
<serviceable type="bool">true</serviceable>
</PropertyList>

But 'ls' in the same directory gives:

/instrumentation[0]/airspeed-indicator[0]> ls
serviceable = 'true' (bool)
indicated-speed-kt = '2.136631671' (double)
true-speed-kt = '2.155370614' (double)
indicated-mach = '0.003230429527' (double)

Am I missing something?

many thanks,

- Dale
zogulus
 
Posts: 3
Joined: Thu Mar 21, 2013 11:35 pm

Re: Telnet 'dump' data missing?

Postby Gijs » Fri Mar 22, 2013 9:08 am

Welcome Dale!

You're not alone in your struggle. I see the same. Apparently this has been unanswered for over 10 years (see this message from 2002)... Sorry that I cannot help you yet, but I'll see if someone knows the answer ;-)

Cheers,
Gijs
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9401
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Telnet 'dump' data missing?

Postby Hooray » Fri Mar 22, 2013 11:03 am

it seems, that for whatever reason, the current implementation of "dump/writeProperties(ostream,...)" doesn't traverse all children: https://gitorious.org/fg/flightgear/blo ... xx#line307

The overloaded writeProperties() function in SimGear does not recursively call itself, unlike its older equivalent that dumps a property tree to an XML file, i.e. compare:
https://gitorious.org/fg/simgear/blobs/ ... xx#line586 vs. https://gitorious.org/fg/simgear/blobs/ ... xx#line604

(Note that there's a plan to replace the telnet commands hard-coded in C++ using a more flexible Nasal implementation instead)
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: 11609
Joined: Tue Mar 25, 2008 8:40 am

Re: Telnet 'dump' data missing?

Postby Philosopher » Fri Mar 22, 2013 1:26 pm

Hooray wrote in Fri Mar 22, 2013 11:03 am:it seems, that for whatever reason, the current implementation of "dump/writeProperties(ostream,...)" doesn't traverse all children: https://gitorious.org/fg/flightgear/blo ... xx#line307


No, the code snippet you posted is for when you have «dump position/», aka you need to dump not the current directory but rather another one...

Hooray wrote in Fri Mar 22, 2013 11:03 am:The overloaded writeProperties() function in SimGear does not recursively call itself, unlike its older equivalent that dumps a property tree to an XML file, i.e. compare:
https://gitorious.org/fg/simgear/blobs/ ... xx#line586 vs. https://gitorious.org/fg/simgear/blobs/ ... xx#line604


But dumpNode is recursive... And the second snippet just shows a conversion helper/overloaded function, like all of those property ones with std::string& and const char* arguments.

Here's my take on it:
I have not used telnet, but it looks like it is only writing archivable properties. The dump command uses this line ($FG_SRC/Network/props.cxx, #309):
Code: Select all
writeProperties ( stringstream buf, SGPropertyNode* child );

The odd thing is that writeProperties is defined in various forms in $SG_SRC/props/props_io.cxx but I do not see one with a stringstream and SGPropertyNode* as arguments, they all have a write_all flag and a archivable flag (the latter of which I do not understand), (there is also one that is a const char* the node), but I do not see where the above falls through to! I need to explore this a bit more, but the archivable thing has me worried about its usage. There's also a comment like "only dump this node [to a file] if we can save it -- if it has the archivable flag set", so I think that telnet needs to call writeProperties with the write_all argument set to true... Could someone test my archivable theory?

Apologies if I am wrong here, I only know 93% of C and 78% of C++ ;)

Hooray wrote in Fri Mar 22, 2013 11:03 am:(Note that there's a plan to replace the telnet commands hard-coded in C++ using a more flexible Nasal implementation instead)


I was actually wondering if it was in Nasal... before I found the C++ code :D I do like the idea, though, definitely worth a try!
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Telnet 'dump' data missing?

Postby Hooray » Fri Mar 22, 2013 6:43 pm

I don't think your C/C++ understanding should be a factor here: I only checked very briefly, so it's quite possible that your take is spot on and I might be wrong here. It's also possible that it is related to those infamous tied properties ... (easy to check using the property browser in debug mode).

This should probably be reported as a bug, especially given that the issue was first reported a decade ago according to Gijs, so that core developers may have a look. It does sound simple to fix though ...
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: 11609
Joined: Tue Mar 25, 2008 8:40 am

Re: Telnet 'dump' data missing?

Postby zogulus » Sun Mar 24, 2013 10:27 am

It's also interesting that the output of 'ls' changes depending on data/prompt mode.

e.g.

/> ls /instrumentation/airspeed-indicator
serviceable = 'true' (bool)
indicated-speed-kt = '2.136597022' (double)
true-speed-kt = '2.155335661' (double)
indicated-mach = '0.00323037714' (double)
/> data
ls /instrumentation/airspeed-indicator
serviceable
indicated-speed-kt
true-speed-kt
indicated-mach

Looks like I'll have to change my program to parse the 'prompt' output of 'ls'. It's a shame as I got the XML version working really quickly.

- Dale
zogulus
 
Posts: 3
Joined: Thu Mar 21, 2013 11:35 pm

Re: Telnet 'dump' data missing?

Postby zogulus » Sun Mar 24, 2013 10:34 am

Hooray wrote in Fri Mar 22, 2013 6:43 pm:This should probably be reported as a bug, especially given that the issue was first reported a decade ago according to Gijs, so that core developers may have a look. It does sound simple to fix though ...

One other thing occurs to me, if it's been broken for a long time maybe there is a better way to approach what I'm trying to do? I'm writing a simple Clojure wrapper to make it easier for people to experiment with controlling the simulator. So they need to be control the basics and a simple interface to 'read' the instrumentation. My github project is here: https://github.com/dalethatcher/flightgear and is going to be used at the London Clojure Dojo on Tuesday so I can't wait for a fix.

Any suggestions are welcome.

many thanks,

- Dale
zogulus
 
Posts: 3
Joined: Thu Mar 21, 2013 11:35 pm

Re: Telnet 'dump' data missing?

Postby Hooray » Sun Mar 24, 2013 11:04 am

for that you only need to expose the setprop/getprop equivalent and maybe provide a way to do polling/subscriptions.
The telnet/http protocols are certainly well-suited for that, in addition there's been talk on providing an AJAX/RESTful property interface: https://code.google.com/p/flightgear-bu ... ail?id=396

If you need to get this done quickly, and don't know C++ or don't know how to build FG from source, I would continue using the telnet/http interface and simply manually traverse the tree to get a complete dump. Alternatively, you can also explicitly query certain properties instead.
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: 11609
Joined: Tue Mar 25, 2008 8:40 am


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 1 guest