GPS Distance Trip Find Return Home Lua Script

RCdiy

RCdiy
Instead of running the script on the radio, run it on companio using the simulator.
After you run the script you will see a new file appear on the PC, GPS2.luac
 

RCdiy

RCdiy
Thanks.... That's not how Telemetry scripts are run...
Follow this....
http://rcdiy.ca/aa-telemetry-scripts-getting-started/

You configure the script to run on the TX using the DISPLAY screen and on Companion using the Telemetry screen all the way at the bottom...

Edit
Lets start from scratch...
I remember now that you did send me an OTX configured correctly so you do know how to run a telemetry script. I probably confused you.

Set up and run the telemetry script in companion.
When you do this a GPS2.luac file gets created.
Rename this file to GPS2c.lua.
Put this file on the Tx.
Set up and use this file like you would a normal telemetry script; Using the DISPLAY screen.
 
Last edited:

BarryCole

New member
Rav, Now sorted. Probably all my fault. I think that my confusion was due to using the Lua script to set up the S8R receiver, which has to be started the way I was trying to start yours. (Unless you know different). For some reason I could not get it to select GPS2c, so I changed the file name to GPS2, and all seems well. I have another glider using the same setup, which I may be able to fly tomorrow, so I will see how it goes.

Sorry to mess you around, and thanks again for your help, it is much appreciated.

BC
 

RCdiy

RCdiy
Any time Barry...
Are you on Skype?
If you want we can do a Skype sometime if you want some help... E-mail me regarding Skype (any topic)... you have my e-mail.... for other questions continue to use the forums...
 

BarryCole

New member
HI Rav,
Skype in the UK seems totally broken at present. It used to work fine, but good old MS did an upgrade and now it does not work. If they fix it, we will give it a try.

BC
 

PeterBeretta

New member
Does this LUA script work on a Horus 12s radio?

Hi,

Will this LUA script "GPS Distance Trip Find Return Home Lua Script" run on a Horus x12s radio?
 

PeterBeretta

New member
I have copied the files across to the SD card on my Horus X12s after editing them for my setup. When I run the GPS2.lua script it comes up with the following error:

