Board index FlightGear Support Interfacing

Speed problems with Python Script/Telnet

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

Speed problems with Python Script/Telnet

Postby Kikokou-san » Thu Apr 19, 2018 12:51 pm

Hi all,

As I probably already said on the devel mailing list some time ago, I am using a physical interface using several arduino boards, connected to FG via a middle Python script.

I am launching FG with --props=socket,bi,100,localhost,5100,tcp --httpd=8080 --allow-nasal-from-sockets (note the 100Hz speed)

The Python script is managing Serial connections to each arduino, and is managing the telnet connection with the running instance of FG.

I read on the wiki that the telnet protocol should not be used for changing several times per seconds the value of a property.. Which was something I thought I wouln't have to do because I press a button once at a time....

But actually I did not think of encoders and potentiometers.. They have to send data several times per second, and this generates high latency problems..

When the encoder is turned of one step up, the python script reads the linked property over telnet (100 to 500 ms !), then increase this property of 1 for instance, and then writes back the updated property (again, 100 to 500 ms !).

Problem is that when you turn the encoder quite fast (just normally actually!), several up or down "steps" are sent, each of them needing from 200 ms to 1 second to be processed !!

Result is a very high latency, and the buffer to be filled in much faster than it is filled out, so properties continue to change 10 or 20 seconds after you last touched a button..

So I come here to request some help ? Any idea ?

I read about using udp instead of telnet, but I am not sure that the problem comes from the protocol..

I also saw a C/C++ example in script (fgfsclient), would this be faster ? Anybody tried that before ?

Thank you very much for pointing me in a direction if you have any idea..
Posts: 26
Joined: Wed Mar 15, 2017 9:55 am

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 1 guest