mirror of https://github.com/ArduPilot/ardupilot
Copter: seperate kinimatic shaping from pid limit setting
This commit is contained in:
parent
064b0bcc63
commit
92dc499053
|
@ -8,11 +8,16 @@
|
||||||
// althold_init - initialise althold controller
|
// althold_init - initialise althold controller
|
||||||
bool ModeAltHold::init(bool ignore_checks)
|
bool ModeAltHold::init(bool ignore_checks)
|
||||||
{
|
{
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!pos_control->is_active_z()) {
|
if (!pos_control->is_active_z()) {
|
||||||
pos_control->init_z_controller();
|
pos_control->init_z_controller();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set vertical speed and acceleration limits
|
||||||
|
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
pos_control->set_correction_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,7 @@ void ModeAutorotate::run()
|
||||||
|
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(curr_vel_z, pilot_spd_up, fabsf(_target_climb_rate_adjust));
|
pos_control->set_max_speed_accel_z(curr_vel_z, pilot_spd_up, fabsf(_target_climb_rate_adjust));
|
||||||
|
pos_control->set_correction_speed_accel_z(curr_vel_z, pilot_spd_up, fabsf(_target_climb_rate_adjust));
|
||||||
|
|
||||||
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
|
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ void AutoTune::init_z_limits()
|
||||||
{
|
{
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
copter.pos_control->set_max_speed_accel_z(-copter.get_pilot_speed_dn(), copter.g.pilot_speed_up, copter.g.pilot_accel_z);
|
copter.pos_control->set_max_speed_accel_z(-copter.get_pilot_speed_dn(), copter.g.pilot_speed_up, copter.g.pilot_accel_z);
|
||||||
|
copter.pos_control->set_correction_speed_accel_z(-copter.get_pilot_speed_dn(), copter.g.pilot_speed_up, copter.g.pilot_accel_z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTune::log_pids()
|
void AutoTune::log_pids()
|
||||||
|
|
|
@ -11,12 +11,14 @@ bool ModeBrake::init(bool ignore_checks)
|
||||||
{
|
{
|
||||||
// initialise pos controller speed and acceleration
|
// initialise pos controller speed and acceleration
|
||||||
pos_control->set_max_speed_accel_xy(inertial_nav.get_velocity().length(), BRAKE_MODE_DECEL_RATE);
|
pos_control->set_max_speed_accel_xy(inertial_nav.get_velocity().length(), BRAKE_MODE_DECEL_RATE);
|
||||||
|
pos_control->set_correction_speed_accel_xy(inertial_nav.get_velocity().length(), BRAKE_MODE_DECEL_RATE);
|
||||||
|
|
||||||
// initialise position controller
|
// initialise position controller
|
||||||
pos_control->init_xy_controller();
|
pos_control->init_xy_controller();
|
||||||
|
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(BRAKE_MODE_SPEED_Z, BRAKE_MODE_SPEED_Z, BRAKE_MODE_DECEL_RATE);
|
pos_control->set_max_speed_accel_z(BRAKE_MODE_SPEED_Z, BRAKE_MODE_SPEED_Z, BRAKE_MODE_DECEL_RATE);
|
||||||
|
pos_control->set_correction_speed_accel_z(BRAKE_MODE_SPEED_Z, BRAKE_MODE_SPEED_Z, BRAKE_MODE_DECEL_RATE);
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!pos_control->is_active_z()) {
|
if (!pos_control->is_active_z()) {
|
||||||
|
|
|
@ -14,7 +14,9 @@ bool ModeCircle::init(bool ignore_checks)
|
||||||
|
|
||||||
// set speed and acceleration limits
|
// set speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_xy(wp_nav->get_default_speed_xy(), wp_nav->get_wp_acceleration());
|
pos_control->set_max_speed_accel_xy(wp_nav->get_default_speed_xy(), wp_nav->get_wp_acceleration());
|
||||||
|
pos_control->set_correction_speed_accel_xy(wp_nav->get_default_speed_xy(), wp_nav->get_wp_acceleration());
|
||||||
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
pos_control->set_correction_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
|
||||||
// initialise circle controller including setting the circle center based on vehicle speed
|
// initialise circle controller including setting the circle center based on vehicle speed
|
||||||
copter.circle_nav->init();
|
copter.circle_nav->init();
|
||||||
|
|
|
@ -90,6 +90,7 @@ bool ModeFlowHold::init(bool ignore_checks)
|
||||||
|
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
pos_control->set_correction_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!copter.pos_control->is_active_z()) {
|
if (!copter.pos_control->is_active_z()) {
|
||||||
|
|
|
@ -144,9 +144,11 @@ void ModeGuided::pva_control_start()
|
||||||
{
|
{
|
||||||
// initialise horizontal speed, acceleration
|
// initialise horizontal speed, acceleration
|
||||||
pos_control->set_max_speed_accel_xy(wp_nav->get_default_speed_xy(), wp_nav->get_wp_acceleration());
|
pos_control->set_max_speed_accel_xy(wp_nav->get_default_speed_xy(), wp_nav->get_wp_acceleration());
|
||||||
|
pos_control->set_correction_speed_accel_xy(wp_nav->get_default_speed_xy(), wp_nav->get_wp_acceleration());
|
||||||
|
|
||||||
// initialize vertical speeds and acceleration
|
// initialize vertical speeds and acceleration
|
||||||
pos_control->set_max_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
pos_control->set_max_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
||||||
|
pos_control->set_correction_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
||||||
|
|
||||||
// initialise velocity controller
|
// initialise velocity controller
|
||||||
pos_control->init_z_controller();
|
pos_control->init_z_controller();
|
||||||
|
@ -218,6 +220,7 @@ void ModeGuided::angle_control_start()
|
||||||
|
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
pos_control->set_max_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
||||||
|
pos_control->set_correction_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!pos_control->is_active_z()) {
|
if (!pos_control->is_active_z()) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ bool ModeLand::init(bool ignore_checks)
|
||||||
|
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
pos_control->set_max_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
||||||
|
pos_control->set_correction_speed_accel_z(wp_nav->get_default_speed_down(), wp_nav->get_default_speed_up(), wp_nav->get_accel_z());
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!pos_control->is_active_z()) {
|
if (!pos_control->is_active_z()) {
|
||||||
|
|
|
@ -30,6 +30,10 @@ bool ModeLoiter::init(bool ignore_checks)
|
||||||
pos_control->init_z_controller();
|
pos_control->init_z_controller();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set vertical speed and acceleration limits
|
||||||
|
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
pos_control->set_correction_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ bool ModePosHold::init(bool ignore_checks)
|
||||||
{
|
{
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
pos_control->set_correction_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!pos_control->is_active_z()) {
|
if (!pos_control->is_active_z()) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ bool ModeSport::init(bool ignore_checks)
|
||||||
{
|
{
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
pos_control->set_correction_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!pos_control->is_active_z()) {
|
if (!pos_control->is_active_z()) {
|
||||||
|
|
|
@ -21,9 +21,11 @@ bool ModeThrow::init(bool ignore_checks)
|
||||||
|
|
||||||
// initialise pos controller speed and acceleration
|
// initialise pos controller speed and acceleration
|
||||||
pos_control->set_max_speed_accel_xy(wp_nav->get_default_speed_xy(), BRAKE_MODE_DECEL_RATE);
|
pos_control->set_max_speed_accel_xy(wp_nav->get_default_speed_xy(), BRAKE_MODE_DECEL_RATE);
|
||||||
|
pos_control->set_correction_speed_accel_xy(wp_nav->get_default_speed_xy(), BRAKE_MODE_DECEL_RATE);
|
||||||
|
|
||||||
// set vertical speed and acceleration limits
|
// set vertical speed and acceleration limits
|
||||||
pos_control->set_max_speed_accel_z(BRAKE_MODE_SPEED_Z, BRAKE_MODE_SPEED_Z, BRAKE_MODE_DECEL_RATE);
|
pos_control->set_max_speed_accel_z(BRAKE_MODE_SPEED_Z, BRAKE_MODE_SPEED_Z, BRAKE_MODE_DECEL_RATE);
|
||||||
|
pos_control->set_correction_speed_accel_z(BRAKE_MODE_SPEED_Z, BRAKE_MODE_SPEED_Z, BRAKE_MODE_DECEL_RATE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,10 @@ bool ModeZigZag::init(bool ignore_checks)
|
||||||
}
|
}
|
||||||
loiter_nav->init_target();
|
loiter_nav->init_target();
|
||||||
|
|
||||||
|
// set vertical speed and acceleration limits
|
||||||
|
pos_control->set_max_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
pos_control->set_correction_speed_accel_z(-get_pilot_speed_dn(), g.pilot_speed_up, g.pilot_accel_z);
|
||||||
|
|
||||||
// initialise the vertical position controller
|
// initialise the vertical position controller
|
||||||
if (!pos_control->is_active_z()) {
|
if (!pos_control->is_active_z()) {
|
||||||
pos_control->init_z_controller();
|
pos_control->init_z_controller();
|
||||||
|
|
Loading…
Reference in New Issue