Board index FlightGear Support Interfacing

FGFS Interface

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

Re: FGFS Interface

Postby Hooray » Sat Jan 05, 2019 1:09 am

This may not be relevant at this point, so I would ignore this for now - but if you are already familiar with the property tree and generic protocols (xml), it should be easy to learn more about some of the other I/O options - even if just to see that there are more efficient ways to do I/O - for staters, you could also look at Torsten's mongoose/Phi code, which uses web sockets.

But again, that's best discussed on the devel list.

Assuming that you are currently using the generic protocol (?) you may still want to read more about other I/O options to learn what's possible, should performance ever become an issue

http://wiki.flightgear.org/Generic_protocol
http://wiki.flightgear.org/Telnet_usage
http://wiki.flightgear.org/Property_Tree/Web_Server
http://wiki.flightgear.org/Property_Tree/Sockets

But even if you are never going to touch any C++ code, you may still want to introduce your project via the newsletter/devel list - maybe someone shows up with a more efficient interfacing mechanism, there are meanwhile a number of home cockpit builders using FlightGear after all.
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: 11427
Joined: Tue Mar 25, 2008 8:40 am

Re: FGFS Interface

Postby daweed » Sat Jan 05, 2019 10:45 am

FGFS Interface is using Generic Protocol and talk to FG throught network socket [ Client / Server system ], and i can't say that the props tree does not have any secret for me, but this where i read and store my informations.
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

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

Re: FGFS Interface

Postby wkitty42 » Sat Jan 05, 2019 1:24 pm

daweed wrote in Fri Jan 04, 2019 9:35 pm:The interface is completely autonomous, based on a Raspberry and talk with the simulator through the network.

that is exactly what he is talking about... right now you're using telnet or http or something to talk to the sim, right? hooray is talking about taking one of those protocols and extending it (maybe with a new name?) to make it easier to handle all your switches on your device(s) so they can be better connected into the sim over the network... in other words, making your code connection easier to manage with all those switch properties...
"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: 5883
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: FGFS Interface

Postby daweed » Sat Jan 05, 2019 4:55 pm

wkitty42 wrote in Sat Jan 05, 2019 1:24 pm:
daweed wrote in Fri Jan 04, 2019 9:35 pm:The interface is completely autonomous, based on a Raspberry and talk with the simulator through the network.

that is exactly what he is talking about... right now you're using telnet or http or something to talk to the sim, right? hooray is talking about taking one of those protocols and extending it (maybe with a new name?) to make it easier to handle all your switches on your device(s) so they can be better connected into the sim over the network... in other words, making your code connection easier to manage with all those switch properties...



Hello,

i probably don't use the good word, or are not able to correctly translate the things, but, no , i don't use any http or telnet connection.

I am using, Python stream socket on both side.

1°) i start a server on FGFS interface (RPI Side) which is waiting for Flightgear to connect [ here FG acting as client ] . This is the part that send data from FG (output generic protocol)

Python Code is as like

Code: Select all
Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Bind the socket to the port
server_address = (FGINTADDR, FGINTPORT)
print('starting up on {} port {}'.format(*server_address))
sock.bind(server_address)

# Listen for incoming connections
sock.listen(1)


2°) i Start a TCP client too on RPI that will be used to send data to Flightgear , again data structure are definie wiuth an XML file and using generic protocol, data are sent to FG ONLY if a data if something have been modify

Code: Select all
sockclient = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockclient.connect((FGADDR, FGPORT))

....

all the process to manage data coming from the hardware, then a data "line" is created , regarding the data structure describe in the generic protocol xml file, for example , for the radio panel :

Code: Select all
########################################
# DATA MANAGEMENT
########################################

datastr = str(data_tree['cptpowersw'])
datastr = datastr + ':' + str(data_tree['sel_chan'])
datastr = datastr + ':' + str(data_tree['transfer_sw'])
datastr = datastr + ':' + str(data_tree['vhf1_stby'])
datastr = datastr + ':' + str(data_tree['vhf2_stby'])
datastr = datastr + ':' + str(data_tree['vhf3_stby'])

########################################
# DATA SENDING PROCESS
########################################
cypher = hashlib.md5(datastr.encode('utf-8')).digest()

if cypher != oldcypher:
    print("DATA : {} | PROPS : {}".format(datastr, props_tree))
    sockclient.send(bytes(datastr, 'utf-8'))
    sockclient.send(bytes("\n", 'utf8'))
    oldcypher = cypher


