Hi all,
I just bought an FrSky Taranis for my quad copter and needed to get the Mavlink data up on the Taranis LCD telemetry display. So here is my solution using a Teensy3.1 as a converter between MavLink and the S.Port on FrSky X8R.
See attached file below...
Replies
Markus, I never test with logfiles, but instead in companion by entering values in the telemetry simulator screen.
Now, if you don't have your model yet configured, then you won't have done a telemetry sensor discovery, and from there configured all of the calculated sensors on your model. This needs to happen first. By doing this, you can then hookup your taranis in bootloader mode to your PC/Mac and download your models from Taranis->Companion. Doing this you then have all the sensors properly configured inside Companion. Creating them manually in Companion doesn't fully work - there are certain sensor types which just don't take well to manual configuration, such as GPS.
Once you have your model in companion properly configured, launch Taranis simulator, and you can then use the telemetry simulator page to plug in values, which will be acted on by the LUA script/screen.
From the off, in the telem simulator screen, make sure you check the box "Simulate" top-left, then you can enter VFAS, Curr, Alt, Hdg, GPS lat/long, Cels and cell voltages, GSpd and ASpd (the script is expects kts, but the sim accepts only kph, so this doesn't display corrently in the sim, but entering 10 will display 19, so good enough for a test). You will see mAh and Wh clocking up, and if you have a Wh capacity entered on the config page, then you will see the battery simulator dropping to show remaining capacity. For GPS, enter something like 54.000,-4.000 (creating a text telemetry page with GPS will show 54deg00,00N 4Deg00,00W). Back to the LUA screen, and next we can test Flight modes by changing the value of the Fuel sensor - entering 1 should call "Acro Active" if you have your SD card setup correctly, enter 2, you should hear "Altitude Hold Active". To test RSSI, first we need to enter any value in A4 - say 10, then whatever you type in RSSI should appear on the screen (the A4 thing is required as if we have rx-rssi enabled in the teensy, then this always sets A4 to 0 in which case the RSSI value is read from A3 instead of the regular RSSI sensor - more about this in the wiki, and only of interest if you use RSSI over mavlink - so not used if you have regular X series FrSky Rx). Next we can test arming. To simulate arming, set Tmp2 to 1 (basically any odd number will be considered armed, any even number disarmed). Once armed, if you change the GPS coordinates, then you should see the radar position and distance from home change. If you change the heading then you should see the radar arrow head yaw to correspond. You should see the flight timer start counting up also. Disarm and this stops, and the radar resets. Vspd will show on the screen in m/s ++ for climb and -- for descent. Minute counter should call out whilst armed,and if Wh capacity set, once the capacity is exceeded (in Wh) then the alarm should sound out. To test satellite fix fields enter 1, 2, 3 in Tmp1 and you should see NO, 2D, 3D displayed. Enter 63, you should see 3D 6S.
Simulator has some quirks - for example, it doesn't like you entering a zero value. HDOP won't display correctly in the 2.2 simulator (not sure why - works on Taranis OK).
Robert, Yes you need to connect it to a serial port such as Telem2, and have this port configured for Mavlink at 57600baud. All explained in the wiki here: https://github.com/athertop/MavLink_FrSkySPort/wiki/1.-Setup
Bob, Sorry I don't know about other LUA scripts that work with the teensy data specifically - the lua script in the project was written alongside the teensy code so they work together. You are correct, the teensy in some configs does provide extra data not used on the LUA screen like roll/pitch angles. I'm guessing it may have originally been intended to display an artificial horizon. The beauty of lua though is that you can write your own scripts so why not have a go - that's how I got involved with this project. I wanted to make the screen cleaner and have additional functions and no one was that interested in spending more time developing this so I got involved and did it myself - the beauty of open source code :-)
Hope this helps. Cheers, Paul
Markus Manninger said:
I am looking to connect to an older pixhawk. Do I need to connect the teensy to the Telem 2 port on pixhawk or can the data be picked up from something like the sbus port on the pixhawk>?
Hi All, sorry if this is redundant, but I can't figure out how to search this thread... Are there any other LUA scripts available that are compatible with this project? I see that the taranis is receiving Roll/Pitch as well as ACC values and a few other items that arne't represented in the "MAIN" lua script. I'd love to see another screen with these values exposed... Thanks for any pointers.
Hi Paul,
Do you have logfiles with included telemetry data, I can use to work on the lua script within the companion software?
Right now my drone isn't ready to fly, so I can't record them by myself.
Thanks,
Markus
Markus, I'll comment inline below:
Markus Manninger said:
They get manipulated by the Taranis lua script - there are only a small handful of sensors on your sensor screen which can be understood directly. Sorry, I maybe didn't explain this clearly before.
The compiler on the radio is purely to reduce the memory footprint of the code at runtime - on the Taranis (sorry don't know about the Horus) memory allocated to running lua is very limited so the compiled version often works fine where running text based lua will fail due to memory limitations - I had to also implement a load of other memory work-arounds to get my code to just run - even the compiled version (basically loading in and out of code as its required to keep memory use down). You develop the code on your PC and can test it in the simulator in the companion app (you can even simulate sensor values and look at the lua console to see messages in there to debug things). Companion runs the text based lua (it doesn't have the memory limitations that the radio does), so no need to compile for running code in Companion sim. Once you have it working, you can transfer it to the Horus radio over the USB cable using the synchronise SD card option you mentioned earlier.
Yes, read the wiki in full - I spent many hours getting it how it is today. The last part, I answered above. Good luck
OK, I already thought that the values have to get manipulated before getting displayed. They don't seem to be correct when discovered and displayed straight in the "find telemetry" menu.
Thanks for the links, I'll take a look at them to get familiar with lua scripts.
I do have the compiler (luac option) built into my horus firmware but that doesn't seem to be very handy - at least for developing. I don't want to get the SD out, update the Script, reboot the horus ... just to find out that there is a type.
Well, I guess I will read through the manuals and wikis. Do you know if its possible to simulate the script somehow in the companion software?
Yes Markus, This is all described in the Wiki if you care to read through.
You don't need to worry about compiling any new scripts you write, as OpenTx 2.2 takes care of this for you. You simply place the .lua file (your text version of the script) in the SCRIPTS/TELEMETRY folder on the SD card and the first time it runs (assuming you have the lua compile version of OpenTx 2.2 installed) the Horus/Taranis compiles a .luac file which it then runs.
In my project, I started during the reign of OpenTx 2.0 and the only way to compile was to use a dedicated version of the Companion app, which did the compilation - but this is no longer require with the advent of 2.2.
Like I mentioned previously, some of the sensors you discovered contain combinations of multiple (byte shifted) sets of telemetry data - again explained in the wiki, and the only way to extract these values and display them in sensible form is by using a lua script. There is a bit of a learning curve if you've never coded in lua before - especially in the cut down version which comes with OpenTx 2.2 - I got a load of help from the guys in this forum post: https://www.rcgroups.com/forums/showthread.php?2180477-LUA-scriptin...
Good luck, Paul
Wow, actually it's much more easy then expected with the horus. In the model setup I switched to the telemetry tab and started discovering telemetry data and immediately all values showed up. After that it's possible to select these values in a widget in the telemetry setup. At least it's a beginning!
I really want to get the distance between the GEO location of the horus internal GPS and the UAV calculated and displayed. This has to be done with a lua script.
I know the scripts are pre-compiled and the binaries are installed on the transmitter. Does anyone know how to get the right compiler (compatible with OpenTX 2.2) and maybe a basic Makefile?
Thanks,
Markus
Paul Atherton said:
OK, that's what I feared. Is there any way to check if the telemetry data is received by the horus? Even I have never did lua script programming, I think I can dig into it and try to get it working on the horus.
Yesterday I found this site where telemetry data gets displayed on the horus for the KISS flightcontroller. Maybe that would be a good base for your projekt.
Thanks for your reply,
Markus
Markus Manninger said:
Markus,
Sorry, but the Telemetry screens have only been created for the Taranis radio, not for the Horus. If anyone out there is a horus lua guru, then would be good to see screens developed for the Horus also.
The teensy side should work fine on your Pixhawk, and the data should be getting to your telemetry setup screen, just the same way it would on the Taranis radio (running OpenTx 2.2), but without a custom coded telemetry screen it won't be possible to display all of the telemetry items, as some are only available by programmatically decoding the telemetry sensor data.
Cheers, Paul (aka 'athertop')