Thread Tools
This thread is privately moderated by Miami Mike, who may elect to delete unwanted replies.
Feb 15, 2017, 02:39 PM
Glider Guider
Miami Mike's Avatar
Alert

Taranis: Glider Simulator is ready!


Presenting Miami Mike's F3J/TD Glider Simulator for the FrSky Taranis X9D



Instructions for downloading, installing, and running glidsim.lua
  1. Click here or the link below to download glidsim.txt.
  2. Rename the file to "glidsim.lua".
  3. Store it in your OpenTX Companion SDCARD folder and on your radio's SD card, under /SCRIPTS/TELEMETRY.
  4. Open an eepe file containing an F3J/TD glider setup, and open the glider for editing.
  5. Select the Telemetry tab, scroll to the bottom, and select an unused Telemetry screen tab.
  6. For Custom Screen Type select Script, then glidsim.
  7. Select Simulate at the bottom of the page.
  8. Select the Taranis Simulator tab.
  9. On the Taranis simulator, long-press the PAGE button to get to the Glider Simulator page.
  10. To set flap offset, move the radio controls to their flap-neutral positions and press PLUS (+).
  11. To switch between cross-tail and v-tail, Press MINUS (-).
  12. To exit the simulator, long-press EXIT.
  13. After setting up all of your gliders for glidsim.lua, be sure to save the modified eepe file.
  14. When running the simulator on your radio, move the controls to their flap-neutral positions before switching on, clearing a switch warning, or selecting a model. Flap neutral will be set automatically when a model has finished loading.

Please post questions, comments, suggestions, bug reports, and general discussion of the glider simulator in the comment section below.


Last edited by Miami Mike; Jul 20, 2018 at 09:45 AM.
Sign up now
to remove ads between posts
Feb 15, 2017, 03:33 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Very cool Mike!

During our summer break from contests I'm going to revisit my setup and this will be great!
Latest blog entry: Finished My Sbach 342!
Feb 15, 2017, 06:55 PM
Registered User
mikeshellim's Avatar
Very nice work Mike! I have it up and running in Companion 2.1 with E-Soar Plus loaded... It'll be very useful for visualising the effects as new features are added.

I've personalised it by enabling your code for CH7 (motor) and also have also added Timer1 in place of CH8.

lcd.drawText(1, 41, "T1", Normal)
lcd.drawTimer(24,41, model.getTimer(0).value, Normal)


Running it as a telemetry script in Companion is cool, no need to open the script each time (though probably a good idea to disable the script while flying). Also being able to view the motor output (Ch7) is very useful.

Thank you for sharing this with the community!
Feb 15, 2017, 10:36 PM
Glider Guider
Miami Mike's Avatar
Quote:
Originally Posted by mikeshellim
Running it as a telemetry script in Companion is cool, no need to open the script each time (though probably a good idea to disable the script while flying).
I don't think there's any reason to worry about the script while you're flying, especially if it's not visible on the screen. In that case only function bg_func() is periodically called, presumably to record telemetry data in the background, and in glidsim.lua that function is empty because there's nothing for it to do.

And there's no reason to have the screen visible while you're flying anyway, because it can't provide you with any useful information.

Finally, it's safe to have telemetry scripts running while you're flying because they have the lowest priority. They're automatically stopped and disabled if they misbehave (too long runtime, error in code, low memory).

So there doesn't seem to be any point in disabling the script for any reason. Just leave it active and switch to it with the PAGE button whenever you want to look at it.
Mar 04, 2017, 01:56 PM
Registered User
boomerwing's Avatar

A question about Flaps offset


This is a fun application, Mike and a neat way to play with glider setups and Lua too. I have it working on OTX 2.1.9 Companion with a generic glider setup, ail, flaps, elevator, rudder, and some crow, but I don't understand the offset seen in the flaps of Ch3 and Ch4. I have the flaps controlled by the Left Slider. Where does the offset come from? When I think that the flaps should be viewed at 0 deflection they are up a few points.
boomerwing
Mar 04, 2017, 03:47 PM
Glider Guider
Miami Mike's Avatar
On Companion simulator, move the left slider and the flap stick to their top positions and then click the PLUS(+) button to reinitialize the flap offset to 0%.

Then, if that's the flap offset you plan to keep, you can edit the script to initialize at that value by changing this:

Code:
local function init_func()
	Flap_Offset = Get_Data("ch3")
end
to this:

Code:
local function init_func()
	Flap_Offset = 0
end
But that's generally not a good value for a flap offset because flaps usually go down a lot farther than they go up. You'd be wasting almost half of the flap servo travel if you set up a plane that way. A value somewhere above +50% would be more reasonable.

