Skip to content

Commit

Permalink
HomePosition: Add minimum position change needed to be recognised as …
Browse files Browse the repository at this point in the history
…new home position
  • Loading branch information
KonradRudin committed May 21, 2024
1 parent 1c213fa commit 664a0f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/commander/HomePosition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

#include "HomePosition.hpp"

#include <math.h>

#include <lib/geo/geo.h>
#include "commander_helper.h"

Expand Down Expand Up @@ -83,7 +85,8 @@ bool HomePosition::hasMovedFromCurrentHomeLocation()
}
}

return (home_dist_xy > eph * 2.f) || (home_dist_z > epv * 2.f);
return (home_dist_xy > fmaxf(eph * 2.f, kMinHomePositionChangeEPH))
|| (home_dist_z > fmaxf(epv * 2.f, kMinHomePositionChangeEPV));
}

bool HomePosition::setHomePosition(bool force)
Expand Down
2 changes: 2 additions & 0 deletions src/modules/commander/HomePosition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

class HomePosition
{
Expand Down

0 comments on commit 664a0f2

Please sign in to comment.