Board index FlightGear Support Interfacing

Input generic protocol - doesn't work don't know why

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

Input generic protocol - doesn't work don't know why

Postby JabX » Thu Oct 10, 2013 11:08 am

Hi,
I have done it successfully before (but I don't have all the differents code snippets of that anymore), but I just can't make it work now.
My protocol is :
Code: Select all
<?xml version="1.0"?>
<PropertyList>
<generic>
   <input>
      <line_separator>tab</line_separator>
      <var_separator>,</var_separator>
      
      <chunk>
         <name>id</name>
         <node>/controls/in/id</node>
         <type>string</type>
      </chunk>
      
      <chunk>
         <name>value</name>
         <node>/controls/in/value</node>
         <type>string</type>
      </chunk>
   </input>
</generic>
</PropertyList>

I add this line when starting FG :
Code: Select all
--generic=socket,in,60,127.0.0.1,5400,udp,myprotocol

and in my program i send that message multiple times (it's Python) :
Code: Select all
socket.sendto("a,b", ('127.0.0.1',5400))


But FlightGear is ignoring the messages. I have checked everything : the messages are effectively sent and received (used a network sniffer), the custom properties are set in the Property Tree, meaning that the protocol has been loaded. But they stay forever empty.

I have done exactly that before (with other properties) and it worked like a charm without any problems. It's getting me mad.
I have tried to change the name of the properties and the port to no avail.

Thank you for your time (and my newfound sanity if you can solve this :) )
JabX
 
Posts: 17
Joined: Mon Jul 15, 2013 2:38 pm

Re: Input generic protocol - doesn't work don't know why

Postby pilot » Thu Oct 17, 2013 1:06 pm

I don't understand what you mean by Input generic protocol.
If nothing is moving your life is paused
User avatar
pilot
 
Posts: 78
Joined: Sun Apr 07, 2013 1:44 pm
Location: somewhere
OS: one on computer

Re: Input generic protocol - doesn't work don't know why

Postby JabX » Thu Oct 17, 2013 1:40 pm

Well, I am using a generic protocol interface to feed FG with some data, using a socket.
So I am using the "input" side of a generic protocol.
JabX
 
Posts: 17
Joined: Mon Jul 15, 2013 2:38 pm

Re: Input generic protocol - doesn't work don't know why

Postby AndersG » Thu Oct 17, 2013 4:41 pm

You are sending \t tabs to separate the records, right?

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2525
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Input generic protocol - doesn't work don't know why

Postby JabX » Mon Oct 21, 2013 3:06 pm

I wasn't, but I know for sure that I didn't do it back when I got it to work.
Anyway, I tried with \t at the end of my messages and it doesn't change a thing.
JabX
 
Posts: 17
Joined: Mon Jul 15, 2013 2:38 pm

Re: Input generic protocol - doesn't work don't know why

Postby JabX » Wed Oct 30, 2013 2:40 pm

Still haven't figured this out, but I found something in Readme.IO about native protocol (not generic) that states that I should leave empty the "machine" parameter of the instruction to set up the socket, to have something like : --generic=socket,in,60,,5400,udp,myprotocol
This is the only example that I have found which deals with the "in" direction, everything else (Readme.Protocol and the wiki page) only deal with the "out" direction with a brief mention of "in".

Anyway, I came to realize that my communication wasn't running at 60Hz at all : my external program sends commands to FlightGear each time the user makes an input. Well, 60Hz could be an upper limit (the user can make inputs at 60Hz when using a slider that controls directly a FG property), but most of the time it is sending nothing. I guess this is the only functionnal difference there is between my old (and forgotten) code that worked and the one I am trying to make work now.

---- EDIT : I just tried sending packets at 60Hz with my current program and it still doesn't work ----

Another remark/question : if i'm not specifying any adress while setting up my socket communication, it means that FG listens to every machine that could send him packets. But what address shall I then specify when i'm sending a packet to FG ?

The documentation is surprisingly scarce on that whole subject.
JabX
 
Posts: 17
Joined: Mon Jul 15, 2013 2:38 pm

Re: Input generic protocol - doesn't work don't know why

Postby AndersG » Wed Oct 30, 2013 7:55 pm

JabX wrote in Wed Oct 30, 2013 2:40 pm:Another remark/question : if i'm not specifying any adress while setting up my socket communication, it means that FG listens to every machine that could send him packets. But what address shall I then specify when i'm sending a packet to FG ?

The documentation is surprisingly scarce on that whole subject.


Not specifying an address means FG is listening on all network interfaces (ethernet card, loopback, wlan, etc) the box has. Specifying an address limits FG to the particular network interface that has that address, e.g. 127.0.0.1 for loopback.

When sending packets to FG you need to specify the address of the box FG runs on (or 127.0.0.1 if the sender runs on the same box). It is all fairly standard TCP/IP network stuff.

/Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2525
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Input generic protocol - doesn't work don't know why

Postby JabX » Thu Oct 31, 2013 10:07 am

Okay, thanks for the clarification.
But still, it doesn't explain why this is not working. Do someone have a working example of this, with any kind of external program ? I didn't find any in my researches.
JabX
 
Posts: 17
Joined: Mon Jul 15, 2013 2:38 pm

Re: Input generic protocol - doesn't work don't know why

Postby JabX » Tue Nov 12, 2013 10:12 am

I have changed "tab" by "newline" and put the corresponding marker at the end of my message and now it works....
Anyway, thank you all for your help.
JabX
 
Posts: 17
Joined: Mon Jul 15, 2013 2:38 pm

Re: Input generic protocol - doesn't work don't know why

Postby marsag » Thu Jan 09, 2020 2:05 am

hey I have the same issue

can you please post your working protocol?
marsag
 
Posts: 8
Joined: Tue Dec 17, 2019 5:11 am

Re: Input generic protocol - doesn't work don't know why

Postby Johan G » Tue Jul 27, 2021 3:57 pm

Some posts were split off to the new topic Controlling FlightGear from Python.
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: 6629
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


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 2 guests