222 Commits

Author SHA1 Message Date
Matthias Grob
ebae9ae3d7 FlightTaskManualAccelerationSlow: MC_ prefix for parameter names
As discussed in the maintainer call we should adhere to the
parameter naming scheme that makes it clear what vehicle type the
configuration is good for.
2023-12-08 21:17:59 +01:00
Matthias Grob
da24811ce1 SickAccelerationXY: fix comment typo brak{e}ing 2023-12-08 21:17:59 +01:00
Matthias Grob
54ce9813c8 FlightModeManager: Add task for position slow mode 2023-12-08 21:17:59 +01:00
Matthias Grob
dbbf585adb StickYaw: yaw rate limit interface 2023-12-08 21:17:59 +01:00
Matthias Grob
84220407ea FlightTaskManualAltitude: vertical velocity limit interface 2023-12-08 21:17:59 +01:00
Matthias Grob
bb617f6c4d FlightTaskManualAcceleration: horizontal velocity limit interface 2023-12-08 21:17:59 +01:00
Matthias Grob
77c06a9f9e Sticks: Provide auxiliary analog values from manual_control_setpoint 2023-12-08 21:17:59 +01:00
Matthias Grob
df41bc3d26 StickAccelerationXY: make sure speeds below 1m/s are exactly reached
by only applying the sqrt linear drag when brakeing.
It was originally not done this way to avoid discontinuities and
the exact speed bewlo 1m/s didn't matter. With the position slow mode
the exact slow speeds now matter. And the discontinuities are avoided by
reusing the brake boost filter.
2023-12-08 21:17:59 +01:00
Matthias Grob
8bb20db7da GotoControl: Save flash 2023-11-30 17:16:02 +01:00
Matthias Grob
3de6fee07f GotoControl: make interface over uORB 2023-11-30 17:16:02 +01:00
Matthias Grob
be05b3e8d7 helper_functions: include defines for M_PI_PRECISE
The defintion of the custom symbol M_PI_PRECISE
was not included in one of the only places it's used.
Looks like a mistake that happened in
34c852255e16bb62d2caf0c3be1f2fea660036ba
possibly because a lot of things are included
almost everywhere and if the include order
ligns up there are no compile errors.
2023-11-30 17:16:02 +01:00
Matthias Grob
efb325d25d motion_planning: remove deprecated separate test
It's functionality probably broke already in
befbb6b106c4c04933222ecb205f001fd77fa85f
and the tests are now covered by
VelocitySmoothingTest.cpp
2023-11-30 17:16:02 +01:00
Silvan Fuhrer
2734c44533 FlightTaskAuto: set state to None if prev and current sp are equal
Otherwise if is set to Offtrack, which in turn leads to weird behavior.
E.g. when triggering Land while flying fast forward, the vehcile doesn't
descned to the land point it keeps getting a velocity setpoint from the
smoother that pushes it away from the land point.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-11-27 18:01:47 +01:00
Matthias Grob
9bed8f48c7 Remove LNDMC_ALT_MAX
This should be replaced with the maximum geofence
altitude GF_MAX_VER_DIST. I'm not aware anyone is using
this functionality as is.
2023-11-20 14:52:35 +01:00
Matthias Grob
0dcecf0666 FlightModeManager: avoid internal flight task running concurrently with external mode 2023-11-15 13:18:58 +01:00
alexklimaj
de0910c767 flight mode manager: fix terrain hold 2023-11-07 12:00:14 -05:00
bresch
23b31cc5fd manual_yaw: compensate for yaw estimate convergence
When the yaw estimate is converging, the controller makes the drone yaw
in order to follow the current setpoint. This is unintuitive for the
pilot and it is preferable if the drone continues to fly towards the
same physical direction.
2023-08-30 09:56:19 +02:00
Matthias Grob
632596c1ea FlightTask: correct header comments 2023-07-13 12:00:35 +02:00
Matthias Grob
b7e2a9c320 FlightTaskAltitude: remove duplicate, deprecated yaw stick handling 2023-07-03 09:52:47 +02:00
Matthias Grob
4d465533b5 FlightTaskManualAcceleration: remove duplicate yaw stick handling
It's already instanciated and ran by FlightTaskManualAltitude
which FlightTaskManualAcceleration inherits from.
2023-07-03 09:52:47 +02:00
bresch
616a71a959 MC_auto: avoid yaw step if previous setpoint is NAN
A VTOL plane in MC mode has no yaw setpoint during takeoff because of
weather-vane. To align for the front transition, the yaw target jumps
and caused a step in the controller, making it reach saturation.

With this commit, the previous yaw setpoint is set to the current yaw
when no yaw setpoint is sent in order to create a smooth yaw trajectory
starting at the current orientation when yaw target is suddenly finite.

