Ardupilot2/ArduPlane/mode_acro.cpp
Peter Barker a1ea1306a1 Plane: use pure-virtual method for allows_throttle_nudging
In place of a state variable which could become stale
2021-01-10 16:04:30 +11:00

29 lines
665 B
C++

#include "mode.h"
#include "Plane.h"
bool ModeAcro::_enter()
{
plane.auto_throttle_mode = false;
plane.auto_navigation_mode = false;
plane.acro_state.locked_roll = false;
plane.acro_state.locked_pitch = false;
return true;
}
void ModeAcro::update()
{
// handle locked/unlocked control
if (plane.acro_state.locked_roll) {
plane.nav_roll_cd = plane.acro_state.locked_roll_err;
} else {
plane.nav_roll_cd = plane.ahrs.roll_sensor;
}
if (plane.acro_state.locked_pitch) {
plane.nav_pitch_cd = plane.acro_state.locked_pitch_cd;
} else {
plane.nav_pitch_cd = plane.ahrs.pitch_sensor;
}
}