Copter: auto loiter initialisation simplified

The simpler set_wp_destination can be used instead of set_wp_origin_and_destination
This commit is contained in:
Randy Mackay 2017-04-27 15:55:13 +09:00
parent 65e97a9503
commit aab27d8d0e

View File

@ -538,15 +538,12 @@ bool Copter::auto_loiter_start()
}
auto_mode = Auto_Loiter;
Vector3f origin = inertial_nav.get_position();
// calculate stopping point
Vector3f stopping_point;
pos_control->get_stopping_point_xy(stopping_point);
pos_control->get_stopping_point_z(stopping_point);
wp_nav->get_wp_stopping_point(stopping_point);
// initialise waypoint controller target to stopping point
wp_nav->set_wp_origin_and_destination(origin, stopping_point);
wp_nav->set_wp_destination(stopping_point);
// hold yaw at current heading
set_auto_yaw_mode(AUTO_YAW_HOLD);