142 Commits

Author SHA1 Message Date
chfriedrich98
33d99a13e8
differential: restructure and update module (#23430)
* differential: rename module

* differential: restructure and update module
2024-08-07 09:53:37 +02:00
Matthias Grob
f2bca92221 Fix duplicate newlines at the end of files 2024-07-19 14:33:36 +02:00
Matteo Del Seppia
a8617cf681
Fix float and uint64_t comparison (#23199)
fix: ControlAllocator float and int comparison bug

There was an incorrect comparison between a float variable `dt` and a `uint64_t` value representing 5 milliseconds (`5_ms`). As a result, `do_update` could never become true even if the last torque setpoint was received more than 5 milliseconds before.

To solve this, the `5_ms` value has been converted to seconds (0.005f) for the comparison with `dt`.
2024-06-03 17:48:38 -08:00
somebody-once-told-me
f40ede6087
Control Allocation Sequential Desaturation unit tests (#22612)
* [control_allocation] add unit tests for ControlAllocationSequentialDesaturation

* complete first 2 unit tests

* add yaw test

* add more unit tests

* improve comments

* format

* address review comments

* submodule update

* Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp

Co-authored-by: Silvan Fuhrer <silvan@auterion.com>

* Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp

Co-authored-by: Silvan Fuhrer <silvan@auterion.com>

* Update src/modules/control_allocator/ControlAllocation/ControlAllocationSequentialDesaturationTest.cpp

Co-authored-by: Silvan Fuhrer <silvan@auterion.com>

* remove float suffix for logical integers, add missing float suffixes for logical float zeros, and make YAW_MOTORS an int

---------

Co-authored-by: Master Chief <master-chief@the-void.com>
Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
2024-01-26 15:17:54 +01:00
somebody-once-told-me
3d5c2ef6c4
[control_allocation] small function comment typo fix (#22607)
Co-authored-by: Master Chief <master-chief@the-void.com>
2024-01-08 11:12:06 +01:00
Matthias Grob
3de5c609a4 Differential Rover: PR fixes 2023-12-21 16:27:53 +01:00
PerFrivik
3df71d1837 Differential Rover: Differential drive module & library 2023-12-21 16:27:53 +01:00
Matthias Grob
14c4257a59 ActuatorEffectivenessRotors: Use modern parameter interface for rotor count
This lead to a compiler warning with arm-none-eabi-gcc 12+
about the variable count potentially being a dangling pointer.
2023-12-05 12:06:56 -05:00
PerFrivik
de9074558b Roboclaw: Updated Airframe and fixed left and right mapping error 2023-11-28 16:30:17 +01:00
Matthias Grob
8ea04b0f8f ActuatorEffectivenessHelicopterCoaxial: fix copy paste error in saturation logic 2023-09-28 08:55:06 +02:00
Matthias Grob
8a2d2fb1cd HelicopterCoaxial: only publish unallocated thrust in the saturation case 2023-09-28 08:55:06 +02:00
Matthias Grob
169a0f580d HelicopterCoaxial: correct constraining for minimum 2 swash plate servos 2023-09-28 08:55:06 +02:00
Matthias Grob
20f2df4410 HelicopterCoaxial: handle yaw saturation
This had to be done for the integrators to work at all.
2023-09-28 08:55:06 +02:00
Matthias Grob
cf40d95ef0 HelicopterCoaxial: adjust for coaxial allocation 2023-09-28 08:55:06 +02:00
Matthias Grob
b3b373e074 control_allocator: add coaxial helicopter effectiveness
It's now just a copy of the helicopter such that changes get well
visible in the history.
2023-09-28 08:55:06 +02:00
Matthias Grob
b56e7a036c control_allocator: allow for only 2 swash plate servos
This is required to support fixed pitch propeller helicopters that have
no collective but only cyclic pitch with two degrees of freedom and
hence only two servos.

The amount of thrust in the body z axis is then controlled using the
motor speed which makes particularly sense on coaxial helicopters
that need to control yaw with changing motor speeds already.
2023-09-28 08:55:06 +02:00
Matthias Grob
35b32e8cb0 ActuatorEffectivenessHelicopter: spacing 2023-09-28 08:55:06 +02:00
Matthias Grob
2be687a84c Helicopter: add collective pitch offset to Actuator UI parameters 2023-09-28 08:55:06 +02:00
Matthias Grob
99e2acf89c ActuatorEffectivenessHelicopter: explicitly handle unsaturated case
This became necessary otherwise
the allocation reports saturation all
the time and the rate integrator doesn't work.
2023-09-28 08:53:35 +02:00
Julian Oes
fb30b4d288 control_allocator: Clarify position description
I'm assuming that the rotor positions are given relative to the center
of gravity (CG).

Signed-off-by: Julian Oes <julian@oes.ch>
2023-09-04 08:02:15 +02:00
Silvan Fuhrer
f1b5b4f524
TiltrotorEffectiveness: limit thrust axis tilt to z effectiveness scaling (#21990)
During transition to FF, only allow update thrust axis up to 45° as with a high tilt angle
the effectiveness of the thrust axis in z is apporaching 0, and by that is increasing
the motor output to max.
Transition to HF: disable thrust axis tilting, and assume motors are vertical. This is to avoid
a thrust spike when the transition is initiated (as then the tilt is fully forward).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-08-25 14:45:14 +02:00
Silvan Fuhrer
410206aa5d
Control Allocation: fixes in yaw saturation detection for vehicles with tilt-for-yaw (#21994)
* ActuatorEffectiveness: base yaw saturation on tilt actuator limits (VTOL Tiltrotor)

* ActuatorEffectiveness: add custom yaw saturation for MC Tilt


---------

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-08-24 13:58:58 +02:00
Silvan Fuhrer
0eb276f273
Tiltrotor: move spin up tilt to control allocation (#21991)
EffectivenessTiltrotor: link time when to tilt motors to MC position to COM_SPOOLUP_TIME
- remove VT_TILT_SPINUP and special spin up tilt handling form the VTOL module
- now handle the spoolup in the allocation, directly linked to COM_SPOOLUP_TIME
- leave tilts at disarmed value during spoolup

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-08-24 13:57:24 +02:00
Beat Küng
03365658d5 VehicleControlMode: add flag_control_allocation_enabled
Allows (external) modes to directly publish actuator_{motors,servos}.
2023-08-21 20:53:51 -04:00
Silvan Fuhrer
eaad11bb74 ActuatorEffectiveness: add comment for 2% magic number to stop motors
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-08-17 13:28:09 +02:00
Matthias Grob
e776aca9ef UUV: stop motors when commanding zero speed 2023-07-10 18:58:37 +02:00
Matthias Grob
6b7aed3d44 Boats: stop motors when commanding zero speed 2023-07-10 18:58:37 +02:00
Matthias Grob
95a35c972d Rovers: stop motors when commanding zero speed 2023-07-10 18:58:37 +02:00
Matthias Grob
0be6069b83 TiltrotorVTOL: allow stopping front tilted motors in fast forward flight 2023-07-10 18:58:37 +02:00
Matthias Grob
66b451e61f TailsitterVTOL: allow explicitly stop forward motor with zero thrust 2023-07-10 18:58:37 +02:00
Matthias Grob
5568afbb12 StandardVTOL: explicitly stop forward motor with zero thrust 2023-07-10 18:58:37 +02:00
Matthias Grob
6b7b34a71a FixedWing: explicitly stop forward motor with zero thrust
This allows PWM and all other output methods to configure
stopped, idling and full thrust points and use them consistently.
The fact that a fixed wing motor can be stopped when zero thrust
is demanded is explicit and could in principle even be disabled.
The mechanism is the same as for a standard VTOL stopping the
multicopter motors in the fixed wing flight phase.
2023-07-10 18:58:37 +02:00
Matthias Grob
2a077181d9 ActuatorEffectiveness: add function to delectively stop motors with zero thrust 2023-07-10 18:58:37 +02:00
Matthias Grob
a36c922fc0 ActuatorEffectivenessHelicopterTest: adapt to new constructor 2023-07-03 16:21:27 +02:00
Beat Küng
77d6c722a7 helicopter: add tail servo support
as a separate CA_AIRFRAME, as the UI cannot switch between servo/motor.
2023-07-03 16:21:27 +02:00
Beat Küng
989d9243b7 fix control_allocator: correct PRINT_MODULE_USAGE_NAME 2023-04-13 07:46:09 +02:00
Matthias Grob
937d27f8ee Helicopter: add offset for yaw compensation based on collective pitch 2023-03-24 07:16:36 +01: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
Silvan Fuhrer
1e56d9c219 Rework flaps/spoilers logic
- remove deprecated actuator_controls[INDEX_FLAPS/SPOILERS/AIRBRAKES]
- use new topic normalized_unsigned_setpoint.msg (with instances flaps_setpoint
and spoilers_setpoint) to pass into control allocation
- remove flaps/spoiler related fields from attitude_setpoint topic
- CA: add possibility to map flaps/spoilers to any control surface
- move flaps/spoiler pitch trimming to CA (previously called DTRIM_FLAPS/SPOILER)
- move manual flaps/spoiler handling from rate to attitude controller

FW Position controller: change how negative switch readings are intepreted
for flaps/spoilers (considered negative as 0).

VTOL: Rework spoiler publishing in hover

- pushlish spoiler_setpoint.msg in the VTOL module if in hover
- also set spoilers to land configuration if in Descend mode

Allocation: add slew rate limit of 0.5 to flaps/spoilers configuration change

Instead of doing the flaps/spoilers slew rate limiting in the FW Position Controller
(which then only is applied in Auto flight), do it consistently over all flight
modes, so also for manual modes.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-03-06 22:43:41 +01:00
Silvan Fuhrer
4b54ddfe61 Remove INDEX_COLLECTIVE_TILT from actuator_controls and instead use new topic tiltrotor_extra_controls
Tiltrotor_extra_controls also contains collective thrust beside collective tilt, as passing a 3D
thrust setpoint vector beside the tilt is not feasible.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-03-06 22:43:41 +01:00
Silvan Fuhrer
83e906e2e9 Control_allocator_status.msg: remove allocated_ fields
It's enough that the setpoints and the unallocated values are logged, from these
 the allocated values can be calculated if required.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-11-02 14:56:13 +01:00
Silvan Fuhrer
f44713e8a3 ControlAllocator: enable custom saturation logic to override default one
Custom saturation logic currently implemented for Tiltrotor VTOL and Helicopter.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-11-02 14:56:13 +01:00
Silvan Fuhrer
2e20fb7f97 ActuatorEffectiveness: add _collective_ keyword to controls for collective tilt to disinct from yaw tilt
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-11-02 14:56:13 +01:00
Silvan Fuhrer
6db92b4011 ControlAllocation: remove actuator trim value from actuator_sp to calculate allocated control
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-10-04 07:51:25 +02:00
Beat Küng
d948fcd72b fix control_allocator: check if 2. thrust and torque sp topic is valid
Otherwise the 2. setpoint is equal to the first one. This is only an issue
if the 2. instance isn't advertised.
2022-09-21 15:11:11 +02:00
Daniel Agar
a7bbcd5b04 delete lib/mixer and mixer_module static mixing 2022-09-09 09:14:09 -04:00
Beat Küng
4087c27e84
control_allocator: handle saturation flags for helicopters 2022-09-07 08:00:27 +02:00
alexklimaj
aa8d594e9b
Add heli servo trim 2022-09-07 08:00:27 +02:00
Matthias Grob
667e99be81
Helicopter: fix unit test after default throttle curve was changed 2022-09-07 08:00:27 +02:00
Matthias Grob
115cf4d572
Helicopter: More intuitive yaw direction configuration for the common cases 2022-09-07 08:00:27 +02:00