mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 21:13:34 +08:00
Merge branch 'master' of https://github.com/PX4/Firmware into fw_control
This commit is contained in:
@@ -441,13 +441,27 @@ l_actuator_outputs(struct listener *l)
|
|||||||
uint8_t mavlink_mode = 0;
|
uint8_t mavlink_mode = 0;
|
||||||
get_mavlink_mode_and_state(&mavlink_state, &mavlink_mode);
|
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 */
|
/* HIL message as per MAVLink spec */
|
||||||
mavlink_msg_hil_controls_send(chan,
|
mavlink_msg_hil_controls_send(chan,
|
||||||
hrt_absolute_time(),
|
hrt_absolute_time(),
|
||||||
(act_outputs.output[0] - 1000.0f) / 1000.0f,
|
(act_outputs.output[0] - 1000.0f) / 1000.0f,
|
||||||
(act_outputs.output[1] - 1000.0f) / 1000.0f,
|
(act_outputs.output[1] - 1000.0f) / 1000.0f,
|
||||||
(act_outputs.output[2] - 1000.0f) / 1000.0f,
|
rudder,
|
||||||
(act_outputs.output[3] - 1000.0f) / 1000.0f,
|
throttle,
|
||||||
(act_outputs.output[4] - 1000.0f) / 1000.0f,
|
(act_outputs.output[4] - 1000.0f) / 1000.0f,
|
||||||
(act_outputs.output[5] - 1000.0f) / 1000.0f,
|
(act_outputs.output[5] - 1000.0f) / 1000.0f,
|
||||||
(act_outputs.output[6] - 1000.0f) / 1000.0f,
|
(act_outputs.output[6] - 1000.0f) / 1000.0f,
|
||||||
|
|||||||
Reference in New Issue
Block a user