Copter: leave old_loc check instead of changing alt frame.

This commit is contained in:
TsuyoshiKawamura 2024-01-27 21:43:27 +09:00 committed by Randy Mackay
parent 8346203d43
commit a95b5bc0dc
1 changed files with 6 additions and 4 deletions

View File

@ -457,11 +457,13 @@ bool Copter::get_target_location(Location& target_loc)
*/
bool Copter::update_target_location(const Location &old_loc, const Location &new_loc)
{
Location next_wp_loc;
next_wp_loc = new_loc;
next_wp_loc.change_alt_frame(old_loc.get_alt_frame());
Location next_WP_loc;
flightmode->get_wp(next_WP_loc);
if (!old_loc.same_loc_as(next_WP_loc)) {
return false;
}
return set_target_location(next_wp_loc);
return set_target_location(new_loc);
}
#endif // AP_SCRIPTING_ENABLED