The yawspeed filter also now contains the yaw speed instead of dyaw in
order to prevent chattering due to dt jitter.
2023-05-12 13:42:09 +02:00
Matthias Grob
5c1e0ddd96 FlightTaskTransition: use new 2D rotation 2023-04-15 21:57:40 +02:00
Matthias Grob
7ebd6cc74f FlightTaskManualPosition: use existing stick library rotation 2023-04-15 21:57:40 +02:00
Matthias Grob
7b850a91b4 Sicks: use new 2D rotation 2023-04-15 21:57:40 +02:00
Matthias Grob
1e94ad19c0 FlightModeManager: rework task starting
with the goal to make it more clear and the error only appear when
armed but every time the running task doesn't actually match
the mapping inside the start_flight_task() function.
2023-04-15 16:45:32 +02:00
bresch
50b084cf17 MC auto: allow yawing during hold 2023-03-31 17:32:33 +02:00
bresch
c7bddda1db MC auto: add maximum RC assist distance during landing 2023-03-22 10:03:48 +01:00
Matthias Grob
b0189d95af Use new Vector4 class 2023-03-21 15:01:26 +01:00
Daniel Agar
9be8f81d75
flight_mode_manager: StickAccelerationXY protect from NAN velocity reset
Co-authored-by: Matthias Grob <maetugr@gmail.com>
2023-03-10 08:17:20 -05:00
Matthias Grob
bd5838faf0 FlightTask: don't instaniate unused parameters 2023-03-09 17:40:55 +01:00
Silvan Fuhrer
16594bffa9 Rework landing gear logic
- remove deprecated actuator_controls[INDEX_LANDING_GEAR]
- remove dead code in mc rate controller that used to prevent it from being retracted
on the ground (anyway had no effect as it only affected the actuator_control[LANDING_GEAR]
which wasn't sent to the control allocation)
- for VTOLs handle deployment/retraction of landing gear in AUTO  as a MC (retract if
more than 2m above ground, deploy if WP is a landing WP), plus additionally when transition
flight task is called (ALTITUDE mode and higher)
- for FW in AUTO: add logic in FW Position Controller, depending on waypoint type mainly
- manual landing gear settings always come through (a manual command overrides a previous
auto command, and vice-versa)

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-03-06 22:43:41 +01:00
Matthias Grob
0770478dc7 FlightTaskDescend: Enable nudging by sticks when it's enabled
and stick input is available.
2023-03-02 12:06:40 +01:00
Matthias Grob
728570828f FlightTaskManualAltitude: use StickTiltXY for horizontal stick mapping 2023-03-02 12:06:40 +01:00
Matthias Grob
21d580293a StickYaw: use consistently for all flight tasks
- Switching to the first order filter that was previously
only in FlightTaskManualAltitude.
- Moving the scaling of full stick deflection to
radians per second into the class.
2023-03-02 12:06:40 +01:00
Matthias Grob
0c1f340154 StickAccelerationXY: improve comments 2023-03-02 12:06:40 +01:00
Matthias Grob
da4644c20a Sticks: only use stick input if flagged valid
and add a function for just pitch roll stick input
2023-03-02 12:06:40 +01:00
Matthias Grob
1dada5daf4 Add StickTiltXY utility class to FLightTasks
to map stick input to vehicle tilt consistently and reliably across modes.
2023-03-02 12:06:40 +01:00
alessandro
3e149ee6c5
FlightTaskAuto: landing position updates for precision landing (#20951)
- precision landing works incorrectly, target position is not updated during the descent above target
 - _prepareLandSetpoints needs to update _land_position continuously

Co-authored-by: kapacheuski <kapacheuski@gmail.com>
2023-02-07 12:07:26 -05:00
Daniel Agar
45912066d2 fix copyright header year range 2023-01-14 09:16:16 -05:00
Matthias Grob
a7c03de434 StickAccelerationXY: apply jerk limit after drag 2023-01-13 10:19:43 +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
83246c84cf Switch manual_control_setpoint.z scaling from [0,1] to [-1,1]
To be consistent with all other axes of stick input and avoid future
rescaling confusion.

Note: for the MAVLink message 69 MANUAL_CONTROL it's using the full range
according to the message specs now [-1000,1000].
2022-11-28 19:25:55 +01:00
Beat Küng
b0e1cc72f7 fix orbit for mc: handle VEHICLE_CMD_DO_ORBIT command and avoid race condition
Fixes a regression from 8bae4e5c0e29f70d5d1d2427ffdef97092be939c, where
the orbit flight task wasn't an extra task (flight_tasks_to_add) anymore
and therefore the command handling wasn't generated.

There was a race condition that could cause several outcomes. The most severe
was that flight_mode_manager gets the command, switches to orbit and then
in the next iteration switches back because commander did not change
nav_state yet. When commander then switches, flight_mode_manager would still
be in the old mode.
This is prevented by storing the command (allowing it to arrive before or
after mode switch), and then apply it after the switch happens.
2022-11-14 17:31:35 +01:00
Beat Küng
c1f9824396 flight_mode_manager: remove command ack for VEHICLE_CMD_DO_ORBIT
Already acked in commander
2022-11-14 17:31:35 +01:00
Matthias Grob
5ca28dd6dc Use isAllFinite() in all places that check finiteness on entire vectors or matrices 2022-10-19 19:09:20 +02:00
Matthias Grob
75c63aee2a Fix confusion between trajectory_setpoint and vehicle_local_postion_setpoint 2022-10-17 16:18:00 -04:00
Silvan Fuhrer
5ea8c6e507 FlightTaskAuto: remove unused _getTargetVelocityXY()
Inclusive velocity_valid field in position_setpoint message that's then
no longer needed.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-10-17 16:12:15 -04:00
Beat Küng
d542ffc10c refactor vehicle_status_flags: rename to failsafe_flags 2022-10-13 16:05:25 -04:00
Beat Küng
38d3739b6d refactor commander: rename rc_signal_lost -> manual_control_signal_lost, data_link_lost -> gcs_connection_lost 2022-10-11 22:31:20 -04:00
Beat Küng
e4bb219d10 vehicle_status_flags: cleanup message, move non-failsafe flags to vehicle_status 2022-10-11 22:31:20 -04:00