I'm working on a UAV project. We are building a custom ground station. We would like to eliminate the hand held transmitter from our system and replace it with a PC based transmitter, so that the UAV can be flown from the control console.
I'm thinking we could use various USB joysticks and flight controls as the human interface to OpenTX and use an external RF module (Crossfire, FrSky L9R or Jumper JP4in1) as the transmitter, communicating with it via a USB connected Arduino.
I understand that Linux is a very different OS than what OpenTx presently uses. Obviously a completely different hardware layer would need to be created. Obviously Linux is not a real time OS. There is no latency guarantee when running a desktop OS.
Thoughts ?
OpenTx Groundstation ? Was porting OpenTx to Linux.
OpenTx Groundstation ? Was porting OpenTx to Linux.
Last edited by linuxguy on Sat Jul 06, 2019 9:26 am, edited 1 time in total.
Re: Porting OpenTx to Linux ?
It's already there, the OpenTX simulator in companion can take a joystick input, and the outputs are shown in a window... you could just grab onto that.
The simulators are .so with an interface so if you wanted to simplify all you'd need is make your own wrapper for them that provides the inputs and sends the outputs wherever you want them.
The multiprotocol module communicates via serial so you could route the output stream straight to a COM port, and same for telemetry. I had actually started doing that long ago but never finished. This needs a little work since the simu currently doesn't have the module output in the interface.
Crossfire is serial too. The XJT however uses a bastard signal that can't really be done without a hardware timer so for that you'd need an extra step for example with an arduino that takes serial and generates the signal.
The simulators are .so with an interface so if you wanted to simplify all you'd need is make your own wrapper for them that provides the inputs and sends the outputs wherever you want them.
The multiprotocol module communicates via serial so you could route the output stream straight to a COM port, and same for telemetry. I had actually started doing that long ago but never finished. This needs a little work since the simu currently doesn't have the module output in the interface.
Crossfire is serial too. The XJT however uses a bastard signal that can't really be done without a hardware timer so for that you'd need an extra step for example with an arduino that takes serial and generates the signal.
Re: Porting OpenTx to Linux ?
Thanks for the reply, Kilrah.
I found the simulator independently this evening and went through the source. It seems to be a great starting point for what I want to do. I haven't used Companion in a while. I knew there was a simulator in it and forgot about it. Now the simulator is a stand alone app ! Good work to the devs for this !
Would you like to share code from your multiprotocol start ?
"Since the simu doesn't have the module output in the interface ?" I'll look into this. I'm probably going to need to add a few extra things back into the project. I'll want the stand alone sim to save all the settings for everything, just like a stand alone transmitter. Reading through OpenTx 2.2 doc, I'm not sure it does that for everything. Not sure it should be called a sim anymore either... maybe I should fork it to a new app and leave the sim app alone ? Maybe call it OpenTX Desktop ? Or OpenTx Groundstation ?
What do you think the latency would be on a lightly loaded PC running Linux ? Joystick to PC via USB. Then the simu app process time. Then USB to Arduino. Then Arduino to multiprotocol module. It won't be quick. Hopefully not too slow. Gaming joysticks should be pretty low latency. I don't need to fly patterns or anything... just take offs and landings, basically.
I'll look in the openTX source for how to drive the multiprotocol module properly for XJT. Thanks for the heads up.
I found the simulator independently this evening and went through the source. It seems to be a great starting point for what I want to do. I haven't used Companion in a while. I knew there was a simulator in it and forgot about it. Now the simulator is a stand alone app ! Good work to the devs for this !
Would you like to share code from your multiprotocol start ?
"Since the simu doesn't have the module output in the interface ?" I'll look into this. I'm probably going to need to add a few extra things back into the project. I'll want the stand alone sim to save all the settings for everything, just like a stand alone transmitter. Reading through OpenTx 2.2 doc, I'm not sure it does that for everything. Not sure it should be called a sim anymore either... maybe I should fork it to a new app and leave the sim app alone ? Maybe call it OpenTX Desktop ? Or OpenTx Groundstation ?
What do you think the latency would be on a lightly loaded PC running Linux ? Joystick to PC via USB. Then the simu app process time. Then USB to Arduino. Then Arduino to multiprotocol module. It won't be quick. Hopefully not too slow. Gaming joysticks should be pretty low latency. I don't need to fly patterns or anything... just take offs and landings, basically.
I'll look in the openTX source for how to drive the multiprotocol module properly for XJT. Thanks for the heads up.
Re: Porting OpenTx to Linux ?
I don't think I have it anymore, the whole reason I never finished it was that I happened to start it just before someone made a major refactoring of the simu so it basically had to be started over.
It does already. Basically you pass the simu a file that is treated like the radio's memory, and a folder that is handled as the SD card. The eeprom file can be edited using companion just like if it was a radio, so you can even run the simu "headless", if you want to make changes you fire up companion, open the file, edit the settings you want, save, then reopen the simu.
Yeah I think a separate app (that could reuse code from companion e.g. for joystick and the standalone simulator app e.g. for file/SD folder selection) with the added I/O settings and handling would make sense. Could be part of the project along the other 2.
Probably not a lot. As previously mentioned the arduino would only be needed for an FrSky XJT module, not for multiprotocol or crossfire.
- MikeB
- 9x Developer
- Posts: 17990
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenTx Groundstation ? Was porting OpenTx to Linux.
As an alternative you could look at erskyTx and eepskye. This already supports sending the control channels out from the simulator over a serial port (SBUS format). erskyTx supports receiving this serial data as a trainer input. To get started you should be able just connect this up with a Tx and get transmitting from the simulator very quickly.
Mike
Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: OpenTx Groundstation ? Was porting OpenTx to Linux.
Mike, still receiving Joystick inputs on Eepskye would be great..MikeB wrote: ↑Sat Jul 06, 2019 10:31 am As an alternative you could look at erskyTx and eepskye. This already supports sending the control channels out from the simulator over a serial port (SBUS format). erskyTx supports receiving this serial data as a trainer input. To get started you should be able just connect this up with a Tx and get transmitting from the simulator very quickly.
Mike
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW