AC_AttitudeControl: Support for Standby functions

This commit is contained in:
Leonard Hall 2019-09-28 23:08:23 +09:30 committed by Andrew Tridgell
parent 244e5129fc
commit fe0c05d7e4
2 changed files with 25 additions and 0 deletions

View File

@ -763,6 +763,25 @@ void AC_PosControl::init_xy_controller()
init_ekf_xy_reset();
}
/// standby_xyz_reset - resets I terms and removes position error
/// This function will let Loiter and Alt Hold continue to operate
/// in the event that the flight controller is in control of the
/// aircraft when in standby.
void AC_PosControl::standby_xyz_reset()
{
// Set _pid_accel_z integrator to zero.
_pid_accel_z.set_integrator(0.0f);
// Set the target position to the current pos.
_pos_target = _inav.get_position();
// Set _pid_vel_xy integrators and derivative to zero.
_pid_vel_xy.reset_filter();
// initialise ekf xy reset handler
init_ekf_xy_reset();
}
/// update_xy_controller - run the horizontal position controller - should be called at 100hz or higher
void AC_PosControl::update_xy_controller()
{

View File

@ -164,6 +164,12 @@ public:
/// this does not update the xy target
void init_xy_controller();
/// standby_xyz_reset - resets I terms and removes position error
/// This function will let Loiter and Alt Hold continue to operate
/// in the event that the flight controller is in control of the
/// aircraft when in standby.
void standby_xyz_reset();
/// set_max_accel_xy - set the maximum horizontal acceleration in cm/s/s
/// leash length will be recalculated
void set_max_accel_xy(float accel_cmss);