diff --git a/APMrover2/mode.h b/APMrover2/mode.h index 631d06408e..1ab5836aa8 100644 --- a/APMrover2/mode.h +++ b/APMrover2/mode.h @@ -630,6 +630,7 @@ public: protected: bool _enter() override; + void _exit() override; }; class ModeSimple : public Mode diff --git a/APMrover2/mode_follow.cpp b/APMrover2/mode_follow.cpp index 72e9a3e9d9..1ca8949e08 100644 --- a/APMrover2/mode_follow.cpp +++ b/APMrover2/mode_follow.cpp @@ -14,6 +14,12 @@ bool ModeFollow::_enter() return true; } +// exit handling +void ModeFollow::_exit() +{ + g2.follow.clear_offsets_if_required(); +} + void ModeFollow::update() { // stop vehicle if no speed estimate