Board index FlightGear Support Interfacing

Problem decoding data from native-ctrls

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

Problem decoding data from native-ctrls

Postby Pool » Mon Sep 07, 2020 12:06 pm

Hi everyone,

I'm developing a motion controller app based on Android but don't understand in which encoding the native socket is sending data.
I started fgfs with this flag "--native-ctrls=socket,out,5,192.168.105.20,5500,udp" in order to make it send data to my client.
Data is sent and correctly captured by my socket server but I don't understand how to decode it.

What is currently sanded are strings like this:
https://pastebin.pl/view/aaa4f946

Can anyone help me figure out what is happening?
Thankyou!
Pool
 
Posts: 2
Joined: Mon Sep 07, 2020 11:55 am

Re: Problem decoding data from native-ctrls

Postby Johan G » Mon Sep 07, 2020 12:53 pm

I think you more likely will succeed if you instead use the generic protocol, which can be customized to only transfer the properties you need. I think these FlightGear wiki articles might be of help:


The native protocol, if I understand it correctly, is rather used for example for visualizations, hardware in the loop simulations, when using an external flight dynamics model and things like that.

Pool wrote in Mon Sep 07, 2020 12:06 pm:[...] a motion controller app based on Android [...]

Would that be an input device, in essence a virtual joystick, or an app to control a motion base with a chair and displays/headset?
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Problem decoding data from native-ctrls

Postby Pool » Mon Sep 07, 2020 4:42 pm

Thank you Johan G. for your quick answer.

The application aims to let the user control the aircraft exploiting the gyroscope of Android devices.
By now it works by communicating with the fgfs httpd capability, so every time the user move his phone an http request is made to this server in order to correctly update a given property (e.g elevetor, airelon).
In addiction there are some other controls such as seekbars to change the throttle for a given engine and so on.

I know that by this a lot of http requests are made by my application and digging into FG documentation I went through this sockets that could lead me to e establish a lighter double way communication.
By now the application only target to control the aircraft (providing a modern, minimal but complete UI) but in a near future it may be nice to display also a the fgfs actual camera.

I will go through the documentation sections you posted.

By this I have another question:
Is it possible to open a socket for communicating by generic protocol even after a fgfs session has started up? (Let's say by telnet or some Nasal trick)

I thank you again for the support and for the awesome work on FlightGear, if you're interested in this project it would be open-sourced soon. (and maybe an opinion about the project from you will be very useful)
Pool
 
Posts: 2
Joined: Mon Sep 07, 2020 11:55 am

Re: Problem decoding data from native-ctrls

Postby Johan G » Tue Sep 08, 2020 8:34 am

Pool wrote in Mon Sep 07, 2020 4:42 pm:Thank you Johan G. for your quick answer.

You are welcome :)

Pool wrote in Mon Sep 07, 2020 4:42 pm:By now [the app] works by communicating with the fgfs httpd capability, so every time the user move his phone an http request is made to this server in order to correctly update a given property (e.g elevetor, airelon).

I somehow had forgotten that the HTTP stuff was bidirectional (and had a wiki frenzy looking it up and improving a few articles, though mostly just style).

Pool wrote in Mon Sep 07, 2020 4:42 pm:[...] in a near future it may be nice to display also a the fgfs actual camera.

I think it is possible, but would be quite laggy.

Pool wrote in Mon Sep 07, 2020 4:42 pm:Is it possible to open a socket for communicating by generic protocol even after a fgfs session has started up? (Let's say by telnet or some Nasal trick)

I am not sure it can be done, but would not say it is impossible.

Pool wrote in Mon Sep 07, 2020 4:42 pm:[...] and maybe an opinion about the project from you will be very useful

Unfortunately I have not run FlightGear for several years, so I probably can not help you there. I am still around here because I have found seeing what people can come up with and do in FlightGear it a bit... addictive. :mrgreen:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Problem decoding data from native-ctrls

Postby SE-HK » Sun Sep 13, 2020 2:55 pm

Hi Pool,

it is possible to start/stop from the Nasal console. To start, type:
Code: Select all
fgcommand("add-io-channel", {"config": "generic,socket,out,5,192.168.105.20,5500,udp,my_protocol", "name": "test"});

To stop:
Code: Select all
fgcommand("remove-io-channel", {"name": "test"});
SE-HK
 
Posts: 54
Joined: Wed Sep 02, 2009 2:16 pm
Location: Stockholm, Sweden
Version: git
OS: Ubuntu 20.04


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 1 guest