aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2012-11-10 19:05:13 +0100
committerThomas Gubler <thomasgubler@gmail.com>2012-11-10 19:05:13 +0100
commitd3693ea993beaa472c80a765d1cd27ca289001f4 (patch)
tree10cabe80fe004c984b157e61aa7e06ebdb4fd561
parent4fae74e4c1d44c3f7049d757f78bb283b36b3330 (diff)
parent6adab3b31930074ad9336ac596c1b4c2d6a4bd74 (diff)
downloadpx4-firmware-d3693ea993beaa472c80a765d1cd27ca289001f4.tar.gz
px4-firmware-d3693ea993beaa472c80a765d1cd27ca289001f4.tar.bz2
px4-firmware-d3693ea993beaa472c80a765d1cd27ca289001f4.zip
Merge branch 'master' of https://github.com/PX4/Firmware into fw_control
-rw-r--r--apps/mavlink/orb_listener.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/mavlink/orb_listener.c b/apps/mavlink/orb_listener.c
index df6b1a475..e214f435e 100644
--- a/apps/mavlink/orb_listener.c
+++ b/apps/mavlink/orb_listener.c
@@ -441,13 +441,27 @@ l_actuator_outputs(struct listener *l)
uint8_t mavlink_mode = 0;
get_mavlink_mode_and_state(&mavlink_state, &mavlink_mode);
+ float rudder, throttle;
+
+ // XXX very ugly, needs rework
+ if (isfinite(act_outputs.output[3])
+ && act_outputs.output[3] > 800 && act_outputs.output[3] < 2200) {
+ /* throttle is fourth output */
+ rudder = (act_outputs.output[2] - 1000.0f) / 1000.0f;
+ throttle = (act_outputs.output[3] - 1000.0f) / 1000.0f;
+ } else {
+ /* only three outputs, put throttle on position 4 / index 3 */
+ rudder = 0;
+ throttle = (act_outputs.output[2] - 1000.0f) / 1000.0f;
+ }
+
/* HIL message as per MAVLink spec */
mavlink_msg_hil_controls_send(chan,
hrt_absolute_time(),
(act_outputs.output[0] - 1000.0f) / 1000.0f,
(act_outputs.output[1] - 1000.0f) / 1000.0f,
- (act_outputs.output[2] - 1000.0f) / 1000.0f,
- (act_outputs.output[3] - 1000.0f) / 1000.0f,
+ rudder,
+ throttle,
(act_outputs.output[4] - 1000.0f) / 1000.0f,
(act_outputs.output[5] - 1000.0f) / 1000.0f,
(act_outputs.output[6] - 1000.0f) / 1000.0f,