14 bool update(
bool enabled,
bool online,
fp32 yaw_error,
fp32 pitch_error,
16 const bool within = enabled && online && std::isfinite(yaw_error) &&
17 std::isfinite(pitch_error) && std::abs(yaw_error) <= tolerance &&
18 std::abs(pitch_error) <= tolerance;
19 if (!within) elapsed_ = 0;
20 else if (dt > 0) elapsed_ += dt;
21 return within && elapsed_ >= settle_seconds;
23 void reset() { elapsed_ = 0; }