Browse Source

AP_NavEKF: Add public method reporting horizontal speed limit

This is required if using optical flow, as depending on height, the speed must be limited to prevent the sensor saturating
master
priseborough 10 years ago committed by Andrew Tridgell
parent
commit
b56b68ce10
  1. 11
      libraries/AP_NavEKF/AP_NavEKF.cpp
  2. 3
      libraries/AP_NavEKF/AP_NavEKF.h

11
libraries/AP_NavEKF/AP_NavEKF.cpp

@ -3622,6 +3622,17 @@ uint8_t NavEKF::setInhibitGPS(void) @@ -3622,6 +3622,17 @@ uint8_t NavEKF::setInhibitGPS(void)
}
}
// return the horizontal speed limit in m/s set by optical flow limitations
// allow 1.0 rad/sec margin for angular motion
float NavEKF::getSpeedLimit(void) const
{
if (useOptFlow()) {
return max((_maxFlowRate - 1.0f), 0.0f) * (flowStates[1] - state.position[2]);
} else {
return 400.0f; //return 80% of max filter speed
}
}
// return weighting of first IMU in blending function
void NavEKF::getIMU1Weighting(float &ret) const
{

3
libraries/AP_NavEKF/AP_NavEKF.h

@ -119,6 +119,9 @@ public: @@ -119,6 +119,9 @@ public:
// This command is forgotten by the EKF each time it goes back into static mode (eg the vehicle disarms)
uint8_t setInhibitGPS(void);
// return the horizontal speed limit in m/s set by optical flow limitations
float getSpeedLimit(void) const;
// return weighting of first IMU in blending function
void getIMU1Weighting(float &ret) const;

Loading…
Cancel
Save