AP_NavEKF: Add public function to limit height control during OF nav

This commit is contained in:
Paul Riseborough 2015-04-23 12:57:59 +10:00 committed by Randy Mackay
parent 68b225de4d
commit cf04600710
2 changed files with 20 additions and 0 deletions

View File

@ -5040,4 +5040,19 @@ void NavEKF::detectOptFlowTakeoff(void)
}
}
// provides the height limit to be observed by the control loops
// returns false if no height limiting is required
// this is needed to ensure the vehicle does not fly too high when using optical flow navigation
bool NavEKF::getHeightControlLimit(float &height) const
{
// If are doing optical flow nav, ensure the height above ground is within range finder limits after accounting for vehicle tilt and control errors
height = max(float(_rng.max_distance_cm()) * 0.007f - 1.0f, 1.0f);
// only ask for limiting if we are doing optical flow navigation
if (_fusionModeGPS == 3) {
return true;
} else {
return false;
}
}
#endif // HAL_CPU_CLASS

View File

@ -240,6 +240,11 @@ public:
// send an EKF_STATUS_REPORT message to GCS
void send_status_report(mavlink_channel_t chan);
// provides the height limit to be observed by the control loops
// returns false if no height limiting is required
// this is needed to ensure the vehicle does not fly too high when using optical flow navigation
bool getHeightControlLimit(float &height) const;
static const struct AP_Param::GroupInfo var_info[];
private: