@@ -67,20 +67,16 @@ ModeZigZag::ModeZigZag(void) : Mode()
67
67
// initialise zigzag controller
68
68
bool ModeZigZag::init (bool ignore_checks)
69
69
{
70
- if (!copter.failsafe .radio ) {
71
- // apply simple mode transform to pilot inputs
72
- update_simple_mode ();
70
+ // apply simple mode transform to pilot inputs
71
+ update_simple_mode ();
73
72
74
- // convert pilot input to lean angles
75
- float target_roll, target_pitch;
76
- get_pilot_desired_lean_angles (target_roll, target_pitch, loiter_nav->get_angle_max_cd (), attitude_control->get_althold_lean_angle_max_cd ());
73
+ // convert pilot input to lean angles
74
+ float target_roll, target_pitch;
75
+ get_pilot_desired_lean_angles (target_roll, target_pitch, loiter_nav->get_angle_max_cd (), attitude_control->get_althold_lean_angle_max_cd ());
76
+
77
+ // process pilot's roll and pitch input
78
+ loiter_nav->set_pilot_desired_acceleration_cd (target_roll, target_pitch);
77
79
78
- // process pilot's roll and pitch input
79
- loiter_nav->set_pilot_desired_acceleration_cd (target_roll, target_pitch);
80
- } else {
81
- // clear out pilot desired acceleration in case radio failsafe event occurs and we do not switch to RTL for some reason
82
- loiter_nav->clear_pilot_desired_acceleration ();
83
- }
84
80
loiter_nav->init_target ();
85
81
86
82
// set vertical speed and acceleration limits
@@ -261,11 +257,7 @@ void ModeZigZag::return_to_manual_control(bool maintain_target)
261
257
void ModeZigZag::auto_control ()
262
258
{
263
259
// process pilot's yaw input
264
- float target_yaw_rate = 0 ;
265
- if (!copter.failsafe .radio ) {
266
- // get pilot's desired yaw rate
267
- target_yaw_rate = get_pilot_desired_yaw_rate ();
268
- }
260
+ const float target_yaw_rate = get_pilot_desired_yaw_rate ();
269
261
270
262
// set motors to full range
271
263
motors->set_desired_spool_state (AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
@@ -294,28 +286,24 @@ void ModeZigZag::manual_control()
294
286
float target_climb_rate = 0 .0f ;
295
287
296
288
// process pilot inputs unless we are in radio failsafe
297
- if (!copter.failsafe .radio ) {
298
- float target_roll, target_pitch;
299
- // apply SIMPLE mode transform to pilot inputs
300
- update_simple_mode ();
301
-
302
- // convert pilot input to lean angles
303
- get_pilot_desired_lean_angles (target_roll, target_pitch, loiter_nav->get_angle_max_cd (), attitude_control->get_althold_lean_angle_max_cd ());
304
-
305
- // process pilot's roll and pitch input
306
- loiter_nav->set_pilot_desired_acceleration_cd (target_roll, target_pitch);
307
- // get pilot's desired yaw rate
308
- target_yaw_rate = get_pilot_desired_yaw_rate ();
309
-
310
- // get pilot desired climb rate
311
- target_climb_rate = get_pilot_desired_climb_rate ();
312
- // make sure the climb rate is in the given range, prevent floating point errors
313
- target_climb_rate = constrain_float (target_climb_rate, -get_pilot_speed_dn (), g.pilot_speed_up );
314
- } else {
315
- // clear out pilot desired acceleration in case radio failsafe event occurs and we
316
- // do not switch to RTL for some reason
317
- loiter_nav->clear_pilot_desired_acceleration ();
318
- }
289
+ float target_roll, target_pitch;
290
+
291
+ // apply SIMPLE mode transform to pilot inputs
292
+ update_simple_mode ();
293
+
294
+ // convert pilot input to lean angles
295
+ get_pilot_desired_lean_angles (target_roll, target_pitch, loiter_nav->get_angle_max_cd (), attitude_control->get_althold_lean_angle_max_cd ());
296
+
297
+ // process pilot's roll and pitch input
298
+ loiter_nav->set_pilot_desired_acceleration_cd (target_roll, target_pitch);
299
+
300
+ // get pilot's desired yaw rate
301
+ target_yaw_rate = get_pilot_desired_yaw_rate ();
302
+
303
+ // get pilot desired climb rate
304
+ target_climb_rate = get_pilot_desired_climb_rate ();
305
+ // make sure the climb rate is in the given range, prevent floating point errors
306
+ target_climb_rate = constrain_float (target_climb_rate, -get_pilot_speed_dn (), g.pilot_speed_up );
319
307
320
308
// relax loiter target if we might be landed
321
309
if (copter.ap .land_complete_maybe ) {
0 commit comments