59 Commits

Author SHA1 Message Date
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
618724b409 Functional gtests: remove unnecessary subscription updates
A new subscription is updated on instanciation and no additional
update needs to be called for processing the first sample.
2023-07-13 12:00:35 +02:00
Matthias Grob
2dcb525cd9 RCUpdateTest: RC switch correct corner case test value
Co-authored-by: Junwoo Hwang <junwoo091400@gmail.com>
2023-07-11 15:58:48 +02:00
Matthias Grob
42fa41e601 rc_update: fix on-off-switch with negative threshold values 2023-07-11 15:58:48 +02:00
Matthias Grob
1fa5136e30 RCUpdateTest: add unit test for return switch 2023-07-11 15:58:48 +02:00
Matthias Grob
392d445783 RCUpdateTest: fix unit test parameters + restoring state after test
Channel values stay over one unit test but some tests assumed they are
reset each time. Reset the channel after these mode button tests.

Parameters survive between unit tests presumably as long as
the bianry runs. Reset them if a test requires that.
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
87c697a0d6 rc_update: switch back to protected scope and use fixture for testing 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
Silvan Fuhrer
b16f16598b VTOL: remove virtual actuator_controls and instead use virtual torque/thrust topics
MC/FW rate controller and auto tuner: remove actuator_controls

AirshipAttControl: remove actuator_controls

MulticopterLandDetector: remove actuator_controls

mavlink streams vfr_hud and high_latency2: remove actuator_controls

RoverPositionController: remove actuator_controls

UUVAttitudeController: remove actuator_controls

battery: use length of thrust_setpoint for throttle compensation

VehicleMagnetometer: use length of thrust_setpoint for throttle compensation

Signed-off-by: Silvan Fuhrer
2023-03-16 11:55:45 +01: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
Hamish Willee
e6eed43648
Spelling errors (#19935) 2022-07-27 14:33:16 +10: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
Jukka Laitinen
9449ed6e66 Add support for protected build in drivers, systemcmds and modules Kconfig
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-02-18 07:58:58 +01: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
mcsauder
21163d859e Whitespace cleanup. 2021-10-19 13:29:26 -04:00
Peter van der Perk
d5e3e9a7bc [Kconfig] Decompose Kconfig, now each module has its own Kconfig
Which is better for versioning and decomposability
2021-10-07 10:09:01 -04: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
Hamish Willee
ce206d992b
RC_FAILS_THR and RC_MAP_FAILSAFE improve parameter description 2021-09-11 15:12:54 -04: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
53a14e847d drivers/rc_input: support RC_RSSI_PWM_CHAN 2021-01-26 18:19:52 -05:00
Daniel Agar
967d35a6b6
rate limit most parameter_update subscriptions
- parameter updates can be quite expensive because they trigger nearly all modules to reload all of their parameters immediately
 - limit modules from updating faster than once per second
2021-01-10 21:09:15 -05: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
Matthias Grob
ce8f4dece2 rc_update_params: clarify failsafe channel and threshold 2020-11-26 10:55:35 +01:00
Daniel Agar
27f23ac290 move initial sensor priority to parameters and purge ORB_PRIORITY
- CAL_ACCx_EN -> CAL_ACCx_PRIO
 - CAL_GYROx_EN -> CAL_GYROx_PRIO
 - CAL_MAGx_EN -> CAL_MAGx_PRIO
2020-08-21 10:12:13 -04: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
baumanta
8b89cfc498 change RC action switch thresholds 2020-04-09 14:41:09 +02:00