Path: blob/master/ArduPlane/AP_ExternalControl_Plane.cpp
9448 views
/*1external control library for plane2*/345#include "AP_ExternalControl_Plane.h"6#if AP_EXTERNAL_CONTROL_ENABLED78#include "Plane.h"910/*11Sets the target global position for a loiter point.12*/13bool AP_ExternalControl_Plane::set_global_position(const Location& loc)14{1516// set_target_location already checks if plane is ready for external control.17// It doesn't check if flying or armed, just that it's in guided mode.18return plane.set_target_location(loc);19}2021/*22Sets the target airspeed.23*/24bool AP_ExternalControl_Plane::set_airspeed(const float airspeed)25{26#if AP_PLANE_OFFBOARD_GUIDED_SLEW_ENABLED27// The command is only valid in guided mode.28if (plane.control_mode != &plane.mode_guided) {29return false;30}3132// Assume the user wanted maximum acceleration.33const float acc_instant = 0.0;34return plane.mode_guided.handle_change_airspeed(airspeed, acc_instant);35#else36return false;37#endif38}3940#endif // AP_EXTERNAL_CONTROL_ENABLED414243