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 2: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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: FGFS Interface

Postby daweed » Sat Jan 05, 2019 11: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.
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: FGFS Interface

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

daweed wrote in Fri Jan 04, 2019 10: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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: FGFS Interface

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

wkitty42 wrote in Sat Jan 05, 2019 2:24 pm:
daweed wrote in Fri Jan 04, 2019 10: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.
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: FGFS Interface

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

daweed wrote in Sat Jan 05, 2019 5: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 5: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 7: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: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: FGFS Interface

Postby Hooray » Sun Jan 06, 2019 9: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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: FGFS Interface

Postby daweed » Sun Feb 24, 2019 10: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
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: FGFS Interface

Postby ame » Fri Dec 06, 2019 10: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 10:00 pm

Re: FGFS Interface

Postby daweed » Mon Dec 09, 2019 1: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 1:51 pm, edited 1 time in total.
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: FGFS Interface

Postby daweed » Mon Dec 09, 2019 1: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
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: FGFS Interface

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

Awesome :D

Do you want bindings for the transponder also?
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: FGFS Interface

Postby xcvb » Mon Dec 09, 2019 7: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: 132
Joined: Sat Mar 14, 2015 3:08 pm
Version: Next
OS: Fedora Kinoite

Re: FGFS Interface

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

legoboyvdlp wrote in Mon Dec 09, 2019 5: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
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: FGFS Interface

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

xcvb wrote in Mon Dec 09, 2019 7: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.
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: FGFS Interface

Postby daweed » Fri Feb 14, 2020 1:25 pm

Work in progress : FCU & EFIS

Image

Image
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

PreviousNext

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 3 guests