2017-02-07 20:49:55 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AC_PosControl.h"
|
|
|
|
|
|
|
|
class AC_PosControl_Sub : public AC_PosControl {
|
|
|
|
public:
|
2019-12-10 05:31:08 -04:00
|
|
|
AC_PosControl_Sub(AP_AHRS_View & ahrs, const AP_InertialNav& inav,
|
2017-11-20 22:46:27 -04:00
|
|
|
const AP_Motors& motors, AC_AttitudeControl& attitude_control);
|
2017-02-07 20:49:55 -04:00
|
|
|
|
|
|
|
/// set_alt_max - sets maximum altitude above the ekf origin in cm
|
|
|
|
/// only enforced when set_alt_target_from_climb_rate is used
|
|
|
|
/// set to zero to disable limit
|
|
|
|
void set_alt_max(float alt) { _alt_max = alt; }
|
|
|
|
|
|
|
|
/// set_alt_min - sets the minimum altitude (maximum depth) in cm
|
|
|
|
/// only enforced when set_alt_target_from_climb_rate is used
|
|
|
|
/// set to zero to disable limit
|
|
|
|
void set_alt_min(float alt) { _alt_min = alt; }
|
|
|
|
|
|
|
|
/// set_alt_target_from_climb_rate - adjusts target up or down using a climb rate in cm/s
|
|
|
|
/// should be called continuously (with dt set to be the expected time between calls)
|
|
|
|
/// actual position target will be moved no faster than the speed_down and speed_up
|
|
|
|
/// target will also be stopped if the motors hit their limits or leash length is exceeded
|
|
|
|
/// set force_descend to true during landing to allow target to move low enough to slow the motors
|
|
|
|
void set_alt_target_from_climb_rate(float climb_rate_cms, float dt, bool force_descend) override;
|
|
|
|
|
|
|
|
/// set_alt_target_from_climb_rate_ff - adjusts target up or down using a climb rate in cm/s using feed-forward
|
|
|
|
/// should be called continuously (with dt set to be the expected time between calls)
|
|
|
|
/// actual position target will be moved no faster than the speed_down and speed_up
|
|
|
|
/// target will also be stopped if the motors hit their limits or leash length is exceeded
|
|
|
|
/// set force_descend to true during landing to allow target to move low enough to slow the motors
|
|
|
|
void set_alt_target_from_climb_rate_ff(float climb_rate_cms, float dt, bool force_descend) override;
|
|
|
|
|
2019-03-18 14:11:25 -03:00
|
|
|
/// relax_alt_hold_controllers - set all desired and targets to measured
|
|
|
|
void relax_alt_hold_controllers(float throttle_setting) {
|
|
|
|
AC_PosControl::relax_alt_hold_controllers(throttle_setting);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// relax_alt_hold_controllers - set all desired and targets to measured
|
|
|
|
/// integrator is not reset
|
|
|
|
void relax_alt_hold_controllers();
|
|
|
|
|
2017-02-07 20:49:55 -04:00
|
|
|
private:
|
|
|
|
float _alt_max; // max altitude - should be updated from the main code with altitude limit from fence
|
|
|
|
float _alt_min; // min altitude - should be updated from the main code with altitude limit from fence
|
|
|
|
};
|