TELEMETRY/GPS2.lua:998
attempt to call field 'getLastPos' (a nil
 

RCdiy

RCdiy
Try waiting till the gps has a lock and is returning readings.
I know i do check for nil values.
problem is I don’t get the same error on the Taranis series.
 

PeterBeretta

New member
Hi,

The GPS had a lock. I tried without the lock and the script failed at an earlier.

The Horus X12s has a built in GPS which is also called "GPS". I first tried changing the name of the GPS in the plane to GPS2 but the script still failed. I then changed it back to GPS and changed the radio GPS to "" but get the same result.

It also does not display any arrows on the screen but it does trigger the initial voice feedback messages.

I have been running the script by using the TX file manager to navigate to the lua script and then clicking on it and selecting execute.

I tried from Companion but it did not run the script it just created the .luac file. Should I be using this .luac file?

If I try to activate the script from the Special Functions menu, it can't find the script. It seems to look in a different folder.
 

PeterBeretta

New member
I noticed from the debug window in companion that it tries to run the script from the "FUNCTIONS" folder, so I moved the lua script there. Here is the output from the debug window after running the script a few times:

found in map: /Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.luac
f_stat(/Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.luac) = OK
convertToSimuPath(): /SCRIPTS/FUNCTIONS/GPS.lua -> /Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua
findTrueFileName(/Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua)
found in map: /Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua
f_stat(/Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua) = OK
luaLoadScriptFileToState(/SCRIPTS/FUNCTIONS/GPS.lua, T): loading /SCRIPTS/FUNCTIONS/GPS.lua
convertToSimuPath(): /SCRIPTS/FUNCTIONS/GPS.lua -> /Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua
findTrueFileName(/Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua)
found in map: /Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua
f_open(/Users/peterberetta/Documents/RC/Companion SD/SCRIPTS/FUNCTIONS/GPS.lua, 1) = 0x7fff970a8328 (FIL 0x7000062e0208)
f_close(0x7fff970a8328) (FIL:0x7000062e0208)
Script GPS error: /SCRIPTS/FUNCTIONS/GPS.lua:971: attempt to call field 'getLastPos' (a nil value)
 

GeoffNichol

New member
Hi , Having Just watched a fiends expensive plane disappear into the distance. I'm in the process off building some gps units and installing your Very impresive script on my 9xe. Due to the nature of the models I fly I think it would be very difficult to pilot them back. but what cou be very usefull would be the permanant storage of the last received gps position , which could then be entered in to a smartphone mapping application to help locate the wreckage. or does your script already do this? I know you can get the gps data from the log files but they are not easily accessible at the field.
Thanks for all the work you have already put in.
 

pressalltheknobs

Posted a thousand or more times
You should also make sure to setup failsafe to switch off the throttle and bank left or right to try an get the plane to circle down asap. It is not safe to let a plane fly off into the distance and there is no excuse for not setting a failsafe. Any modern RC system that is any good supports it. It is not perfect but unless you have an onboard flight controller with GPS return to home it is the best you can do and it probably makes putting a simple GPS sensor on your plane unnecessary. Not reason not to do that too of course.

Note that most systems use HOLD and the default failsafe mode which is almost never what you want.
 

GeoffNichol

New member
Sorry my turn of phrase at the beginning of my post was misleading. The pilot tripped while moving to the landing area ,He was slope soaring so no throttle. Who said that he did not have a fail safe set? It was not used initially as after he had regained his balance and shouted lost plane he tried to fly in wide gentle turns , we were hoping to see a flash of sun on the wings but no luck. I should also add that the pilot could be regarded as a expert.
Sloping is a very variable sport , the wind can change and lift disappear leaving you no chance of returning to the top of the hill. In summer the bracken can be 5 foot high and even if you "know" where you landed out it can be very difficult to find your model.
So if the model was fitted with a gps unit (15 gbp to make) and the last known position is reported back to the Frsky transmitter that position could be entered into a smartphonecmapping app to show the posibleclocation of the model
 

Roger53

New member
Thanks for this script. I set it up today and it works great. As i read some of the replies I just want to add my experience to get it running. First, on my 9D+ i simply followed the instructions and it worked. But for the QX7 I was getting out of memory errors until i changed the name to gps2c.lua and it then started working. I am using 2.2.3 with QX7 and 9D+, and HGLRC gps

But I have 2 issues that I hope can be resolved. 1. Although altitude for the voice announcement says meters it is actually reporting in cm. The announcement reports 41,000meters which obviously is incorrect. I am pretty sure this number is coming directly from the gps data. Converted from cm to meter 41,000/100 = 410m which is correct for my location. Can a math function be added to convert cm to m? 2) the altitude is reporting MSL. Is there a way to report altitude realitive to the home location? My OSD reports the altitude above sea level until I arm and then it shows altitude relative to the home location.
Thank you for you work to get this running.
 
Last edited:

Guam.Haole

New member
I just completed adding the frsky GPS to my FrSky X-Lite. I was able to cut the shrink tubing off to flatten the GPS out and added it internal to the X-Lite. It gets the GPS coordinates just fine. I have tried the script as is but I think it may be a screen size error issue. I have touched base on learning the eLua programming but I hope you may be able to compartmentalize the tasks in the script. It may solve the memory error issue if we can chose 1-4 separate scripts/tasks. The only one I am interested in at this time is find model. Also, I noticed that X-Lite only picks up GPS coordinates if telemetry is active. This could be problematic if the battery is disconnected on impact. My wish list is that the TX GPS work without the need of receiver telemetry and as GeoffNichol requested the last known position is permanently stored per model. There are times when the club members are doing night flying and would wait until morning to find a downed model. It would be great to Turn on the TX, it grab a GPS fix, and point you to the last known position of the model. I do thank you for your work on this project. I would not have attempted this from scratch. I am fairly confident I will eventually be able to edit the script to my needs (though this will take me more time than your expertise). There may be reason my wish list may not be possible. Thanks again.

Dwight
 

summX

New member
Hey. Is there a version of the script out somewhere for people without a tx gps? I know I can setup the script to be "single GPS", but I´m trying to incorporate it into one single script with my other telemetry script. I´ve tried to get rid of all the tx code parts, but somewhere down in the functions I can´t get my head around what to delete to make it run.

Cheers
Christian