Class MotionDetector
Defined in File motion_detector.h
Class Documentation
-
class MotionDetector
Detects whether the IMU is stationary based on sensor readings.
Uses simple thresholding on gyroscope magnitude and accelerometer deviation from gravity to determine stationarity. This allows covariance estimators to only update during stationary periods, avoiding motion-induced variance inflation.
Public Functions
-
explicit MotionDetector(double gyro_threshold = DEFAULT_GYRO_THRESHOLD, double accel_threshold = DEFAULT_ACCEL_THRESHOLD)
Construct motion detector with configurable thresholds.
- Parameters:
gyro_threshold – Max gyro magnitude to consider stationary (rad/s)
accel_threshold – Max accel deviation from gravity (m/s^2)
-
bool isStationary(const Vec3 &accel, const Vec3 &gyro) const
Check if the sensor is stationary based on current readings.
- Parameters:
accel – Linear acceleration sample (m/s^2)
gyro – Angular velocity sample (rad/s)
- Returns:
true if sensor appears stationary
-
void setGyroThreshold(double threshold)
Set the gyroscope threshold for stationarity.
- Parameters:
threshold – Max angular velocity magnitude (rad/s)
-
void setAccelThreshold(double threshold)
Set the accelerometer threshold for stationarity.
- Parameters:
threshold – Max deviation from gravity (m/s^2)
-
inline void setEnabled(bool enabled)
Enable or disable motion detection. When disabled, isStationary() always returns true.
-
explicit MotionDetector(double gyro_threshold = DEFAULT_GYRO_THRESHOLD, double accel_threshold = DEFAULT_ACCEL_THRESHOLD)