@ -86,11 +86,11 @@ Standard::parameters_update()
@@ -86,11 +86,11 @@ Standard::parameters_update()
/* duration of a forwards transition to fw mode */
param_get ( _params_handles_standard . front_trans_dur , & v ) ;
_params_standard . front_trans_dur = math : : constrain ( v , 0.0f , 5 .0f) ;
_params_standard . front_trans_dur = math : : constrain ( v , 0.0f , 20 .0f) ;
/* duration of a back transition to mc mode */
param_get ( _params_handles_standard . back_trans_dur , & v ) ;
_params_standard . back_trans_dur = math : : constrain ( v , 0.0f , 5 .0f) ;
_params_standard . back_trans_dur = math : : constrain ( v , 0.0f , 20 .0f) ;
/* target throttle value for pusher motor during the transition to fw mode */
param_get ( _params_handles_standard . pusher_trans , & v ) ;
@ -315,9 +315,10 @@ void Standard::update_transition_state()
@@ -315,9 +315,10 @@ void Standard::update_transition_state()
_v_att_sp - > q_d_valid = true ;
// continually increase mc attitude control as we transition back to mc mode
if ( _params_standard . back_trans_dur > 0.0f ) {
float weight = ( float ) hrt_elapsed_time ( & _vtol_schedule . transition_start ) / ( _params_standard . back_trans_dur *
1000000.0f ) ;
if ( _params_standard . back_trans_dur > FLT_EPSILON ) {
float weight = ( float ) hrt_elapsed_time ( & _vtol_schedule . transition_start ) /
( ( _params_standard . back_trans_dur / 2 ) * 1000000.0f ) ;
weight = math : : constrain ( weight , 0.0f , 1.0f ) ;
_mc_roll_weight = weight ;
_mc_pitch_weight = weight ;
_mc_yaw_weight = weight ;
@ -451,15 +452,26 @@ void Standard::fill_actuator_outputs()
@@ -451,15 +452,26 @@ void Standard::fill_actuator_outputs()
// fixed wing controls
_actuators_out_1 - > timestamp = _actuators_fw_in - > timestamp ;
//roll
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_ROLL ] =
- _actuators_fw_in - > control [ actuator_controls_s : : INDEX_ROLL ] * ( 1 - _mc_roll_weight ) ;
//pitch
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_PITCH ] =
( _actuators_fw_in - > control [ actuator_controls_s : : INDEX_PITCH ] + _params - > fw_pitch_trim ) * ( 1 - _mc_pitch_weight ) ;
// yaw
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_YAW ] =
_actuators_fw_in - > control [ actuator_controls_s : : INDEX_YAW ] * ( 1 - _mc_yaw_weight ) ;
if ( _vtol_schedule . flight_mode ! = MC_MODE ) {
//roll
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_ROLL ] =
- _actuators_fw_in - > control [ actuator_controls_s : : INDEX_ROLL ] ;
//pitch
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_PITCH ] =
_actuators_fw_in - > control [ actuator_controls_s : : INDEX_PITCH ] + _params - > fw_pitch_trim ;
// yaw
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_YAW ] =
_actuators_fw_in - > control [ actuator_controls_s : : INDEX_YAW ] ;
} else {
// zero outputs when inactive
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_ROLL ] = 0.0f ;
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_PITCH ] = _params - > fw_pitch_trim ;
_actuators_out_1 - > control [ actuator_controls_s : : INDEX_YAW ] = 0.0f ;
}
// set the fixed wing throttle control
if ( _vtol_schedule . flight_mode = = FW_MODE & & _armed - > armed ) {