You should try Mike Shellim's setup.
Last edited by Miami Mike; Mar 04, 2017 at 03:52 PM.
Mar 04, 2017, 04:13 PM
Registered User
boomerwing's Avatar
Thank you, Mike for the prompt response. I will play with your suggestions.
boomerwing
Jan 12, 2018, 11:26 AM
Registered User
Mike - I know you wrote this (very nice BTW) script for OpenTx 2.1.9 and X9D - would be possible for you to modify it for 2.2.1. ?

I tried it on my X9E and OpenTx 2.2.1 - and values are truncated somehow - please see pictures.

Companion 2.2.1 show same behavior for both X9E and X9D displays - so you can check there.

I tried it on Mike Shellim`s unmodified E-Soar Plus - channel assignments are same but value for rudder is not displayed at all (ch 6).

Plus - in X9E I don't have keys for "+" and "-" - I have rotary knob - but that is of less importance.
Jan 12, 2018, 11:59 AM
Glider Guider
Miami Mike's Avatar
It looks like it's very close to working right and probably just needs a little tweaking, but I haven't gotten into OpenTX 2.2 yet because as long as the only radios I have are my Taranis X9Ds, 2.2 doesn't have anything for me that's worth the trouble of switching over.

I recently started tacking this onto my blog posts:

Radio mods and programming setups in my blog are designed for the FrSky Taranis Plus using OpenTX version 2.1.9. If you've adapted any of them to other radios or other OpenTX versions, or even found a better way to do the same thing I've described here, please feel free to describe your version, or link to a description of your version, in the comment section of the relevant post.

I'll ask in the LUA scripting - Technical discussion thread if anyone wants to convert it.
Jan 12, 2018, 01:11 PM
Registered User
I respect your position - thanks for quick response!
Jan 15, 2018, 08:34 AM
Glider Guider
Miami Mike's Avatar
I see you've already spotted the post from I shems saying he'll look at it. I was hoping he'd be the one to volunteer because he knows a lot about Lua and is keeping up with the new OpenTX versions.
Jan 18, 2018, 02:02 PM
Have Fun and Just Fly!
l shems's Avatar
Quote:
Originally Posted by Miami Mike
I see you've already spotted the post from I shems saying he'll look at it. I was hoping he'd be the one to volunteer because he knows a lot about Lua and is keeping up with the new OpenTX versions.
Here you go. Quick fix.

I'll add some widget support to it next.
Last edited by l shems; Jan 18, 2018 at 03:04 PM. Reason: added rotary support for X9E
Jan 18, 2018, 03:32 PM
Glider Guider
Miami Mike's Avatar
Thanks!

I tried it with Companion 2.1.9 and it still works the same, so that's a nice feature.

I noticed that you changed lines like this one by adding "(RIGHT or 0)":
Code:
lcd.drawNumber(193, 1, Percentage, Attribute + PREC1 + (RIGHT or 0))
I gather that the constant "RIGHT" now exists and is needed in version 2.2 but doesn't exist in version 2.1.9, so the expression you added will only include it if it exists, and therefore won't cause an error by referencing a nil value.

And apparently, since "RIGHT" and "LEFT" are now reserved, my variables with those names had to be changed to "VRIGHT" and "VLEFT."

You also added some other variables but don't appear to have done anything with them yet:
Code:
local lcd = LCD or lcd
local LCD_W= lcd.W or LCD_W
local LCD_H = lcd.H or LCD_H
Interesting!
Jan 18, 2018, 04:25 PM
Have Fun and Just Fly!
l shems's Avatar
Quote:
Originally Posted by Miami Mike
Thanks!

I tried it with Companion 2.1.9 and it still works the same, so that's a nice feature.

I noticed that you changed lines like this one by adding "(RIGHT or 0)":
Code:
lcd.drawNumber(193, 1, Percentage, Attribute + PREC1 + (RIGHT or 0))
I gather that the constant "RIGHT" now exists and is needed in version 2.2 but doesn't exist in version 2.1.9, so the expression you added will only include it if it exists, and therefore won't cause an error by referencing a nil value.

And apparently, since "RIGHT" and "LEFT" are now reserved, my variables with those names had to be changed to "VRIGHT" and "VLEFT."

You also added some other variables but don't appear to have done anything with them yet:
Code:
local lcd = LCD or lcd
local LCD_W= lcd.W or LCD_W
local LCD_H = lcd.H or LCD_H
Interesting!
Those are preparations for running the script as a widget.

I got it running as a widget, but it runs out of CPU on full deflections due to the way you draw the control surfaces.

They are drawn line per line, and opentx doesn't allow to many LCD transactions per cycle. (Less than a script in any case).

Is there a specific reason you didn't use drawRectangle?
Jan 18, 2018, 04:52 PM
Glider Guider
Miami Mike's Avatar
It's been a while, but I think it was due to control surfaces being transparent if I did it that way. I had to erase existing lines that needed to be behind and hidden by what I was drawing.

There might be a better way to do that, but if so I couldn't find it.


Quick Reply
Message:
Thread Tools