aboutsummaryrefslogtreecommitdiff
path: root/src/modules/fixedwing_backside
diff options
context:
space:
mode:
authorJames Goppert <james.goppert@gmail.com>2013-11-14 15:24:34 -0500
committerJames Goppert <james.goppert@gmail.com>2013-11-14 15:24:34 -0500
commit2138a1c816e1856245bf9cb08dcd1304b1f827bb (patch)
tree368ffb58748e1a6b2c827a228a234cc6fb1a5fda /src/modules/fixedwing_backside
parentea156f556fe6815e01ea6973bb07de8299851c76 (diff)
downloadpx4-firmware-2138a1c816e1856245bf9cb08dcd1304b1f827bb.tar.gz
px4-firmware-2138a1c816e1856245bf9cb08dcd1304b1f827bb.tar.bz2
px4-firmware-2138a1c816e1856245bf9cb08dcd1304b1f827bb.zip
Improved mode mapping for fixedwing_backside.
Diffstat (limited to 'src/modules/fixedwing_backside')
-rw-r--r--src/modules/fixedwing_backside/fixedwing.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/modules/fixedwing_backside/fixedwing.cpp b/src/modules/fixedwing_backside/fixedwing.cpp
index d65045d68..dd067e5c4 100644
--- a/src/modules/fixedwing_backside/fixedwing.cpp
+++ b/src/modules/fixedwing_backside/fixedwing.cpp
@@ -156,7 +156,8 @@ void BlockMultiModeBacksideAutopilot::update()
_actuators.control[i] = 0.0f;
// only update guidance in auto mode
- if (_status.navigation_state == NAVIGATION_STATE_AUTO_MISSION) { // TODO use vehicle_control_mode here?
+ if (_status.main_state == MAIN_STATE_AUTO) {
+ // TODO use vehicle_control_mode here?
// update guidance
_guide.update(_pos, _att, _posCmd.current, _lastPosCmd.current);
}
@@ -166,14 +167,11 @@ void BlockMultiModeBacksideAutopilot::update()
// the setpoint should update to loitering around this position
// handle autopilot modes
- if (_status.navigation_state == NAVIGATION_STATE_AUTO_MISSION ||
- _status.navigation_state == NAVIGATION_STATE_STABILIZE) { // TODO use vehicle_control_mode here?
+ if (_status.main_state != MAIN_STATE_AUTO) {
- // update guidance
- _guide.update(_pos, _att, _posCmd.current, _lastPosCmd.current);
-
- // calculate velocity, XXX should be airspeed, but using ground speed for now
- // for the purpose of control we will limit the velocity feedback between
+ // calculate velocity, XXX should be airspeed,
+ // but using ground speed for now for the purpose
+ // of control we will limit the velocity feedback between
// the min/max velocity
float v = _vLimit.update(sqrtf(
_pos.vx * _pos.vx +
@@ -218,19 +216,22 @@ void BlockMultiModeBacksideAutopilot::update()
// a first binary release can be targeted.
// This is not a hack, but a design choice.
- /* do not limit in HIL */
+ // do not limit in HIL
if (_status.hil_state != HIL_STATE_ON) {
/* limit to value of manual throttle */
_actuators.control[CH_THR] = (_actuators.control[CH_THR] < _manual.throttle) ?
_actuators.control[CH_THR] : _manual.throttle;
}
- } else if (_status.navigation_state == NAVIGATION_STATE_DIRECT) { // TODO use vehicle_control_mode here?
+ } else if (_status.main_state == MAIN_STATE_MANUAL) {
_actuators.control[CH_AIL] = _manual.roll;
_actuators.control[CH_ELV] = _manual.pitch;
_actuators.control[CH_RDR] = _manual.yaw;
_actuators.control[CH_THR] = _manual.throttle;
- } else if (_status.navigation_state == NAVIGATION_STATE_STABILIZE) { // TODO use vehicle_control_mode here?
+
+ } else if (_status.main_state == MAIN_STATE_SEATBELT ||
+ _status.main_state == MAIN_STATE_EASY /* TODO, implement easy */) {
+
// calculate velocity, XXX should be airspeed, but using ground speed for now
// for the purpose of control we will limit the velocity feedback between
// the min/max velocity