@@ -62,8 +62,6 @@ Standard::Standard(VtolAttitudeControl *attc) :
62
62
63
63
_params_handles_standard.pusher_ramp_dt = param_find (" VT_PSHER_RMP_DT" );
64
64
_params_handles_standard.back_trans_ramp = param_find (" VT_B_TRANS_RAMP" );
65
- _params_handles_standard.down_pitch_max = param_find (" VT_DWN_PITCH_MAX" );
66
- _params_handles_standard.forward_thrust_scale = param_find (" VT_FWD_THRUST_SC" );
67
65
_params_handles_standard.pitch_setpoint_offset = param_find (" FW_PSP_OFF" );
68
66
_params_handles_standard.reverse_output = param_find (" VT_B_REV_OUT" );
69
67
_params_handles_standard.reverse_delay = param_find (" VT_B_REV_DEL" );
@@ -84,13 +82,6 @@ Standard::parameters_update()
84
82
85
83
_airspeed_trans_blend_margin = _params->transition_airspeed - _params->airspeed_blend ;
86
84
87
- /* maximum down pitch allowed */
88
- param_get (_params_handles_standard.down_pitch_max , &v);
89
- _params_standard.down_pitch_max = math::radians (v);
90
-
91
- /* scale for fixed wing thrust used for forward acceleration in multirotor mode */
92
- param_get (_params_handles_standard.forward_thrust_scale , &_params_standard.forward_thrust_scale );
93
-
94
85
/* pitch setpoint offset */
95
86
param_get (_params_handles_standard.pitch_setpoint_offset , &v);
96
87
_params_standard.pitch_setpoint_offset = math::radians (v);
@@ -326,76 +317,9 @@ void Standard::update_mc_state()
326
317
{
327
318
VtolType::update_mc_state ();
328
319
329
- // if the thrust scale param is zero or the drone is on manual mode,
330
- // then the pusher-for-pitch strategy is disabled and we can return
331
- if (_params_standard.forward_thrust_scale < FLT_EPSILON ||
332
- !_v_control_mode->flag_control_position_enabled ) {
333
- return ;
334
- }
335
-
336
- // Do not engage pusher assist during a failsafe event
337
- // There could be a problem with the fixed wing drive
338
- if (_attc->get_vtol_vehicle_status ()->vtol_transition_failsafe ) {
339
- return ;
340
- }
341
-
342
- // disable pusher assist during landing
343
- if (_attc->get_pos_sp_triplet ()->current .valid
344
- && _attc->get_pos_sp_triplet ()->current .type == position_setpoint_s::SETPOINT_TYPE_LAND) {
345
- return ;
346
- }
347
-
348
- const Dcmf R (Quatf (_v_att->q ));
349
- const Dcmf R_sp (Quatf (_v_att_sp->q_d ));
350
- const Eulerf euler (R);
351
- const Eulerf euler_sp (R_sp);
352
- _pusher_throttle = 0 .0f ;
353
-
354
- // direction of desired body z axis represented in earth frame
355
- Vector3f body_z_sp (R_sp (0 , 2 ), R_sp (1 , 2 ), R_sp (2 , 2 ));
356
-
357
- // rotate desired body z axis into new frame which is rotated in z by the current
358
- // heading of the vehicle. we refer to this as the heading frame.
359
- Dcmf R_yaw = Eulerf (0 .0f , 0 .0f , -euler (2 ));
360
- body_z_sp = R_yaw * body_z_sp;
361
- body_z_sp.normalize ();
362
-
363
- // calculate the desired pitch seen in the heading frame
364
- // this value corresponds to the amount the vehicle would try to pitch forward
365
- float pitch_forward = atan2f (body_z_sp (0 ), body_z_sp (2 ));
366
-
367
- // only allow pitching forward up to threshold, the rest of the desired
368
- // forward acceleration will be compensated by the pusher
369
- if (pitch_forward < -_params_standard.down_pitch_max ) {
370
- // desired roll angle in heading frame stays the same
371
- float roll_new = -asinf (body_z_sp (1 ));
372
-
373
- _pusher_throttle = (sinf (-pitch_forward) - sinf (_params_standard.down_pitch_max ))
374
- * _params_standard.forward_thrust_scale ;
375
-
376
- // return the vehicle to level position
377
- float pitch_new = 0 .0f ;
378
-
379
- // create corrected desired body z axis in heading frame
380
- const Dcmf R_tmp = Eulerf (roll_new, pitch_new, 0 .0f );
381
- Vector3f tilt_new (R_tmp (0 , 2 ), R_tmp (1 , 2 ), R_tmp (2 , 2 ));
382
-
383
- // rotate the vector into a new frame which is rotated in z by the desired heading
384
- // with respect to the earh frame.
385
- const float yaw_error = wrap_pi (euler_sp (2 ) - euler (2 ));
386
- const Dcmf R_yaw_correction = Eulerf (0 .0f , 0 .0f , -yaw_error);
387
- tilt_new = R_yaw_correction * tilt_new;
388
-
389
- // now extract roll and pitch setpoints
390
- _v_att_sp->pitch_body = atan2f (tilt_new (0 ), tilt_new (2 ));
391
- _v_att_sp->roll_body = -asinf (tilt_new (1 ));
392
-
393
- const Quatf q_sp (Eulerf (_v_att_sp->roll_body , _v_att_sp->pitch_body , euler_sp (2 )));
394
- q_sp.copyTo (_v_att_sp->q_d );
395
- _v_att_sp->q_d_valid = true ;
396
- }
320
+ VtolType::pusher_assist ();
397
321
398
- _pusher_throttle = _pusher_throttle < 0 . 0f ? 0 . 0f : _pusher_throttle ;
322
+ _pusher_throttle = _forward_thrust ;
399
323
}
400
324
401
325
void Standard::update_fw_state ()
0 commit comments