|
|
|
@ -22,21 +22,6 @@ void Copter::ModeStabilize_Heli::run()
@@ -22,21 +22,6 @@ void Copter::ModeStabilize_Heli::run()
|
|
|
|
|
float target_yaw_rate; |
|
|
|
|
float pilot_throttle_scaled; |
|
|
|
|
|
|
|
|
|
// Tradheli should not reset roll, pitch, yaw targets when motors are not runup, because
|
|
|
|
|
// we may be in autorotation flight. These should be reset only when transitioning from disarmed
|
|
|
|
|
// to armed, because the pilot will have placed the helicopter down on the landing pad. This is so
|
|
|
|
|
// that the servos move in a realistic fashion while disarmed for operational checks.
|
|
|
|
|
// Also, unlike multicopters we do not set throttle (i.e. collective pitch) to zero so the swash servos move
|
|
|
|
|
|
|
|
|
|
if (motors->init_targets_on_arming()) { |
|
|
|
|
attitude_control->reset_rate_controller_I_terms(); |
|
|
|
|
attitude_control->set_yaw_target_to_current_heading(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// clear landing flag above zero throttle
|
|
|
|
|
if (motors->armed() && motors->get_interlock() && motors->rotor_runup_complete() && !ap.throttle_zero) { |
|
|
|
|
set_land_complete(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
motors->set_desired_spool_state(AP_Motors::DESIRED_THROTTLE_UNLIMITED); |
|
|
|
|
|
|
|
|
@ -52,6 +37,36 @@ void Copter::ModeStabilize_Heli::run()
@@ -52,6 +37,36 @@ void Copter::ModeStabilize_Heli::run()
|
|
|
|
|
// get pilot's desired throttle
|
|
|
|
|
pilot_throttle_scaled = copter.input_manager.get_pilot_desired_collective(channel_throttle->get_control_in()); |
|
|
|
|
|
|
|
|
|
// Tradheli should not reset roll, pitch, yaw targets when motors are not runup while flying, because
|
|
|
|
|
// we may be in autorotation flight. This is so that the servos move in a realistic fashion while disarmed
|
|
|
|
|
// for operational checks. Also, unlike multicopters we do not set throttle (i.e. collective pitch) to zero
|
|
|
|
|
// so the swash servos move.
|
|
|
|
|
|
|
|
|
|
if (!motors->armed()) { |
|
|
|
|
// Motors should be Stopped
|
|
|
|
|
motors->set_desired_spool_state(AP_Motors::DESIRED_SHUT_DOWN); |
|
|
|
|
} else { |
|
|
|
|
// heli will not let the spool state progress to THROTTLE_UNLIMITED until motor interlock is enabled
|
|
|
|
|
motors->set_desired_spool_state(AP_Motors::DESIRED_THROTTLE_UNLIMITED); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (motors->get_spool_mode() == AP_Motors::SHUT_DOWN) { |
|
|
|
|
// Motors Stopped
|
|
|
|
|
attitude_control->set_yaw_target_to_current_heading(); |
|
|
|
|
attitude_control->reset_rate_controller_I_terms(); |
|
|
|
|
} else if (motors->get_spool_mode() == AP_Motors::GROUND_IDLE) { |
|
|
|
|
// Landed
|
|
|
|
|
if (motors->init_targets_on_arming()) { |
|
|
|
|
attitude_control->set_yaw_target_to_current_heading(); |
|
|
|
|
attitude_control->reset_rate_controller_I_terms(); |
|
|
|
|
} |
|
|
|
|
} else if (motors->get_spool_mode() == AP_Motors::THROTTLE_UNLIMITED) { |
|
|
|
|
// clear landing flag above zero throttle
|
|
|
|
|
if (!motors->limit.throttle_lower) { |
|
|
|
|
set_land_complete(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// call attitude controller
|
|
|
|
|
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(target_roll, target_pitch, target_yaw_rate); |
|
|
|
|
|
|
|
|
|