Rover: fix RTL when AP_RALLY disabled

This commit is contained in:
Randy Mackay 2018-08-30 10:14:31 +09:00
parent dd3163b065
commit 03e0437c19
2 changed files with 8 additions and 3 deletions

View File

@ -398,7 +398,6 @@ public:
protected:
bool _enter() override;
Location return_target;
};
class ModeSmartRTL : public Mode

View File

@ -10,9 +10,15 @@ bool ModeRTL::_enter()
// initialise waypoint speed
set_desired_speed_to_default(true);
return_target = rover.g2.rally.calc_best_rally_or_home_location(rover.current_loc, ahrs.get_home().alt);
// set target to the closest rally point or home
#if AP_RALLY == ENABLED
set_desired_location(rover.g2.rally.calc_best_rally_or_home_location(rover.current_loc, ahrs.get_home().alt));
#else
// set destination
set_desired_location(return_target);
set_desired_location(rover.home);
#endif
return true;
}