|
|
|
@ -257,6 +257,63 @@ uint16_t AP_MotorsHeli_Single::get_motor_mask()
@@ -257,6 +257,63 @@ uint16_t AP_MotorsHeli_Single::get_motor_mask()
|
|
|
|
|
// sends commands to the motors
|
|
|
|
|
void AP_MotorsHeli_Single::output_armed_stabilizing() |
|
|
|
|
{ |
|
|
|
|
// if manual override active after arming, deactivate it.
|
|
|
|
|
if (_servo_manual == 1) { |
|
|
|
|
reset_radio_passthrough(); |
|
|
|
|
_servo_manual = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
move_swash(_roll_control_input, _pitch_control_input, _throttle_control_input, _yaw_control_input); |
|
|
|
|
|
|
|
|
|
if (_tail_type == AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH) { |
|
|
|
|
_tail_rotor.output_armed(); |
|
|
|
|
|
|
|
|
|
if (!_tail_rotor.is_runup_complete()) |
|
|
|
|
{ |
|
|
|
|
_heliflags.rotor_runup_complete = false; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_main_rotor.output_armed(); |
|
|
|
|
|
|
|
|
|
_heliflags.rotor_runup_complete = _main_rotor.is_runup_complete(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AP_MotorsHeli_Single::output_armed_not_stabilizing() |
|
|
|
|
{ |
|
|
|
|
// if manual override active after arming, deactivate it.
|
|
|
|
|
if (_servo_manual == 1) { |
|
|
|
|
reset_radio_passthrough(); |
|
|
|
|
_servo_manual = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
move_swash(_roll_control_input, _pitch_control_input, _throttle_control_input, _yaw_control_input); |
|
|
|
|
|
|
|
|
|
if (_tail_type == AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH) { |
|
|
|
|
_tail_rotor.output_armed(); |
|
|
|
|
|
|
|
|
|
if (!_tail_rotor.is_runup_complete()) |
|
|
|
|
{ |
|
|
|
|
_heliflags.rotor_runup_complete = false; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_main_rotor.output_armed(); |
|
|
|
|
|
|
|
|
|
_heliflags.rotor_runup_complete = _main_rotor.is_runup_complete(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// output_armed_zero_throttle - sends commands to the motors
|
|
|
|
|
void AP_MotorsHeli_Single::output_armed_zero_throttle() |
|
|
|
|
{ |
|
|
|
|
// if manual override active after arming, deactivate it.
|
|
|
|
|
if (_servo_manual == 1) { |
|
|
|
|
reset_radio_passthrough(); |
|
|
|
|
_servo_manual = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
move_swash(_roll_control_input, _pitch_control_input, _throttle_control_input, _yaw_control_input); |
|
|
|
|
|
|
|
|
|
if (_tail_type == AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH) { |
|
|
|
@ -274,9 +331,18 @@ void AP_MotorsHeli_Single::output_armed_stabilizing()
@@ -274,9 +331,18 @@ void AP_MotorsHeli_Single::output_armed_stabilizing()
|
|
|
|
|
_heliflags.rotor_runup_complete = _main_rotor.is_runup_complete(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// output_disarmed - sends commands to the motors
|
|
|
|
|
void AP_MotorsHeli_Single::output_disarmed() |
|
|
|
|
{ |
|
|
|
|
// if manual override (i.e. when setting up swash), pass pilot commands straight through to swash
|
|
|
|
|
if (_servo_manual == 1) { |
|
|
|
|
_roll_control_input = _roll_radio_passthrough; |
|
|
|
|
_pitch_control_input = _pitch_radio_passthrough; |
|
|
|
|
_throttle_control_input = _throttle_radio_passthrough; |
|
|
|
|
_yaw_control_input = _yaw_radio_passthrough; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
move_swash(_roll_control_input, _pitch_control_input, _throttle_control_input, _yaw_control_input); |
|
|
|
|
|
|
|
|
|
if (_tail_type == AP_MOTORS_HELI_SINGLE_TAILTYPE_DIRECTDRIVE_VARPITCH) { |
|
|
|
@ -355,14 +421,6 @@ void AP_MotorsHeli_Single::calculate_roll_pitch_collective_factors()
@@ -355,14 +421,6 @@ void AP_MotorsHeli_Single::calculate_roll_pitch_collective_factors()
|
|
|
|
|
//
|
|
|
|
|
void AP_MotorsHeli_Single::move_swash(int16_t roll_out, int16_t pitch_out, int16_t coll_in, int16_t yaw_out) |
|
|
|
|
{ |
|
|
|
|
// if manual override (i.e. when setting up swash), pass pilot commands straight through to swash
|
|
|
|
|
if (_servo_manual == 1) { |
|
|
|
|
_roll_control_input = _roll_radio_passthrough; |
|
|
|
|
_pitch_control_input = _pitch_radio_passthrough; |
|
|
|
|
_throttle_control_input = _throttle_radio_passthrough; |
|
|
|
|
_yaw_control_input = _yaw_radio_passthrough; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int16_t yaw_offset = 0; |
|
|
|
|
int16_t coll_out_scaled; |
|
|
|
|
|
|
|
|
|