Taranis: New Gimbal Test Lua Script - RC Groups
Thread Tools
This thread is privately moderated by Miami Mike, who may elect to delete unwanted replies.
Mar 18, 2017, 09:11 AM
Registered Taranis User
Miami Mike's Avatar
Announce

Taranis: New Gimbal Test Lua Script


gimbtest.lua is designed to run as a telemetry screen, although it doesn't actually provide telemetry. It checks each of the four stick functions, throttle, aileron, elevator, and rudder, for the 2049 possible stick values recognized by OpenTX, which range from -1024 to +1024. When each stick value is detected the corresponding screen pixel is set, and slow, careful movement of the sticks will eventually produce a display of which positions are detectable and which are not.

Pressing MINUS (-) will clear the screen and restart the test, and long-pressing EXIT will exit the screen.

When gimbtest.lua is run in Companion simulator the result is not impressive because the values obtained from mouse movement by Companion are very coarse compared to the values obtained from the Taranis gimbals:



The vertical lines in the display each consist of four line segments, one for Thr, one for Ail, one for Ele, and one for Rud. The left segments indicates that the value of -1024 was reached, the center segments indicates that zero was reached, and the right segments indicates that +1024 was reached. All other positions are indicated by individual pixels, with the negative values represented on the left side of center and the positive values represented on the right side.

You can see in the image above that when the script was run on Companion simulator the center segment for Thr did not appear, indicating that a zero reading from the throttle stick could not be obtained.

The number of values obtainable from a Taranis radio is several times greater than those obtained in Companion simulator. The following screen was generated by a Taranis with the original potentiometer-based gimbals, running OpenTX Version 2.1.9:



There are a few absent pixels that might have been obtained by continuing to move the sticks around, but it's clear that most of the missing pixels fall into definite patterns which vary with each stick axis, and there are even differences between the negative and positive sides. There's a definite reason for this, and it reveals that the number of different stick position values available to OpenTX is actually less than some may have thought. It'll be interesting to find out if the new M9 gimbals produce a substantially different result, but I doubt that they will. You're welcome to start a discussion about that here, but meanwhile, try the script for yourself.

Download gimbtest.txt from the link below, change the name to gimbtest.lua, store it on your SD card in SCRIPTS/TELEMETRY, and set it up in one of your model memories as a telemetry screen. Then select it with the PAGE button.
Latest blog entry: Taranis: LiPo Fuel Gauge!
Sign up now
to remove ads between posts
Mar 27, 2017, 05:07 PM
Adam
xStatiCa's Avatar
Ideas for creating a Widget version...

With Telemetry scripts on Taranis you had to clear the screen manually so you could leave pixels on without redrawing them on each refresh. With 2.2 Widgets, The screen is cleared automatically so the points will need to be redrawn each screen refresh.

- Create a table representing all the pixels and drawing them one at a time. Maybe grouping multiple in a row so that you can use the rectangle drawing.
- It would be neat if you could manipulate a bitmap/picture in memory and then just display the picture. I don't know that you can access the raw bitmaps that you load though.
- Admit defeat and leave it for Taranis only
- ? something else ?
Mar 27, 2017, 06:02 PM
Registered Taranis User
Miami Mike's Avatar
Quote:
Originally Posted by xStatiCa
- Admit defeat and leave it for Taranis only
It sounds more like leave it for version 2.1.9 only.

Judging by what you're telling me, it's not even going to work on a Taranis running a version higher than 2.1.9, and with all of these compromises the developers are making to accommodate limited memory, it seems doubtful that a table or array of adequate size will even be possible.
Latest blog entry: Taranis: LiPo Fuel Gauge!
Mar 27, 2017, 06:45 PM
Adam
xStatiCa's Avatar
It should work fine on 2.2 on Taranis from what I understand. Taranis supports Telemetry scripts on 2.2 and I assume they still pretty much work the same as they did on 2.1. It is only on the horus that Telemetry scripts are not supported so you have to use the new Widgets which behave differently. I have not tested 2.2 on Taranis though to confirm that the refresh works the same as 2.1. I will see if I can test that in the next day or so.
Mar 27, 2017, 07:39 PM
Registered Taranis User
Miami Mike's Avatar
Yes, gimbtest.lua works in Companion 2.2, except that for some reason lcd.drawNumber() is shifting the numbers way to the right of where they're supposed to be.

Also, the filenames have to be shortened to six letters to actually work, yet my lua scripts that have eight letter filenames still show up in the telemetry screen menu and can be selected as usual. You don't see any problem selecting the script, but when you run the simulator they're just not there.

Feel like reporting a bug to Kilrah? I don't.

And when I ran "gmbtst.lua", I saw that the mouse-simulated stick resolution has been reduced quite a bit. You don't get nearly as many dots showing up as you do in Companion 2.1.9.
Latest blog entry: Taranis: LiPo Fuel Gauge!
Mar 27, 2017, 07:50 PM
Adam
xStatiCa's Avatar
You have to add RIGHT to lcd.drawNumber(). By default in 2.2 they are LEFT adjustified which was a change in 2.2.
Mar 27, 2017, 08:08 PM
Registered Taranis User
Miami Mike's Avatar
Okay, that worked. I changed lcd.drawNumber(68, 2 + 16 * s, V, MIDSIZE) to lcd.drawNumber(68, 2 + 16 * s, V, MIDSIZE+RIGHT) and now it looks correct.
Latest blog entry: Taranis: LiPo Fuel Gauge!

Thread Tools