29 Commits

Author SHA1 Message Date
Beat Küng
960003a86a control_allocator: fix weak authority matrix check & update
- use max(fabsf(val)) instead of max(val)
- use correct actuator count
2022-02-21 11:17:00 -05:00
Silvan Fuhrer
c51dc3b4b7 ControlAllocator: Set all the elements of a row to 0 if that row has weak authority
Weak authority on a axis is currently defined as: none of the actuators have an
effectivness on this particular axis larger than 0.05.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-02-17 13:21:50 +01:00
Silvan Fuhrer
df0e402c44 CA: refactor logic for matrix updating
-pass flag EffectivenessUpdateReason into effectiveness, indicating if there was an external
update or not. Reasons for external updates are:
  -config changes (parameter)
  -motor failure detected or certain redundant motors are switched off to save energy

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-02-14 09:23:10 +01:00
Silvan Fuhrer
0950bb81ab ControlAllocation: update normalization scale only if matrix updated is forced
The forced flag is used to distinguish between updates due to a configuration
(parameter) change (only enabled when disarmed), and matrix updates due to motor
tilt change. Only update the normalization scale if the forced flag is true, and
use a tilt angle of vertical position for it to have the scales tilt-invariant.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-01-19 08:22:12 +01:00
Beat Küng
d202bf9631 control_allocator: add scope to reduce stack usage by 256B 2021-12-24 20:06:13 -05:00
Beat Küng
5259877b1b control_allocator: update matrix normalization
- only normalize rpy for MC matrices
- for thrust use the 3D vector, so it works for FW and tilt rotors as well

This keeps MC unchanged.
2021-12-24 20:06:13 -05:00
Beat Küng
8c782b7cd9 control_allocator: add Custom + MC with tilts effectiveness
The param group is changed to Geometry, as this reflects the naming in the
QGC UI.
2021-12-24 20:06:13 -05:00
Silvan Fuhrer
07306c4be3 control_allocator: add support for Tailsitter VTOL
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-12-24 20:06:13 -05:00
Beat Küng
4f8e6a9548 control_allocator: do not update params while armed
As a precaution
2021-12-24 20:06:13 -05:00
Beat Küng
e04b4a8dbf control_allocator: add 6DOF configuration 2021-12-24 20:06:13 -05:00
Beat Küng
4c80adfaf1 control_allocator: implement trim + slew rate limits configuration 2021-12-24 20:06:13 -05:00
Beat Küng
8d9e2a28c4 control_allocator: add fixed-wing actuator effectiveness 2021-12-24 20:06:13 -05:00
Beat Küng
4d2a403afa control_allocator: add rover actuator effectiveness
This can be generalized later
2021-12-24 20:06:13 -05:00
Beat Küng
ed3a115c8f control_allocator: add status publication rate limitation comment 2021-12-24 20:06:13 -05:00
Beat Küng
70e46a194f control_allocator: major refactoring & additions
- allow effectiveness matrix to select control allocator method
  (desaturation algorithm)
- add actuator_servos publication
- add support for multiple matrices (for vtol)
- add updateSetpoint callback method to actuator effectiveness to allow it
  to manipulate the actuator setpoint after allocation
- handle motor stopping & reversal
- add control surfaces & tilt servos
- handle standard vtol + tiltrotor
- rename MC rotors params & class to be more generically usable
- fixes and enables ActuatorEffectivenessRotorsTest
2021-12-24 20:06:13 -05:00
Beat Küng
9c767ff1ee control_allocator: make effective source name a class member 2021-12-24 20:06:13 -05:00
Beat Küng
2809dd8944 control_allocator: remove min/max/scale params 2021-11-23 12:40:22 -05:00
Beat Küng
b29d9db7f1 control_allocator: limit status publication rate to 200Hz
Reduces CPU load by ~3.5% on F4 @2khz.
And compute getAllocatedControl as needed (~1.5% CPU reduction)
2021-11-23 12:40:22 -05:00
Beat Küng
bcba3dfe52 control_allocator,angular_velocity_controller: run on rate_ctrl wq 2021-11-23 12:40:22 -05:00
Beat Küng
a0e43bca96 msg: remove unused vehicle_actuator_setpoint topic 2021-11-23 12:40:22 -05:00
Beat Küng
38fa65a47e control_allocator: remove direct mixer, add actuator_{motors,servos} instead 2021-10-18 18:45:19 -04:00
bresch
f09b34007e CA: reload CA matrix to newly created CA class properly
Also remove the dependency of ActuatorEffectivenessMultirotor
to param update uORB topic; the CA module
sends a "force" parameter when needed
2021-09-11 15:07:49 -04:00
bresch
cf5917d188 control_allocator: restructure param update
recompute effectiveness on param change
clear update at the end
2021-09-11 15:07:49 -04:00
Beat Küng
164511a7b5 control_allocator: avoid vector copies and sqrt() 2021-01-18 11:25:37 -05:00
Beat Küng
0e66b0876b control_allocator: change SequentialDesaturation to existing MC mixer
And limit the operations to the number of configured outputs.

Only using the number of configured actuators reduces CPU load by ~2% on
F7 @1khz.
2021-01-18 11:25:37 -05:00
Beat Küng
308f614735 refactor control_allocator: directly get the effectiveness matrix when updated
Reduces stack + RAM usage
2021-01-18 11:25:37 -05:00
Beat Küng
38782029ad fix control_allocator: set _last_run at the correct place 2021-01-18 11:25:37 -05:00
Beat Küng
0e86ab47f6 fix control_allocator: use 'delete' instead of 'free', guard against out-of-memory 2021-01-18 11:25:37 -05:00
Julien Lecoeur
343cf5603e initial control allocation support
- control allocation module with multirotor, VTOL standard, and tiltrotor support
 - angular_velocity_controller
 - See https://github.com/PX4/PX4-Autopilot/pull/13351 for details

Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
Co-authored-by: Roman Bapst <bapstroman@gmail.com>
2021-01-18 11:25:37 -05:00