edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

Distance Travelled Telemetry Line.

Open BarryCole opened this issue 1 year ago • 15 comments

Is there an existing issue for this feature request?

  • [X] I have searched the existing issues

Is your feature request related to a problem?

No

Describe the solution you'd like

Is it possible to add a telemetry line to measure "Distance travelled" using GPS speed as the sensor.

Thanks for your help.

Describe alternatives you've considered

Cannot find an alternative.

Additional context

No response

BarryCole avatar Sep 25 '24 08:09 BarryCole

It is not the GPS speed as a sensor. To calculate the “distance traveled”, you need to measure the latitude every second and calculate the distance in between and add it to a variable.

This is the formula: local lat = math.cos((gpsValuelat3 + gpsValuelat2) / 2 * 0.01745) local dx = math.abs(111.3 * lat * (gpsValuelon3 - gpsValuelon2)) local dy = math.abs(111.3 * (gpsValuelat3 - gpsValuelat2)) local distancetraveled = math.sqrt(dx * dx + dy * dy) * 1000

To avoid inaccuracies while the model is only standing on the ground, I would recommend that the calculation only takes place when, for example, you have released the motor protection switch and are about to take off.

ParkerEde avatar Sep 25 '24 12:09 ParkerEde

Distance travelled

This works, but it would be better if it was made as a propper line for distance, that gave a distance in Meters rather than mAH. It works and it seems quite accurate.

BarryCole avatar Sep 25 '24 13:09 BarryCole

Here's a LUA function script to do that. It requires a speed sensor (GSpd) and generates a new sensor GTrd (GPS travelled distance). If necessary change line 5 to the name of your GPS speed sensor.

  • download GPStrv.lua.txt and remove the .txt extension
  • copy GPStrv.lua to the SD Card folder \SCRIPTS\FUNCTIONS
  • activate the Lua script using special function Lua Script

image

  • go to model settings / telemetry and discover new sensors

image

mha1 avatar Sep 25 '24 18:09 mha1

Thanks for that, but it would still be better to have it built in to Edge.

BarryCole avatar Sep 25 '24 18:09 BarryCole

You don't have to bloat the firmware for stuff hardly anyone uses if you can easily add it with LUA

mha1 avatar Sep 25 '24 18:09 mha1

IMO, using a LUA as Michael demonstrated is the right way to add support for this.

On Thu, 26 Sept 2024, 4:40 am Michael, @.***> wrote:

You don't have to bloat the firmware for stuff hardly anyone uses if you can easily add it with LUA

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/issues/5563#issuecomment-2374886482, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJ66KLEYK4ZAHU4FVUPA7DZYL7QXAVCNFSM6AAAAABOZ6PTFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZUHA4DMNBYGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

pfeerick avatar Sep 25 '24 20:09 pfeerick

Maybe the reason not many people use it, is because it is not there.

BarryCole avatar Sep 25 '24 22:09 BarryCole

More likely, it is because this really something a flight controller would calculate and report itself. Or, if you want to know distance (in a straight line) from yourself) you also may need a GPS in the handset, in order to take in account movement of the handset (if it is not stationary)... There is built-in support for that calculated sensor already.

On Thu, 26 Sept 2024, 8:41 am BarryCole, @.***> wrote:

Maybe the reason not many people use it, is because it is not there.

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/issues/5563#issuecomment-2375393850, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJ66KISNJYWLPNFWDEMZ73ZYM3YLAVCNFSM6AAAAABOZ6PTFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVGM4TGOBVGA . You are receiving this because you commented.Message ID: @.***>

pfeerick avatar Sep 26 '24 00:09 pfeerick

Some of you are missing the point. I do not want to know how far away from me the plane is. I want to record how far it has flown, during the day.

BarryCole avatar Sep 26 '24 07:09 BarryCole

There is a way to do this with a calculated sensor. See the link below (but it is a German forum and the tread is four years old). I've tested it 3 years ago. It does work.

(With OpenTX 2.3.7 I had to change the units of GSpd to [A] or [mA] and I had to use a Ratio of 1.852 because OpenTx worked with [ktns])

First step try this: Screenshot 2024-09-26 194441

https://fpv-community.de/threads/wegstrecke-mit-gps-lazy-carbo-way.85758/

(It's similar to how you calculate the fuel consumption from [A] to [mAh])

ChrisOhara57 avatar Sep 26 '24 18:09 ChrisOhara57

Some of you are missing the point.

That is quite easy, when you don't say what your intent / use case is, so thank you for elaborating on that. I can put the crystal ball away now ;)

Maybe the reason not many people use it, is because it is not there.

But there are plenty of forum posts, guides and snippets on how to use Lua to add in custom telemetry sensors, etc, so that is not a very good argument for this - as it clearly is there - just not as user friendly as some of the other options.

Given this is basically just another version of the consumption calculated sensor, but with the appropriate units, it should not be that hard to add though.

pfeerick avatar Sep 26 '24 23:09 pfeerick

To avoid misunderstandings you should also read under discussions "Distance travelled #5516".

ChrisOhara57 avatar Sep 27 '24 05:09 ChrisOhara57

I still think it would be better built in. It is there in ETHOS as "Trip", a simple one liner, so why not edge.???

BarryCole avatar Oct 18 '24 10:10 BarryCole

... a simple one liner, so why not edge.???

Are you aware this might comes across pretty rude?

mha1 avatar Oct 18 '24 17:10 mha1

Not meant to be rude, just short and to the point.

BarryCole avatar Oct 18 '24 18:10 BarryCole