Board index FlightGear Support Interfacing

Sending data on cange

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

Sending data on cange

Postby www2 » Thu Aug 31, 2017 2:40 pm

Hi is there a possibility that a custom protocall can send data only on change of a value than on each 1/n second.
Some thing like this:
Code: Select all
<open connection>
T0 X=0 Y=0 # data send
T1 X=0 Y=0 # no data send
T2 X=0 Y=0 # no data send
T3 X=1 Y=0 # data send
T4 X=1 Y=0 # no data send
T5 X=1 Y=0 # no data send
T6 X=1 Y=0 # no data send
T7 X=1 Y=1 # data send
T8 X=1 Y=1 # no data send
T9 X=0 Y=1 # data send
<closed connection>
www2
 
Posts: 319
Joined: Thu Apr 16, 2009 2:58 pm
OS: Ubuntu

Re: Sending data on cange

Postby wkitty42 » Thu Aug 31, 2017 8:01 pm

which way are you talking about sending data? into FG or out of it?

i would guess that an external client should be able to determine when it sends data to FG...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9162
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: Sending data on cange

Postby Hooray » Thu Aug 31, 2017 8:13 pm

As far as I know, "out of the box" this is only supported by the built-in props/telnet interface, which supports the notion of "subscriptions" using listeners, which basically means that you receive notifications when a property changes that you are subscribed to.
Other than that, it'd would not exactly be difficult to implement elsewhere using pretty much the same approach.

Background at: http://wiki.flightgear.org/Telnet_usage ... nsubscribe

Technical details at:
http://wiki.flightgear.org/Improved_J661_support
http://wiki.flightgear.org/Howto:Create ... _Listeners
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: Sending data on cange

Postby www2 » Thu Aug 31, 2017 11:48 pm

@wkitty42 i look intro sending data from Flightgear to server

@Hooray that is the basic idea

For the idea i have create an protocol descriptor file that send the data if the propetries: /foobar/foo or /foobar/bar are change with a cool down period of 200 ms.

Code: Select all
<?xml version="1.0"?>
<PropertyList>
 <generic>
 
    <output>
      <line_separator>newline</line_separator>
      <var_separator>newline</var_separator>
      <binary_mode>false</binary_mode>
      <timeout>0.2</timeout> <!-- disable sending data if the last message was send in x second -->
 
      <chunk>
        <name>foo</name>
        <format>foo=%d</format>
        <node>/foobar/bar</node>
        <lisen>True</lisen> <!-- enable lisener for this object -->
      </chunk>
      <chunk>
        <name>bar</name>
        <format>bar=%d</format>
        <node>/foobar/bar</node>
        <lisen>True</lisen> <!-- enable lisener for this object -->
      </chunk>
      <chunk>
        <name>Second</name>
        <format>t=%d</format>
        <node>/sim/time/utc/second</node>
        <lisen>False</lisen> <!-- disable lisener for this object -->
      </chunk>
    </output>
 </generic>
</PropertyList>
www2
 
Posts: 319
Joined: Thu Apr 16, 2009 2:58 pm
OS: Ubuntu

Re: Sending data on cange

Postby Hooray » Fri Sep 01, 2017 10:12 pm

this is not directly supported as far as I can tell, so this is usually done using some kind of middleware.
Alternatively, someone familiar with the generic protocol and Nasal scripting could probably implement such a mechanism on top of generic properties, with all the update semantics implemented in scripting space.

This kind of workaround is described here: http://wiki.flightgear.org/Howto:Port_I/O_from_Nasal
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: Sending data on cange

Postby daweed » Mon Sep 04, 2017 3:04 pm

Hello,

What i have done for FG interface is sending the data sequence (Generic Protocol using) ONLY if one property change.
I build the "data" line with each properties to send (i am using ':' to split properties)

propa:propb:propc .... etc

then compute MD5 from the "data" line, compare with the old MD5 result.
If new MD5 value is different from old one then :
=> Send data
=> Store new MD5 result to compare with on next loop

Regards
Windows 10 / Linux Mint 20
AMD Ryzen 7 3700X |32 Go RAM GeForce RTX 3070 Ti 8 Go
FG Interface
Lyon Saint Exupery Scenery

ATC on LFLL on Friday 19:00 UTC => 22:00 UTC
daweed
 
Posts: 398
Joined: Thu Dec 11, 2014 11:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Linux Mint 20

Re: Sending data on cange

Postby Hooray » Tue Sep 05, 2017 5:56 pm

Actually, it would be relatively easy to overheal the generic protocol system so that it supports SGConditions and bindings - in conjunction with headers and footers that can contain variables. Once you can express a simple state machine using the XML markup, you could also implement simple PUB/SUB mechanisms - or even call the md5sum() API or other fgcommands
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 2 guests