mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 15:43:33 +08:00
new manual_control_switches msg (split out of manual_control_setpoint) (#16270)
- split out switches from manual_control_setpoint into new message manual_control_switches
- manual_control_switches published at minimal rate (~ 1 Hz) or immediately on change
- simple switch debounce in rc_update (2 consecutive identical decodes required)
- manual_control_switches logged at full rate rather than sampled at (5-10% of messages logged)
- manual_control_setpoint publish at minimal rate unless changing
- commander handle landing gear switch for manual modes
- processing of mode_slot and mode_switch is now split so we only do one or the other (not both)
- a future step will be to finally drop mode_switch and accompanying switches entirely
Co-authored-by: Matthias Grob <maetugr@gmail.com>
This commit is contained in:
co-authored by
Matthias Grob
parent
25ef76b3b8
commit
ef6209ba03
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <systemlib/mavlink_log.h>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/manual_control_setpoint.h>
|
||||
#include <uORB/topics/manual_control_switches.h>
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
@@ -43,14 +43,13 @@ bool PreFlightCheck::manualControlCheck(orb_advert_t *mavlink_log_pub, const boo
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
uORB::SubscriptionData<manual_control_setpoint_s> manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||
manual_control_setpoint_sub.update();
|
||||
const manual_control_setpoint_s &manual_control_setpoint = manual_control_setpoint_sub.get();
|
||||
uORB::SubscriptionData<manual_control_switches_s> manual_control_switches_sub{ORB_ID(manual_control_switches)};
|
||||
const manual_control_switches_s &manual_control_switches = manual_control_switches_sub.get();
|
||||
|
||||
if (manual_control_setpoint.timestamp != 0) {
|
||||
if (manual_control_switches.timestamp != 0) {
|
||||
|
||||
//check action switches
|
||||
if (manual_control_setpoint.return_switch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
// check action switches
|
||||
if (manual_control_switches.return_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
success = false;
|
||||
|
||||
if (report_fail) {
|
||||
@@ -58,7 +57,7 @@ bool PreFlightCheck::manualControlCheck(orb_advert_t *mavlink_log_pub, const boo
|
||||
}
|
||||
}
|
||||
|
||||
if (manual_control_setpoint.kill_switch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
if (manual_control_switches.kill_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
success = false;
|
||||
|
||||
if (report_fail) {
|
||||
@@ -66,7 +65,7 @@ bool PreFlightCheck::manualControlCheck(orb_advert_t *mavlink_log_pub, const boo
|
||||
}
|
||||
}
|
||||
|
||||
if (manual_control_setpoint.gear_switch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
if (manual_control_switches.gear_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
success = false;
|
||||
|
||||
if (report_fail) {
|
||||
|
||||
Reference in New Issue
Block a user