From de89777b6abab118c342f6031f7172b96c22ed12 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Mon, 25 Mar 2024 19:09:14 +0100 Subject: [PATCH] px4io: remove special handling for HITL In HITL the actuators should not be mapped and they are in lockdown. We should not reconfigure disarmed, min, max PWM values without updating the actual output values because the IO will consider the last outputs before the FMU was rebooted with the configuration of the new boot. This can result in spinning motors when switching to SIH. --- src/drivers/px4io/px4io.cpp | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index e98a9c837d..52ad832514 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -335,8 +335,7 @@ private: (ParamInt) _param_rc_rssi_pwm_chan, (ParamInt) _param_rc_rssi_pwm_max, (ParamInt) _param_rc_rssi_pwm_min, - (ParamInt) _param_sens_en_themal, - (ParamInt) _param_sys_hitl + (ParamInt) _param_sens_en_themal ) }; @@ -474,9 +473,7 @@ int PX4IO::init() } /* try to claim the generic PWM output device node as well - it's OK if we fail at this */ - if (_param_sys_hitl.get() <= 0) { - _mixing_output.setMaxTopicUpdateRate(MIN_TOPIC_UPDATE_INTERVAL); - } + _mixing_output.setMaxTopicUpdateRate(MIN_TOPIC_UPDATE_INTERVAL); _px4io_status_pub.advertise(); @@ -525,9 +522,7 @@ void PX4IO::Run() perf_count(_interval_perf); /* if we have new control data from the ORB, handle it */ - if (_param_sys_hitl.get() <= 0) { - _mixing_output.update(); - } + _mixing_output.update(); if (hrt_elapsed_time(&_poll_last) >= 20_ms) { /* run at 50 */ @@ -540,13 +535,11 @@ void PX4IO::Run() io_publish_raw_rc(); } - if (_param_sys_hitl.get() <= 0) { - /* check updates on uORB topics and handle it */ - if (_t_actuator_armed.updated()) { - io_set_arming_state(); + /* check updates on uORB topics and handle it */ + if (_t_actuator_armed.updated()) { + io_set_arming_state(); - // TODO: throttle - } + // TODO: throttle } if (!_mixing_output.armed().armed) { @@ -814,14 +807,6 @@ PX4IO::io_set_arming_state() clear |= PX4IO_P_SETUP_ARMING_FORCE_FAILSAFE; } - // XXX this is for future support in the commander - // but can be removed if unneeded - // if (armed.termination_failsafe) { - // set |= PX4IO_P_SETUP_ARMING_TERMINATION_FAILSAFE; - // } else { - // clear |= PX4IO_P_SETUP_ARMING_TERMINATION_FAILSAFE; - // } - if (armed.ready_to_arm) { set |= PX4IO_P_SETUP_ARMING_IO_ARM_OK;