Skip to content

Commit

Permalink
Copter: change rotors turning on ground yaw behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
bnsgeyer committed Nov 18, 2024
1 parent 2feee53 commit bb4fd41
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions ArduCopter/mode_acro_heli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void ModeAcro_Heli::run()
break;
case AP_Motors::SpoolState::THROTTLE_UNLIMITED:
if (copter.ap.land_complete && !motors->using_leaky_integrator()) {
attitude_control->reset_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
}
break;
Expand Down
4 changes: 2 additions & 2 deletions ArduCopter/mode_althold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ void ModeAltHold::run()

case AltHoldModeState::MotorStopped:
attitude_control->reset_rate_controller_I_terms();
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_yaw_target_and_rate();
pos_control->relax_z_controller(0.0f); // forces throttle output to decay to zero
break;

case AltHoldModeState::Landed_Ground_Idle:
attitude_control->reset_yaw_target_and_rate();
FALLTHROUGH;

case AltHoldModeState::Landed_Pre_Takeoff:
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
pos_control->relax_z_controller(0.0f); // forces throttle output to decay to zero
break;
Expand Down
15 changes: 11 additions & 4 deletions ArduCopter/mode_drift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,27 @@ void ModeDrift::run()
switch (motors->get_spool_state()) {
case AP_Motors::SpoolState::SHUT_DOWN:
// Motors Stopped
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_yaw_target_and_rate();
attitude_control->reset_rate_controller_I_terms();
break;

case AP_Motors::SpoolState::GROUND_IDLE:
// Landed
attitude_control->reset_yaw_target_and_rate();
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
break;

case AP_Motors::SpoolState::THROTTLE_UNLIMITED:
// clear landing flag above zero throttle
if (!motors->limit.throttle_lower) {
set_land_complete(false);
if (!copter.is_tradheli()) {
if (!motors->limit.throttle_lower) {
set_land_complete(false);
}
} else {
if (copter.ap.land_complete && !motors->using_leaky_integrator()) {
attitude_control->reset_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
}
}
break;

Expand Down
2 changes: 1 addition & 1 deletion ArduCopter/mode_flowhold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ void ModeFlowHold::run()
break;

case AltHoldModeState::Landed_Ground_Idle:
attitude_control->reset_yaw_target_and_rate();
FALLTHROUGH;

case AltHoldModeState::Landed_Pre_Takeoff:
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
pos_control->relax_z_controller(0.0f); // forces throttle output to decay to zero
break;
Expand Down
2 changes: 1 addition & 1 deletion ArduCopter/mode_loiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ void ModeLoiter::run()
break;

case AltHoldModeState::Landed_Ground_Idle:
attitude_control->reset_yaw_target_and_rate();
FALLTHROUGH;

case AltHoldModeState::Landed_Pre_Takeoff:
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
loiter_nav->init_target();
attitude_control->input_thrust_vector_rate_heading(loiter_nav->get_thrust_vector(), target_yaw_rate, false);
Expand Down
8 changes: 4 additions & 4 deletions ArduCopter/mode_poshold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ModePosHold::run()

case AltHoldModeState::MotorStopped:
attitude_control->reset_rate_controller_I_terms();
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_yaw_target_and_rate();
pos_control->relax_z_controller(0.0f); // forces throttle output to decay to zero
loiter_nav->clear_pilot_desired_acceleration();
loiter_nav->init_target();
Expand All @@ -116,15 +116,15 @@ void ModePosHold::run()
break;

case AltHoldModeState::Landed_Ground_Idle:
loiter_nav->clear_pilot_desired_acceleration();
loiter_nav->init_target();
attitude_control->reset_yaw_target_and_rate();
init_wind_comp_estimate();
FALLTHROUGH;

case AltHoldModeState::Landed_Pre_Takeoff:
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
pos_control->relax_z_controller(0.0f); // forces throttle output to decay to zero
loiter_nav->clear_pilot_desired_acceleration();
loiter_nav->init_target();

// set poshold state to pilot override
roll_mode = RPMode::PILOT_OVERRIDE;
Expand Down
4 changes: 2 additions & 2 deletions ArduCopter/mode_sport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ void ModeSport::run()

case AltHoldModeState::MotorStopped:
attitude_control->reset_rate_controller_I_terms();
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_yaw_target_and_rate();
pos_control->relax_z_controller(0.0f); // forces throttle output to decay to zero
break;

case AltHoldModeState::Landed_Ground_Idle:
attitude_control->reset_yaw_target_and_rate();
FALLTHROUGH;

case AltHoldModeState::Landed_Pre_Takeoff:
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
pos_control->relax_z_controller(0.0f); // forces throttle output to decay to zero
break;
Expand Down
1 change: 1 addition & 0 deletions ArduCopter/mode_stabilize_heli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void ModeStabilize_Heli::run()
break;
case AP_Motors::SpoolState::THROTTLE_UNLIMITED:
if (copter.ap.land_complete && !motors->using_leaky_integrator()) {
attitude_control->reset_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
}
break;
Expand Down
2 changes: 1 addition & 1 deletion ArduCopter/mode_zigzag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ void ModeZigZag::manual_control()
break;

case AltHoldModeState::Landed_Ground_Idle:
attitude_control->reset_yaw_target_and_rate();
FALLTHROUGH;

case AltHoldModeState::Landed_Pre_Takeoff:
attitude_control->reset_yaw_target_and_rate(false);
attitude_control->reset_rate_controller_I_terms_smoothly();
loiter_nav->init_target();
attitude_control->input_thrust_vector_rate_heading(loiter_nav->get_thrust_vector(), target_yaw_rate);
Expand Down

0 comments on commit bb4fd41

Please sign in to comment.