Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distance Travelled Telemetry Line. #5563

Open
1 task done
BarryCole opened this issue Sep 25, 2024 · 12 comments
Open
1 task done

Distance Travelled Telemetry Line. #5563

BarryCole opened this issue Sep 25, 2024 · 12 comments
Labels
enhancement ✨ New feature or request

Comments

@BarryCole
Copy link

Is there an existing issue for this feature request?

  • 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 BarryCole added the enhancement ✨ New feature or request label Sep 25, 2024
@ParkerEde
Copy link
Contributor

ParkerEde commented Sep 25, 2024

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.

@BarryCole
Copy link
Author

BarryCole commented Sep 25, 2024

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.

@mha1
Copy link
Contributor

mha1 commented Sep 25, 2024

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

@BarryCole
Copy link
Author

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

@mha1
Copy link
Contributor

mha1 commented Sep 25, 2024

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

@pfeerick
Copy link
Member

pfeerick commented Sep 25, 2024 via email

@BarryCole
Copy link
Author

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

@pfeerick
Copy link
Member

pfeerick commented Sep 26, 2024 via email

@BarryCole
Copy link
Author

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.

@ChrisOhara57
Copy link

ChrisOhara57 commented Sep 26, 2024

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])

@pfeerick
Copy link
Member

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.

@ChrisOhara57
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants