CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/ArduPlane/mode.h
Views: 1798
1
#pragma once
2
3
#include <AP_Param/AP_Param.h>
4
#include <AP_Common/Location.h>
5
#include <stdint.h>
6
#include <AP_Soaring/AP_Soaring.h>
7
#include <AP_ADSB/AP_ADSB.h>
8
#include <AP_Vehicle/ModeReason.h>
9
#include "quadplane.h"
10
#include <AP_AHRS/AP_AHRS.h>
11
#include <AP_Mission/AP_Mission.h>
12
#include "pullup.h"
13
14
#ifndef AP_QUICKTUNE_ENABLED
15
#define AP_QUICKTUNE_ENABLED HAL_QUADPLANE_ENABLED
16
#endif
17
18
#ifndef MODE_AUTOLAND_ENABLED
19
#define MODE_AUTOLAND_ENABLED 1
20
#endif
21
22
#include <AP_Quicktune/AP_Quicktune.h>
23
24
class AC_PosControl;
25
class AC_AttitudeControl_Multi;
26
class AC_Loiter;
27
class Mode
28
{
29
public:
30
31
/* Do not allow copies */
32
CLASS_NO_COPY(Mode);
33
34
// Auto Pilot modes
35
// ----------------
36
enum Number : uint8_t {
37
MANUAL = 0,
38
CIRCLE = 1,
39
STABILIZE = 2,
40
TRAINING = 3,
41
ACRO = 4,
42
FLY_BY_WIRE_A = 5,
43
FLY_BY_WIRE_B = 6,
44
CRUISE = 7,
45
AUTOTUNE = 8,
46
AUTO = 10,
47
RTL = 11,
48
LOITER = 12,
49
TAKEOFF = 13,
50
AVOID_ADSB = 14,
51
GUIDED = 15,
52
INITIALISING = 16,
53
#if HAL_QUADPLANE_ENABLED
54
QSTABILIZE = 17,
55
QHOVER = 18,
56
QLOITER = 19,
57
QLAND = 20,
58
QRTL = 21,
59
#if QAUTOTUNE_ENABLED
60
QAUTOTUNE = 22,
61
#endif
62
QACRO = 23,
63
#endif
64
THERMAL = 24,
65
#if HAL_QUADPLANE_ENABLED
66
LOITER_ALT_QLAND = 25,
67
#endif
68
#if MODE_AUTOLAND_ENABLED
69
AUTOLAND = 26,
70
#endif
71
72
// Mode number 30 reserved for "offboard" for external/lua control.
73
};
74
75
// Constructor
76
Mode();
77
78
// enter this mode, always returns true/success
79
bool enter();
80
81
// perform any cleanups required:
82
void exit();
83
84
// run controllers specific to this mode
85
virtual void run();
86
87
// returns a unique number specific to this mode
88
virtual Number mode_number() const = 0;
89
90
// returns full text name
91
virtual const char *name() const = 0;
92
93
// returns a string for this flightmode, exactly 4 bytes
94
virtual const char *name4() const = 0;
95
96
// returns true if the vehicle can be armed in this mode
97
bool pre_arm_checks(size_t buflen, char *buffer) const;
98
99
// Reset rate and steering and TECS controllers
100
void reset_controllers();
101
102
//
103
// methods that sub classes should override to affect movement of the vehicle in this mode
104
//
105
106
// convert user input to targets, implement high level control for this mode
107
virtual void update() = 0;
108
109
// true for all q modes
110
virtual bool is_vtol_mode() const { return false; }
111
virtual bool is_vtol_man_throttle() const;
112
virtual bool is_vtol_man_mode() const { return false; }
113
114
// guided or adsb mode
115
virtual bool is_guided_mode() const { return false; }
116
117
// true if mode can have terrain following disabled by switch
118
virtual bool allows_terrain_disable() const { return false; }
119
120
// true if automatic switch to thermal mode is supported.
121
virtual bool does_automatic_thermal_switch() const {return false; }
122
123
// subclasses override this if they require navigation.
124
virtual void navigate() { return; }
125
126
// this allows certain flight modes to mix RC input with throttle
127
// depending on airspeed_nudge_cm
128
virtual bool allows_throttle_nudging() const { return false; }
129
130
// true if the mode sets the vehicle destination, which controls
131
// whether control input is ignored with STICK_MIXING=0
132
virtual bool does_auto_navigation() const { return false; }
133
134
// true if the mode sets the vehicle destination, which controls
135
// whether control input is ignored with STICK_MIXING=0
136
virtual bool does_auto_throttle() const { return false; }
137
138
// true if the mode supports autotuning (via switch for modes other
139
// that AUTOTUNE itself
140
virtual bool mode_allows_autotuning() const { return false; }
141
142
// method for mode specific target altitude profiles
143
virtual void update_target_altitude();
144
145
// handle a guided target request from GCS
146
virtual bool handle_guided_request(Location target_loc) { return false; }
147
148
// true if is landing
149
virtual bool is_landing() const { return false; }
150
151
// true if is taking
152
virtual bool is_taking_off() const;
153
154
// true if throttle min/max limits should be applied
155
virtual bool use_throttle_limits() const;
156
157
// true if voltage correction should be applied to throttle
158
virtual bool use_battery_compensation() const;
159
160
#if AP_QUICKTUNE_ENABLED
161
// does this mode support VTOL quicktune?
162
virtual bool supports_quicktune() const { return false; }
163
#endif
164
165
protected:
166
167
// subclasses override this to perform checks before entering the mode
168
virtual bool _enter() { return true; }
169
170
// subclasses override this to perform any required cleanup when exiting the mode
171
virtual void _exit() { return; }
172
173
// mode specific pre-arm checks
174
virtual bool _pre_arm_checks(size_t buflen, char *buffer) const;
175
176
// Helper to output to both k_rudder and k_steering servo functions
177
void output_rudder_and_steering(float val);
178
179
// Output pilot throttle, this is used in stabilized modes without auto throttle control
180
void output_pilot_throttle();
181
182
// makes the initialiser list in the constructor manageable
183
uint8_t unused_integer;
184
185
#if HAL_QUADPLANE_ENABLED
186
// References for convenience, used by QModes
187
AC_PosControl*& pos_control;
188
AC_AttitudeControl_Multi*& attitude_control;
189
AC_Loiter*& loiter_nav;
190
QuadPlane& quadplane;
191
QuadPlane::PosControlState &poscontrol;
192
#endif
193
AP_AHRS& ahrs;
194
};
195
196
197
class ModeAcro : public Mode
198
{
199
friend class ModeQAcro;
200
public:
201
202
Mode::Number mode_number() const override { return Mode::Number::ACRO; }
203
const char *name() const override { return "ACRO"; }
204
const char *name4() const override { return "ACRO"; }
205
206
// methods that affect movement of the vehicle in this mode
207
void update() override;
208
209
void run() override;
210
211
void stabilize();
212
213
void stabilize_quaternion();
214
215
protected:
216
217
// ACRO controller state
218
struct {
219
bool locked_roll;
220
bool locked_pitch;
221
float locked_roll_err;
222
int32_t locked_pitch_cd;
223
Quaternion q;
224
bool roll_active_last;
225
bool pitch_active_last;
226
bool yaw_active_last;
227
} acro_state;
228
229
bool _enter() override;
230
};
231
232
class ModeAuto : public Mode
233
{
234
public:
235
friend class Plane;
236
237
Number mode_number() const override { return Number::AUTO; }
238
const char *name() const override { return "AUTO"; }
239
const char *name4() const override { return "AUTO"; }
240
241
bool does_automatic_thermal_switch() const override { return true; }
242
243
// methods that affect movement of the vehicle in this mode
244
void update() override;
245
246
void navigate() override;
247
248
bool allows_throttle_nudging() const override { return true; }
249
250
bool does_auto_navigation() const override;
251
252
bool does_auto_throttle() const override;
253
254
bool mode_allows_autotuning() const override { return true; }
255
256
bool is_landing() const override;
257
258
void do_nav_delay(const AP_Mission::Mission_Command& cmd);
259
bool verify_nav_delay(const AP_Mission::Mission_Command& cmd);
260
261
bool verify_altitude_wait(const AP_Mission::Mission_Command& cmd);
262
263
void run() override;
264
265
#if AP_PLANE_GLIDER_PULLUP_ENABLED
266
bool in_pullup() const { return pullup.in_pullup(); }
267
#endif
268
269
protected:
270
271
bool _enter() override;
272
void _exit() override;
273
bool _pre_arm_checks(size_t buflen, char *buffer) const override;
274
275
private:
276
277
// Delay the next navigation command
278
struct {
279
uint32_t time_max_ms;
280
uint32_t time_start_ms;
281
} nav_delay;
282
283
// wiggle state and timer for NAV_ALTITUDE_WAIT
284
void wiggle_servos();
285
struct {
286
uint8_t stage;
287
uint32_t last_ms;
288
} wiggle;
289
290
#if AP_PLANE_GLIDER_PULLUP_ENABLED
291
GliderPullup pullup;
292
#endif // AP_PLANE_GLIDER_PULLUP_ENABLED
293
};
294
295
296
class ModeAutoTune : public Mode
297
{
298
public:
299
300
Number mode_number() const override { return Number::AUTOTUNE; }
301
const char *name() const override { return "AUTOTUNE"; }
302
const char *name4() const override { return "ATUN"; }
303
304
// methods that affect movement of the vehicle in this mode
305
void update() override;
306
307
bool mode_allows_autotuning() const override { return true; }
308
309
void run() override;
310
311
protected:
312
313
bool _enter() override;
314
};
315
316
class ModeGuided : public Mode
317
{
318
public:
319
320
Number mode_number() const override { return Number::GUIDED; }
321
const char *name() const override { return "GUIDED"; }
322
const char *name4() const override { return "GUID"; }
323
324
// methods that affect movement of the vehicle in this mode
325
void update() override;
326
327
void navigate() override;
328
329
virtual bool is_guided_mode() const override { return true; }
330
331
bool allows_throttle_nudging() const override { return true; }
332
333
bool does_auto_navigation() const override { return true; }
334
335
bool does_auto_throttle() const override { return true; }
336
337
// handle a guided target request from GCS
338
bool handle_guided_request(Location target_loc) override;
339
340
void set_radius_and_direction(const float radius, const bool direction_is_ccw);
341
342
void update_target_altitude() override;
343
344
protected:
345
346
bool _enter() override;
347
bool _pre_arm_checks(size_t buflen, char *buffer) const override { return true; }
348
#if AP_QUICKTUNE_ENABLED
349
bool supports_quicktune() const override { return true; }
350
#endif
351
352
private:
353
float active_radius_m;
354
};
355
356
class ModeCircle: public Mode
357
{
358
public:
359
360
Number mode_number() const override { return Number::CIRCLE; }
361
const char *name() const override { return "CIRCLE"; }
362
const char *name4() const override { return "CIRC"; }
363
364
// methods that affect movement of the vehicle in this mode
365
void update() override;
366
367
bool does_auto_navigation() const override { return true; }
368
369
bool does_auto_throttle() const override { return true; }
370
371
protected:
372
373
bool _enter() override;
374
};
375
376
class ModeLoiter : public Mode
377
{
378
public:
379
380
Number mode_number() const override { return Number::LOITER; }
381
const char *name() const override { return "LOITER"; }
382
const char *name4() const override { return "LOIT"; }
383
384
// methods that affect movement of the vehicle in this mode
385
void update() override;
386
387
void navigate() override;
388
389
bool isHeadingLinedUp(const Location loiterCenterLoc, const Location targetLoc);
390
bool isHeadingLinedUp_cd(const int32_t bearing_cd, const int32_t heading_cd);
391
bool isHeadingLinedUp_cd(const int32_t bearing_cd);
392
393
bool allows_throttle_nudging() const override { return true; }
394
395
bool does_auto_navigation() const override { return true; }
396
397
bool does_auto_throttle() const override { return true; }
398
399
bool allows_terrain_disable() const override { return true; }
400
401
void update_target_altitude() override;
402
403
bool mode_allows_autotuning() const override { return true; }
404
405
protected:
406
407
bool _enter() override;
408
};
409
410
#if HAL_QUADPLANE_ENABLED
411
class ModeLoiterAltQLand : public ModeLoiter
412
{
413
public:
414
415
Number mode_number() const override { return Number::LOITER_ALT_QLAND; }
416
const char *name() const override { return "Loiter to QLAND"; }
417
const char *name4() const override { return "L2QL"; }
418
419
// handle a guided target request from GCS
420
bool handle_guided_request(Location target_loc) override;
421
422
protected:
423
bool _enter() override;
424
425
void navigate() override;
426
427
private:
428
void switch_qland();
429
430
};
431
#endif // HAL_QUADPLANE_ENABLED
432
433
class ModeManual : public Mode
434
{
435
public:
436
437
Number mode_number() const override { return Number::MANUAL; }
438
const char *name() const override { return "MANUAL"; }
439
const char *name4() const override { return "MANU"; }
440
441
// methods that affect movement of the vehicle in this mode
442
void update() override;
443
444
void run() override;
445
446
// true if throttle min/max limits should be applied
447
bool use_throttle_limits() const override;
448
449
// true if voltage correction should be applied to throttle
450
bool use_battery_compensation() const override { return false; }
451
452
};
453
454
455
class ModeRTL : public Mode
456
{
457
public:
458
459
Number mode_number() const override { return Number::RTL; }
460
const char *name() const override { return "RTL"; }
461
const char *name4() const override { return "RTL "; }
462
463
// methods that affect movement of the vehicle in this mode
464
void update() override;
465
466
void navigate() override;
467
468
bool allows_throttle_nudging() const override { return true; }
469
470
bool does_auto_navigation() const override { return true; }
471
472
bool does_auto_throttle() const override { return true; }
473
474
protected:
475
476
bool _enter() override;
477
bool _pre_arm_checks(size_t buflen, char *buffer) const override { return false; }
478
479
private:
480
481
// Switch to QRTL if enabled and within radius
482
bool switch_QRTL();
483
};
484
485
class ModeStabilize : public Mode
486
{
487
public:
488
489
Number mode_number() const override { return Number::STABILIZE; }
490
const char *name() const override { return "STABILIZE"; }
491
const char *name4() const override { return "STAB"; }
492
493
// methods that affect movement of the vehicle in this mode
494
void update() override;
495
496
void run() override;
497
498
private:
499
void stabilize_stick_mixing_direct();
500
501
};
502
503
class ModeTraining : public Mode
504
{
505
public:
506
507
Number mode_number() const override { return Number::TRAINING; }
508
const char *name() const override { return "TRAINING"; }
509
const char *name4() const override { return "TRAN"; }
510
511
// methods that affect movement of the vehicle in this mode
512
void update() override;
513
514
void run() override;
515
516
};
517
518
class ModeInitializing : public Mode
519
{
520
public:
521
522
Number mode_number() const override { return Number::INITIALISING; }
523
const char *name() const override { return "INITIALISING"; }
524
const char *name4() const override { return "INIT"; }
525
526
bool _enter() override { return false; }
527
528
// methods that affect movement of the vehicle in this mode
529
void update() override { }
530
531
bool allows_throttle_nudging() const override { return true; }
532
533
bool does_auto_throttle() const override { return true; }
534
535
protected:
536
bool _pre_arm_checks(size_t buflen, char *buffer) const override { return false; }
537
538
};
539
540
class ModeFBWA : public Mode
541
{
542
public:
543
544
Number mode_number() const override { return Number::FLY_BY_WIRE_A; }
545
const char *name() const override { return "FLY_BY_WIRE_A"; }
546
const char *name4() const override { return "FBWA"; }
547
548
// methods that affect movement of the vehicle in this mode
549
void update() override;
550
551
bool mode_allows_autotuning() const override { return true; }
552
553
void run() override;
554
555
};
556
557
class ModeFBWB : public Mode
558
{
559
public:
560
561
Number mode_number() const override { return Number::FLY_BY_WIRE_B; }
562
const char *name() const override { return "FLY_BY_WIRE_B"; }
563
const char *name4() const override { return "FBWB"; }
564
565
bool allows_terrain_disable() const override { return true; }
566
567
bool does_automatic_thermal_switch() const override { return true; }
568
569
// methods that affect movement of the vehicle in this mode
570
void update() override;
571
572
bool does_auto_throttle() const override { return true; }
573
574
bool mode_allows_autotuning() const override { return true; }
575
576
void update_target_altitude() override {};
577
578
protected:
579
580
bool _enter() override;
581
};
582
583
class ModeCruise : public Mode
584
{
585
public:
586
587
Number mode_number() const override { return Number::CRUISE; }
588
const char *name() const override { return "CRUISE"; }
589
const char *name4() const override { return "CRUS"; }
590
591
bool allows_terrain_disable() const override { return true; }
592
593
bool does_automatic_thermal_switch() const override { return true; }
594
595
// methods that affect movement of the vehicle in this mode
596
void update() override;
597
598
void navigate() override;
599
600
bool get_target_heading_cd(int32_t &target_heading) const;
601
602
bool does_auto_throttle() const override { return true; }
603
604
void update_target_altitude() override {};
605
606
protected:
607
608
bool _enter() override;
609
610
bool locked_heading;
611
int32_t locked_heading_cd;
612
uint32_t lock_timer_ms;
613
};
614
615
#if HAL_ADSB_ENABLED
616
class ModeAvoidADSB : public Mode
617
{
618
public:
619
620
Number mode_number() const override { return Number::AVOID_ADSB; }
621
const char *name() const override { return "AVOID_ADSB"; }
622
const char *name4() const override { return "AVOI"; }
623
624
// methods that affect movement of the vehicle in this mode
625
void update() override;
626
627
void navigate() override;
628
629
virtual bool is_guided_mode() const override { return true; }
630
631
bool does_auto_throttle() const override { return true; }
632
633
protected:
634
635
bool _enter() override;
636
};
637
#endif
638
639
#if HAL_QUADPLANE_ENABLED
640
class ModeQStabilize : public Mode
641
{
642
public:
643
644
Number mode_number() const override { return Number::QSTABILIZE; }
645
const char *name() const override { return "QSTABILIZE"; }
646
const char *name4() const override { return "QSTB"; }
647
648
bool is_vtol_mode() const override { return true; }
649
bool is_vtol_man_throttle() const override { return true; }
650
virtual bool is_vtol_man_mode() const override { return true; }
651
bool allows_throttle_nudging() const override { return true; }
652
653
// methods that affect movement of the vehicle in this mode
654
void update() override;
655
656
// used as a base class for all Q modes
657
bool _enter() override;
658
659
void run() override;
660
661
protected:
662
private:
663
664
void set_tailsitter_roll_pitch(const float roll_input, const float pitch_input);
665
void set_limited_roll_pitch(const float roll_input, const float pitch_input);
666
667
};
668
669
class ModeQHover : public Mode
670
{
671
public:
672
673
Number mode_number() const override { return Number::QHOVER; }
674
const char *name() const override { return "QHOVER"; }
675
const char *name4() const override { return "QHOV"; }
676
677
bool is_vtol_mode() const override { return true; }
678
virtual bool is_vtol_man_mode() const override { return true; }
679
680
// methods that affect movement of the vehicle in this mode
681
void update() override;
682
683
void run() override;
684
685
protected:
686
687
bool _enter() override;
688
#if AP_QUICKTUNE_ENABLED
689
bool supports_quicktune() const override { return true; }
690
#endif
691
};
692
693
class ModeQLoiter : public Mode
694
{
695
friend class QuadPlane;
696
friend class ModeQLand;
697
friend class Plane;
698
699
public:
700
701
Number mode_number() const override { return Number::QLOITER; }
702
const char *name() const override { return "QLOITER"; }
703
const char *name4() const override { return "QLOT"; }
704
705
bool is_vtol_mode() const override { return true; }
706
virtual bool is_vtol_man_mode() const override { return true; }
707
708
// methods that affect movement of the vehicle in this mode
709
void update() override;
710
711
void run() override;
712
713
protected:
714
715
bool _enter() override;
716
uint32_t last_target_loc_set_ms;
717
718
#if AP_QUICKTUNE_ENABLED
719
bool supports_quicktune() const override { return true; }
720
#endif
721
};
722
723
class ModeQLand : public Mode
724
{
725
public:
726
Number mode_number() const override { return Number::QLAND; }
727
const char *name() const override { return "QLAND"; }
728
const char *name4() const override { return "QLND"; }
729
730
bool is_vtol_mode() const override { return true; }
731
732
// methods that affect movement of the vehicle in this mode
733
void update() override;
734
735
void run() override;
736
737
protected:
738
739
bool _enter() override;
740
bool _pre_arm_checks(size_t buflen, char *buffer) const override { return false; }
741
};
742
743
class ModeQRTL : public Mode
744
{
745
public:
746
747
Number mode_number() const override { return Number::QRTL; }
748
const char *name() const override { return "QRTL"; }
749
const char *name4() const override { return "QRTL"; }
750
751
bool is_vtol_mode() const override { return true; }
752
753
// methods that affect movement of the vehicle in this mode
754
void update() override;
755
756
void run() override;
757
758
bool does_auto_throttle() const override { return true; }
759
760
void update_target_altitude() override;
761
762
bool allows_throttle_nudging() const override;
763
764
float get_VTOL_return_radius() const;
765
766
protected:
767
768
bool _enter() override;
769
bool _pre_arm_checks(size_t buflen, char *buffer) const override { return false; }
770
771
private:
772
773
enum class SubMode {
774
climb,
775
RTL,
776
} submode;
777
};
778
779
class ModeQAcro : public Mode
780
{
781
public:
782
783
Number mode_number() const override { return Number::QACRO; }
784
const char *name() const override { return "QACRO"; }
785
const char *name4() const override { return "QACO"; }
786
787
bool is_vtol_mode() const override { return true; }
788
bool is_vtol_man_throttle() const override { return true; }
789
virtual bool is_vtol_man_mode() const override { return true; }
790
791
// methods that affect movement of the vehicle in this mode
792
void update() override;
793
794
void run() override;
795
796
protected:
797
798
bool _enter() override;
799
};
800
801
#if QAUTOTUNE_ENABLED
802
class ModeQAutotune : public Mode
803
{
804
public:
805
806
Number mode_number() const override { return Number::QAUTOTUNE; }
807
const char *name() const override { return "QAUTOTUNE"; }
808
const char *name4() const override { return "QATN"; }
809
810
bool is_vtol_mode() const override { return true; }
811
virtual bool is_vtol_man_mode() const override { return true; }
812
813
void run() override;
814
815
// methods that affect movement of the vehicle in this mode
816
void update() override;
817
818
protected:
819
820
bool _enter() override;
821
void _exit() override;
822
};
823
#endif // QAUTOTUNE_ENABLED
824
825
#endif // HAL_QUADPLANE_ENABLED
826
827
class ModeTakeoff: public Mode
828
{
829
public:
830
ModeTakeoff();
831
832
Number mode_number() const override { return Number::TAKEOFF; }
833
const char *name() const override { return "TAKEOFF"; }
834
const char *name4() const override { return "TKOF"; }
835
836
// methods that affect movement of the vehicle in this mode
837
void update() override;
838
839
void navigate() override;
840
841
bool allows_throttle_nudging() const override { return true; }
842
843
bool does_auto_navigation() const override { return true; }
844
845
bool does_auto_throttle() const override { return true; }
846
847
// var_info for holding parameter information
848
static const struct AP_Param::GroupInfo var_info[];
849
850
AP_Int16 target_alt;
851
AP_Int16 level_alt;
852
AP_Float ground_pitch;
853
854
protected:
855
AP_Int16 target_dist;
856
AP_Int8 level_pitch;
857
858
bool takeoff_mode_setup;
859
Location start_loc;
860
861
bool _enter() override;
862
863
private:
864
865
// flag that we have already called autoenable fences once in MODE TAKEOFF
866
bool have_autoenabled_fences;
867
868
};
869
#if MODE_AUTOLAND_ENABLED
870
class ModeAutoLand: public Mode
871
{
872
public:
873
ModeAutoLand();
874
875
Number mode_number() const override { return Number::AUTOLAND; }
876
const char *name() const override { return "AUTOLAND"; }
877
const char *name4() const override { return "ALND"; }
878
879
// methods that affect movement of the vehicle in this mode
880
void update() override;
881
882
void navigate() override;
883
884
bool allows_throttle_nudging() const override { return true; }
885
886
bool does_auto_navigation() const override { return true; }
887
888
bool does_auto_throttle() const override { return true; }
889
890
891
// var_info for holding parameter information
892
static const struct AP_Param::GroupInfo var_info[];
893
894
AP_Int16 final_wp_alt;
895
AP_Int16 final_wp_dist;
896
AP_Int16 landing_dir_off;
897
898
protected:
899
bool _enter() override;
900
AP_Mission::Mission_Command cmd[3];
901
uint8_t stage;
902
};
903
#endif
904
#if HAL_SOARING_ENABLED
905
906
class ModeThermal: public Mode
907
{
908
public:
909
910
Number mode_number() const override { return Number::THERMAL; }
911
const char *name() const override { return "THERMAL"; }
912
const char *name4() const override { return "THML"; }
913
914
// methods that affect movement of the vehicle in this mode
915
void update() override;
916
917
// Update thermal tracking and exiting logic.
918
void update_soaring();
919
920
void navigate() override;
921
922
bool allows_throttle_nudging() const override { return true; }
923
924
bool does_auto_navigation() const override { return true; }
925
926
// true if we are in an auto-throttle mode, which means
927
// we need to run the speed/height controller
928
bool does_auto_throttle() const override { return true; }
929
930
protected:
931
932
bool exit_heading_aligned() const;
933
void restore_mode(const char *reason, ModeReason modereason);
934
935
bool _enter() override;
936
};
937
938
#endif
939
940