Copter: auto's wp_start accepts terrain alts

This commit is contained in:
Randy Mackay 2019-07-11 11:11:46 +09:00
parent ee079a50dc
commit b7a748df88
2 changed files with 4 additions and 4 deletions

View File

@ -313,7 +313,7 @@ public:
bool loiter_start(); bool loiter_start();
void rtl_start(); void rtl_start();
void takeoff_start(const Location& dest_loc); void takeoff_start(const Location& dest_loc);
void wp_start(const Vector3f& destination); void wp_start(const Vector3f& destination, bool terrain_alt);
void wp_start(const Location& dest_loc); void wp_start(const Location& dest_loc);
void land_start(); void land_start();
void land_start(const Vector3f& destination); void land_start(const Vector3f& destination);

View File

@ -189,12 +189,12 @@ void ModeAuto::takeoff_start(const Location& dest_loc)
} }
// auto_wp_start - initialises waypoint controller to implement flying to a particular destination // auto_wp_start - initialises waypoint controller to implement flying to a particular destination
void ModeAuto::wp_start(const Vector3f& destination) void ModeAuto::wp_start(const Vector3f& destination, bool terrain_alt)
{ {
_mode = Auto_WP; _mode = Auto_WP;
// initialise wpnav (no need to check return status because terrain data is not used) // initialise wpnav (no need to check return status because terrain data is not used)
wp_nav->set_wp_destination(destination, false); wp_nav->set_wp_destination(destination, terrain_alt);
// initialise yaw // initialise yaw
// To-Do: reset the yaw only when the previous navigation command is not a WP. this would allow removing the special check for ROI // To-Do: reset the yaw only when the previous navigation command is not a WP. this would allow removing the special check for ROI
@ -741,7 +741,7 @@ void ModeAuto::takeoff_run()
auto_takeoff_run(); auto_takeoff_run();
if (wp_nav->reached_wp_destination()) { if (wp_nav->reached_wp_destination()) {
const Vector3f target = wp_nav->get_wp_destination(); const Vector3f target = wp_nav->get_wp_destination();
wp_start(target); wp_start(target, wp_nav->origin_and_destination_are_terrain_alt());
} }
} }