Browse Source

Copter: init vert speed and accel for each flight mode

This resolves issue #1021 in which LAND mode could descend at the
PILOT_VELZ rate instead of the WPNAV_SPEED_DN

Pilot defined acceleration is used for AltHold, AutoTune , Circle,
Hybrid, Loiter, OF_Loiter and Sport flight modes
Waypoint Nav (ie. AutoPilot) acceleration is used for Auto, Land, RTL
master
Randy Mackay 11 years ago
parent
commit
7d7a2aced7
  1. 1
      ArduCopter/control_althold.pde
  2. 5
      ArduCopter/control_autotune.pde
  3. 5
      ArduCopter/control_circle.pde
  4. 1
      ArduCopter/control_hybrid.pde
  5. 4
      ArduCopter/control_land.pde
  6. 3
      ArduCopter/control_loiter.pde
  7. 7
      ArduCopter/control_ofloiter.pde
  8. 7
      ArduCopter/control_sport.pde

1
ArduCopter/control_althold.pde

@ -12,6 +12,7 @@ static bool althold_init(bool ignore_checks) @@ -12,6 +12,7 @@ static bool althold_init(bool ignore_checks)
// initialize vertical speeds and leash lengths
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
return true;
}

5
ArduCopter/control_autotune.pde

@ -194,6 +194,11 @@ static bool autotune_init(bool ignore_checks) @@ -194,6 +194,11 @@ static bool autotune_init(bool ignore_checks)
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialize vertical speeds and leash lengths
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
return true;
}

5
ArduCopter/control_circle.pde

@ -10,6 +10,11 @@ static bool circle_init(bool ignore_checks) @@ -10,6 +10,11 @@ static bool circle_init(bool ignore_checks)
if ((GPS_ok() && inertial_nav.position_ok()) || ignore_checks) {
circle_pilot_yaw_override = false;
circle_nav.init();
// initialize vertical speeds and leash lengths
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
return true;
}else{
return false;

1
ArduCopter/control_hybrid.pde

@ -106,6 +106,7 @@ static bool hybrid_init(bool ignore_checks) @@ -106,6 +106,7 @@ static bool hybrid_init(bool ignore_checks)
// initialize vertical speeds and leash lengths
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise lean angles to current attitude
hybrid.pilot_roll = 0;

4
ArduCopter/control_land.pde

@ -18,6 +18,10 @@ static bool land_init(bool ignore_checks) @@ -18,6 +18,10 @@ static bool land_init(bool ignore_checks)
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialize vertical speeds and leash lengths
pos_control.set_speed_z(wp_nav.get_speed_down(), wp_nav.get_speed_up());
pos_control.set_accel_z(wp_nav.get_accel_z());
return true;
}

3
ArduCopter/control_loiter.pde

@ -12,8 +12,9 @@ static bool loiter_init(bool ignore_checks) @@ -12,8 +12,9 @@ static bool loiter_init(bool ignore_checks)
// set target to current position
wp_nav.init_loiter_target();
// initialize vertical speeds
// initialize vertical speed and accelerationj
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();

7
ArduCopter/control_ofloiter.pde

@ -9,6 +9,13 @@ static bool ofloiter_init(bool ignore_checks) @@ -9,6 +9,13 @@ static bool ofloiter_init(bool ignore_checks)
{
#if OPTFLOW == ENABLED
if (g.optflow_enabled || ignore_checks) {
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
// initialize vertical speed and acceleration
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
return true;
}else{
return false;

7
ArduCopter/control_sport.pde

@ -7,6 +7,13 @@ @@ -7,6 +7,13 @@
// sport_init - initialise sport controller
static bool sport_init(bool ignore_checks)
{
// initialize vertical speed and accelerationj
pos_control.set_speed_z(-g.pilot_velocity_z_max, g.pilot_velocity_z_max);
pos_control.set_accel_z(g.pilot_accel_z);
// initialise altitude target to stopping point
pos_control.set_target_to_stopping_point_z();
return true;
}

Loading…
Cancel
Save