Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2d2840a authored by Ytai Ben-Tsvi's avatar Ytai Ben-Tsvi
Browse files

Correctly configure rate limiter

The rate limiter was configured to 0 because we did math in fixed
point. This is now fixed.

Also, the rate limiter now supports 0 and doesn't return NaN.

Test: Manual verification of data via logging
Change-Id: Ifef562c504db405fe1098b47d047696fd9292845
parent dd31ee05
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ std::tuple<Pose3f, bool> moveWithRateLimit(const Pose3f& from, const Pose3f& to,
        return {to, false};
    }
    // Always rate limit if t is 0 (required to avoid division by 0).
    if (t == 0) {
    if (t == 0 || maxTranslationalVelocity == 0 || maxRotationalVelocity == 0) {
        return {from, true};
    }

+2 −2
Original line number Diff line number Diff line
@@ -35,10 +35,10 @@ using namespace std::chrono_literals;
namespace {

// This is how fast, in m/s, we allow position to shift during rate-limiting.
constexpr auto kMaxTranslationalVelocity = 2;
constexpr float kMaxTranslationalVelocity = 2;

// This is how fast, in rad/s, we allow rotation angle to shift during rate-limiting.
constexpr auto kMaxRotationalVelocity = 8;
constexpr float kMaxRotationalVelocity = 8;

// This should be set to the typical time scale that the translation sensors used drift in. This
// means, loosely, for how long we can trust the reading to be "accurate enough". This would