Reserving IDs for Lumenier.
[ardupilot.git] / ArduCopter / mode_avoid_adsb.cpp
blobeeadb8eb9cd57a05cf4fae3526ca39fe54c206a4
1 #include "Copter.h"
3 /*
4 * control_avoid.cpp - init and run calls for AP_Avoidance's AVOID flight mode
6 * This re-uses GUIDED mode functions but does not interfere with the GCS or companion computer's
7 * use of guided mode because the velocity requests arrive from different sources (i.e MAVLink messages
8 * for GCS and Companion Computers vs the AP_Avoidance_Copter class for adsb avoidance) and inputs from
9 * each source are only accepted and processed in the appropriate flight mode.
12 // initialise avoid_adsb controller
13 bool ModeAvoidADSB::init(const bool ignore_checks)
15 // re-use guided mode
16 return ModeGuided::init(ignore_checks);
19 bool ModeAvoidADSB::set_velocity(const Vector3f& velocity_neu)
21 // check flight mode
22 if (copter.flightmode->mode_number() != Mode::Number::AVOID_ADSB) {
23 return false;
26 // re-use guided mode's velocity controller
27 ModeGuided::set_velocity(velocity_neu);
28 return true;
31 // runs the AVOID_ADSB controller
32 void ModeAvoidADSB::run()
34 // re-use guided mode's velocity controller
35 // Note: this is safe from interference from GCSs and companion computer's whose guided mode
36 // position and velocity requests will be ignored while the vehicle is not in guided mode
37 ModeGuided::run();