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

Add remaining flight time and distance calculations and OSD items #2863

Merged
merged 1 commit into from
Jun 17, 2018

Conversation

shellixyz
Copy link
Collaborator

@shellixyz shellixyz commented Mar 2, 2018

Answers #2804 and partially #2792. Also closes #3215.

Calculates the remaining available flight time and travel distance before needing to go straight to home based on GPS distance from home, remaining battery capacity, average power draw, altitude and direction change during RTH and wind estimation. The OSD items will blink when the timer reaches 0.

New settings:

  • osd_use_wind_compensation: use wind estimation to compensate for time/distance calculation ON/OFF
  • idle_power: power drawn by the system when the motor(s) are stopped
  • cruise_power: power drawn by the motor(s) at cruise throttle in cW (0.01W)
  • nav_fw_cruise_speed: speed at cruise throttle in cm/s
  • rth_energy_margin: desired energy left after arriving to home (for landing) in % of usable battery capacity

It will only display the time if the following conditions are met:

  • The VBAT and CURRENT_METER features are enabled
  • The GPS is healthy and the home position has been set
  • The battery capacity has been specified with the mWh unit
  • The cruise_power and nav_fw_cruise_speed settings have been set (>0)
  • The battery was full when plugged in
  • The FC is armed

Obviously be careful with this:

  • It can only be as precise as the meters calibration
  • Wind estimation has not yet been well tested and is not updated very often
  • If not configured correctly the estimated time can be way off
  • It is advised to set nav_fw_cruise_speed a bit lower than the real speed and cruise_power 10% higher than the power at cruise throttle to ensure variations in throttle during cruise won't draw more power than estimated.

@stale
Copy link

stale bot commented May 13, 2018

This issue / pull request has been automatically marked as stale because it has not had any activity in 60 days. The resources of the INAV team are limited, and so we are asking for your help.
This issue / pull request will be closed if no further activity occurs within two weeks.

@shellixyz
Copy link
Collaborator Author

Testing is in progress. It is working but I did some minor adjustments and need to test fly it one more time.

@teckel12
Copy link
Contributor

@shellixyz Distance left in combination with distance from home could yield an automatic RTH feature.

@shellixyz
Copy link
Collaborator Author

Yes it is planned :). It is already possible with this code. The distance to home is already taken into account and soon the wind estimation from #2450.

@teckel12
Copy link
Contributor

@shellixyz I don't think even DJI uses wind estimation for the auto RTH feature.

@shellixyz shellixyz force-pushed the fly_time_left_before_rth branch 2 times, most recently from 7624a4c to bf5d1b1 Compare June 4, 2018 14:11
@shellixyz
Copy link
Collaborator Author

I've updated this PR. It has been tested and is ready for review/merge.

@shellixyz shellixyz changed the title Add remainingFlyTimeBeforeRTH calculation and OSD item Add remaining flight time and distance calculations and OSD items Jun 4, 2018
@teckel12
Copy link
Contributor

teckel12 commented Jun 4, 2018

@shellixyz Travis doesn't agree.

@shellixyz
Copy link
Collaborator Author

@teckel12 Now it does :)

@fiam fiam added this to the 2.0 milestone Jun 17, 2018
@fiam fiam merged commit 04ab376 into iNavFlight:development Jun 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants