50 Commits

Author SHA1 Message Date
Jacob Dahl
9a0241ac44 fix(rc_update): change RC*_REV params from float to int32
RC*_REV parameters are binary toggles (-1 or 1) immediately converted
to bool. Using int32 allows reverting the module schema enum key type
from number back to integer, keeping validation strict.
2026-03-19 23:46:16 -08:00
Jacob Dahl
ce3e62841f
module_base: remove CRTP template pattern to reduce flash bloat (#26476)
* module_base: claude rewrite to remove CRTP bloat

* module_base: apply to all drivers/modules

* format

* fix build errors

* fix missing syntax

* remove reference to module.h in files that need module_base.h

* remove old ModuleBase<T>

* add module_base.cpp to px4_protected_layers.cmake

* fix IridiumSBD can_stop()

* fix IridiumSBD.cpp

* clang-tidy: downcast static cast

* get_instance() template accessor, revert clang-tidy global

* rename module_base.h to module.h

* revert changes in zenoh/Kconfig.topics
2026-02-19 15:17:17 +13:00
Matthias Grob
4842c542b8
rc_update: remove 1% deadzone for RC channels 1-8 (#25502)
* rc_update: remove 1% deadzone for all channels

this should be handled higher level.

* Remove all references to the RC{n}_DZ parameters

Regular expression: RC.{0,2}_DZ

---------

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
2025-10-13 21:41:11 -08:00
Matthias Grob
52e8a0a0db Add RC termination switch 2025-07-23 11:13:11 +02:00
Matthias Grob
daa491dc19 rc_update: make payload power switch an optional 3-way switch
to support 3 different power states for the payload.
2025-06-30 16:50:28 +02:00
Matthias Grob
8e7c2ed440 rc_update: allow payload power switch to be used for other boards than ARK FPV 2025-06-30 16:50:28 +02:00
Matthias Grob
64b92e46f8 rc_update: follow parameter member naming convention for payload power switch mapping 2025-06-30 16:50:28 +02:00
Alex Klimaj
4d1c65d722
boards: new ARK FPV FC (#23830)
* add new payload power switch (RC_MAP_PAY_SW)
2024-10-30 11:35:35 -04:00
Daniel Agar
f9160853fa rc_update: purge deprecated RC switch parameters
- these are old RC switch configuration parameters that haven't been used for
   years, but were hardcoded into old versions of QGC
 - RC_MAP_RATT_SW, RC_MAP_POSCTL_SW, RC_MAP_ACRO_SW, RC_MAP_STAB_SW, RC_MAP_MAN_SW deleted

 -
2024-06-17 12:03:13 -04:00
Matthias Grob
42fa41e601 rc_update: fix on-off-switch with negative threshold values 2023-07-11 15:58:48 +02:00
Matthias Grob
e127ada07b rc_update: extend ModuleParams::updateParams() for local parameter updates 2023-07-11 15:58:48 +02:00
Matthias Grob
b625e43566 rc_update: throttle trim centering fix for reverse channel
The entire logic did not work for the case when the throttle channel is
reversed because then QGC sets trim = max for that channel and
the result is only half the throttle range.
2023-06-06 17:22:33 +02:00
Matthias Grob
7b6f45079b ManualControl: use input validity flag to check for RC calibration 2023-05-23 17:24:17 +02:00
Patrick José Pereira
5fff0526cf rc_update: Use snprintf over sprintf
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2023-05-22 07:46:54 +02:00
Matthias Grob
babe93c3bf rc_update: adapt throttle trim calibration for [-1,1]
This is fully backwards compatible: If the throttle trim is set to
the minimum then it's the legacy calibration and gets
interpreted such that there is no trim and behavior remains as before.
If the trim is set to a different value than the minimum then it gets
used like with all other channels which was unsupported before.
2022-11-28 19:25:55 +01:00
Matthias Grob
331cb21dee manual_control_setpoint: change stick axes naming
In review it was requested to have a different name for
manual_control_setpoint.z because of the adjusted range.

I started to investigate what naming is most intuitive and found
that most people recognize the stick axes as roll, pitch, yaw, throttle.
It comes at no surprise because other autopilots
and APIs seem to share this convention.

While changing the code I realized that even within the code base
the axes are usually assigned to a variable with that name or
have comments next to the assignment clarifying the axes
using these names.
2022-11-28 19:25:55 +01:00
Matthias Grob
d81ca65c6f rc_update: replace RC scaling with interpolate function use 2022-11-23 11:06:44 -05:00
Daniel Agar
13f9eabd70 delete unused actuator_controls_3 2022-09-09 09:14:09 -04:00
Beat Küng
7e75b497ae
helicopter: add switch to engage main motor
For helicopters it's useful (e.g. during bringup) to be able to disable
the main rotor while the tail is still controlled to safely land.
2022-09-07 08:00:26 +02:00
Matthias Grob
4bd2d4cf35 rc_update: add unit tests for mode slot
To verify RC mode switch and mode button functionality works as expected.
2022-05-16 14:37:29 +02:00
Daniel Agar
77a37c26bf rc_update: further tighten timing requirements for valid data
- any real RC data input will be much faster than 3 Hz, so this is an
easy way to minimize bogus decoded data from propagating
2022-04-07 14:42:05 -04:00
Daniel Agar
3d08e031d2 rc_update: improve manual_switches simple protections
- require back to back matching switch decode to match within 1 second
 - clear any previous manual switches if RC is unstable
2022-03-25 10:56:24 -04:00
Daniel Agar
6135bb384b cleanup module callback registration failed errors 2022-03-23 20:44:50 -04:00
Julian Oes
e4763f15f6 Mantis: add RC hacks
This changes the way RC is handled for the Mantis:
- The RC values are re-written when arriving over MAVLink. They are
  rescaled from 0..4095 to 1000..2000 and the channel bits added to
  separate channels. This makes the downstream handling easier.
- Gimbal pitch is moved from Aux1 to Aux2 as that should be the default.
- Aux3 and Aux4 are used for the photo and video trigger.
- The speed button is used as the FLTMODE channel and set to switch
  between POSCTL and ALTCTL.
2022-01-10 23:04:10 -05:00
Julian Oes
9fe7a40673 manual_control: enable sending camera commands 2022-01-10 23:04:10 -05:00
Matthias Grob
fabf865411 Use backwards compatible manual_control_setpoint instead of manual_control_input 2021-11-09 16:05:25 +01:00
Julian Oes
14eb656a59 rc_update: use snake_case for namespace name 2021-11-09 16:05:25 +01:00
Julian Oes
6e8ccf6a45 rc_update: rename update method
This reflects better what it actually does.
2021-11-09 16:05:25 +01:00
Daniel Agar
2d816e0b3e [WIP] manual_control selector hacks 2021-11-09 16:05:25 +01:00
Daniel Agar
089c962d92 px4io: moving mixing to FMU side
Using mixers on the IO side had a remote benefit of being able to
override all control surfaces with a radio remote on a fixed wing.
This ended up not being used that much and since the original design
10 years ago (2011) we have been able to convince ourselves that the
overall system stability is at a level where this marginal benefit,
which is not present on multicopters, is not worth the hazzle.

Co-authored-by: Beat Küng <beat-kueng@gmx.net>
Co-authored-by: Daniel Agar <daniel@agar.ca>
2021-09-25 19:15:05 -04:00
Matthias Grob
d1f1e02afb Refactor mode button changes 2021-09-14 09:52:32 +02:00
Claudio Micheli
c50daae4a3 rc_update: introduce support for toggle buttons via RC channels
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2021-09-14 09:52:32 +02:00
Daniel Agar
38bc46fd1a re-add RC_MAP_RATT_SW (unused) and mark active for QGC 2021-04-16 13:07:02 -04:00
Daniel Agar
2492fb35e4 rc_update: require consecutive valid input_rc before publishing 2021-04-15 16:40:54 -04:00
Daniel Agar
bb12fce66c delete RATTITUDE flight mode 2021-03-09 10:47:00 -05:00
Kalyan Sriram
b257f9d1fd actuator: add support for MAV_CMD_DO_SET_ACTUATOR
Adds support for using the MAVLink command MAV_CMD_DO_SET_ACTUATOR to
update the actuator values on control group 3 aux{1, 2, 3}. A simple
deconfliction with rc_update is implemented: when a MAVLink command is
sent, RC is disabled for that channel until a major stick movement is
detected.
2021-03-02 12:41:02 +01:00
Lorenz Meier
8a448718b9 RC update: Do not constrain throttle
If the user calibrated to negative throttle, enable them to use it.
2021-02-14 11:17:28 +01:00
Daniel Agar
ef6209ba03
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>
2020-12-11 12:11:35 -05:00
Daniel Agar
85f3ab1960
rc_update: only decode if RC input is stable (channel count and source) 2020-12-01 09:40:24 -05:00
Daniel Agar
63a23957b1
rc/dsm: decode improvements
- always check system field for validity
 - reject any data outside of "servo position" valid range from Spektrum specification
 - properly support XPlus channels (12+)
 - debug message if channel count changes
2020-08-02 12:52:16 -04:00
Matthias Grob
e9eae1bd76 Refactor: Name manual_control_setpoint the same way everywhere 2020-06-22 12:06:27 -04:00
Matthias Grob
27586db93e rc_update: remove obsolete RC filtering 2020-05-20 19:30:19 +02:00
Julian Oes
e7c655ba52 rc_update: make specific RC loss check only on PPM
This makes the check more specific, so it's only active on PPM input.
2020-02-20 09:02:30 +01:00
bozkurthan
3f16eba3f7 RC Failsafe fix for RFD 868+/900 Modems
RC Failsafe isn't triggered when PPM signal is valid. These changes
update Failsafe trigger logic for RC input. RF Modules keep sending
valid PPM signal when the RC Transmitter is lost.
RF Modules which are in the air send PPM signal with same type when lost
the signal from ground.
2020-02-20 09:02:30 +01:00
Daniel Agar
386673e6c3 fix flt_cutoff_min -> flt_cutoff_max 2019-12-23 23:47:34 +01:00
Daniel Agar
93d392ff80 Update src/modules/rc_update/rc_update.cpp
Co-Authored-By: Beat Küng <beat-kueng@gmx.net>
2019-12-23 23:47:34 +01:00
Daniel Agar
607cb97758 Update src/modules/rc_update/rc_update.cpp
Co-Authored-By: Beat Küng <beat-kueng@gmx.net>
2019-12-23 23:47:34 +01:00
Daniel Agar
57fc98812d rc_update: cleanup parameter usage 2019-12-23 23:47:34 +01:00
Daniel Agar
22a005c9f4
delete module's redundant print_status()
- we can already get the running status from ModuleBase and the other misc information is already available through perf or uORB
2019-11-30 18:22:19 -05:00
Daniel Agar
bc182e94e6
sensors split rc_update into new standalone module 2019-11-24 13:25:11 -05:00