And FGFS is started with something like --generic=file,out,1,/tmp/data.xml,myproto , one for input, one for output [i don't have exact parameter near me, but could post later if needed ]

Maybe you are associating "telent connexion" to socket connection as what i am doing .... in this case, you are right.

As i said i don't have the require skill to create a new protocol binary, even extend an existing one , seems, for me. to be "a mountain" and fact is i don"t know from where to begin, i alredy read documentation on input / output, but don't find clear examples i could exploit.
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

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

Re: FGFS Interface

Postby wkitty42 » Sat Jan 05, 2019 10:03 pm

daweed wrote in Sat Jan 05, 2019 4:55 pm:i probably don't use the good word, or are not able to correctly translate the things,

you're doing fine :)

daweed wrote in Sat Jan 05, 2019 4:55 pm:but, no , i don't use any http or telnet connection.

I am using, Python stream socket on both side.

about the same thing but ok... so you've already developed your protocol, then... that's what hooray was talking about doing with the extension so that your development of the protocol was easier as most of the work would already have been done... but you are using python and you're already further ahead in development than was thought :)
Last edited by wkitty42 on Mon Jan 07, 2019 6:15 pm, edited 1 time in total.
"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: 5883
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: FGFS Interface

Postby Hooray » Sun Jan 06, 2019 8:12 pm

yeah, absolutely correct.

Using the telnet (props) protocol from Python is fine for prototyping purposes.
However, if/when your project should outgrow the telnet/props I/O mechanism, you may want to consider using the web socket mechanism (based on Torsten's Phi/mongoose integration).

And if you should ever end up deciding that the websocket approach isn't sufficient, a dedicated (or customized) I/O protocol would seem like a good idea, especially if it's based on something ARINC related.
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: 11427
Joined: Tue Mar 25, 2008 8:40 am

Re: FGFS Interface

Postby daweed » Sun Feb 24, 2019 9:02 pm

Somes new,

FCU Airbus , FG Interface powered

Image

Image

Image

Rotary encoder and Push / Pull are on the way, but it need to print some pieces

Image
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

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

Re: FGFS Interface

Postby ame » Fri Dec 06, 2019 9:22 pm

Hi there,

Are you still working on this?

I have built a generic LED/switch interface using HT16K33 and Python. I can address up to 112 of the available LEDs and 36 switch inputs.

I have designed a 'hub' board with RJ45 connectors, and smaller boards that will each connect up to 7 LEDs or 6 switches. I intend for this to be used to make connections to switches and indicators in a sim cockpit.

I have also designed a Collins CTL-xx control unit which uses a single HT16K33 to drive the 7-segment displays and read the input switches.

The Python code is currently very simple, mostly for testing. I intend to get it going with X-Plane, but it could be configured to talk to anything.

I also plan to support MCP23017 i2c gpio, ADS1015/1115 i2c ADC, and PCA9685 i2c PWM driver for other cockpit controls and instruments.
ame
 
Posts: 1
Joined: Fri Dec 06, 2019 9:00 pm

Re: FGFS Interface

Postby daweed » Mon Dec 09, 2019 12:32 pm

Hello,

Yes, this project is still active. Currently in V1 release production

I/O Card (main board where Raspberry PI is connected)
64 I/O Available
Image

Display Card (daughter board connected on main board)
32 7 segments digit or 256 led or a mix of led and 7 segment digit manageable
Image

PI and Boards connected
Image

Output connector are IDC style, you have 5V and GND + 16 i/O on each connector for I/O card, and for display card each connector own 8 output + 8 common, so there is 64 output available on each display card connector.

Software repo have been setup https://github.com/daweed38/FGInt and documentation is actually in progress

An another card I/O can be connected directly using daugther connector, leading to up to 128 I/O with one RPI. Same things regarding display cards, and actually working on dedicated PCB interface for servo motor.

Schemas and PCB draws should be updated soon in FG Wiki

For now, i am spending time to create GUI interface that will allow making configuration "friendly"

Image

Regards
Last edited by daweed on Mon Dec 09, 2019 12:51 pm, edited 1 time in total.
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

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

Re: FGFS Interface

Postby daweed » Mon Dec 09, 2019 12:41 pm

Some realisation you can connect to interface [ direct ribon cable connection ]

EFIS Panel
Image

Transponder Panel [ WIP ]
Image

FCU [ The FCU have it's own interface (ie his own raspberry ]
Image

Image
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

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

Re: FGFS Interface

Postby legoboyvdlp » Mon Dec 09, 2019 4:44 pm

Awesome :D

Do you want bindings for the transponder also?
User avatar
legoboyvdlp
 
Posts: 7262
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: next
OS: Windows 10 HP

Re: FGFS Interface

Postby xcvb » Mon Dec 09, 2019 6:33 pm

Some time ago I created something similar to connect my analog instruments via RS485/Modbus (I replaced the original electronics with my own AVR-based PCBs):

Image
xcvb
 
Posts: 107
Joined: Sat Mar 14, 2015 2:08 pm
Version: GIT
OS: Linux

Re: FGFS Interface

Postby daweed » Mon Dec 09, 2019 9:47 pm

legoboyvdlp wrote in Mon Dec 09, 2019 4:44 pm:Awesome :D

Do you want bindings for the transponder also?


Hello Legoboy,

If this does not disturb your development too much, yes it would be nice to have the same facilities that have been put in place for the FCU :)
It's very nice, thank you Legoboy

I am encountering some problem with the keypad matrix management, but soon should be working, and i want before focus and finish the configuration GUI

Regards

Daweed
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

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

Re: FGFS Interface

Postby daweed » Mon Dec 09, 2019 9:56 pm

xcvb wrote in Mon Dec 09, 2019 6:33 pm:Some time ago I created something similar to connect my analog instruments via RS485/Modbus (I replaced the original electronics with my own AVR-based PCBs):

Image


Hello,

My interface is to control by a raspberry, and comunique with the simulator by the network. It is the same for the graphical configuration interface, it communicates with the hardware interface via the local network.
Linux Mint 18.3
AMD FX 4300 Quad-Core Black Edition|20 Go RAMGeForce GTX 750 Ti
FG Interface
Lyon Saint Exupery Scenery

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

Previous

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 0 guests