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

HomePosition: Home position only changes on ground after minimum horizontal and vertical displacement #23025

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KonradRudin
Copy link
Contributor

Solved Problem

When the vehicle is not yet armed and on the ground, the home position is allowed to change when it is detected that the vehicle position has changed. When the EKF estimator is initialized the home position is changed if the local position change is higher than the estimated deviations in eph and epv. Those can be pretty small number ( <15cm in my tests) although the altitude might change more. This leads to a lot of new home position changes before taking off. However those changes are unnecessary, as the home position is set again when taking off. Changing the home position that often can negatively influence other modules depending on the home position (as the e.g. the mission validity).

Solution

  • Add a minimum horizontal distance of 1m needed horizontally and 1.5m vertically before changing the home position.
  • Refactor ...

Changelog Entry

For release notes:

Feature: Home position only changes on ground after minimum horizontal and vertical displacement.

Test coverage

  • simulation tests: using make px4_sitl gazebo-classic_standard_vtol and observing the home_position uOrb topic

@@ -45,6 +45,8 @@ static constexpr int kHomePositionGPSRequiredFixType = 2;
static constexpr float kHomePositionGPSRequiredEPH = 5.f;
static constexpr float kHomePositionGPSRequiredEPV = 10.f;
static constexpr float kHomePositionGPSRequiredEVH = 1.f;
static constexpr float kMinHomePositionChangeEPH = 1.f;
static constexpr float kMinHomePositionChangeEPV = 1.5f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 1.5?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just from some testing i had more than 1m variation. In the altitude we can have a larger error imo, as for landing we only have to make sure, the vehicle is at the final landing speed, when we do not have a distance sensor. This starts at MPC_LAND_ALT2 which s per default at 5m. SO if we have an initial error of 1.5m at start and while landing the error in the opposite direction, we still should be fine (but i guess we should not set it higher than 2m or make it dependend on MPC_LAND_ALT2).

@dagar
Copy link
Member

dagar commented Apr 19, 2024

The other thing you could do is only update it here if not moving.

@KonradRudin
Copy link
Contributor Author

The other thing you could do is only update it here if not moving.

And how would you do that? Alo check on the velocity? Could still lead to the same issue i guess.

@KonradRudin
Copy link
Contributor Author

Also here for completeness a plot from the home position changes before this PR, you can see, that the home position does change several times although the vehicle did not move and according the the eph and epv position converged already.w
Screenshot from 2024-04-19 16-31-05

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.

None yet

2 participants