42 Commits

Author SHA1 Message Date
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
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
Matthias Grob
5ca28dd6dc Use isAllFinite() in all places that check finiteness on entire vectors or matrices 2022-10-19 19:09:20 +02: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
Daniel Agar
0a5c9d4951 position_setpoint delete unused landing_gear 2022-09-19 11:16:45 -04:00
Daniel Agar
11dd924bd4 position_setpoint delete unused SETPOINT_TYPE_FOLLOW_TARGET 2022-09-19 11:16:45 -04:00
mcsauder
87a5705960 Rename math::gradual() to math::interpolate() and add unit tests to cover additional corner cases. 2022-08-18 14:18:02 +02:00
Silvan Fuhrer
55f395a7e9
FlightTaskAuto: apply cruise speed from position triplet also when negative (#20006)
Navigator sets the cruise_speed to -1 if the controller shouldn't listen to
it and instead use the default speed (for MC: MPC_XY_CRUISE). This is for
example for RTL the case, where we want to return at the default speed,
independetly of what the mission speed before was.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-08-04 13:36:15 +02:00
Daniel Agar
a73efd9c4f NuttX carry minimal c++ cmath (replacing Matrix stdlib_imports.hpp) 2022-07-12 08:05:06 -04:00
RomanBapst
42cd0b4ce0 FlightTaskAuto: don't override landing gear state for takeoff
- this allows landing gear to retract automatically when doing a takeoff
and the vehicle is considered high enough

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-07-06 11:11:14 +02:00
Matthias Grob
54145cedc7 FlightTask: Weather vane cleanup
Remove the entire external yaw handler, dynamic memory allocation,
pointer passing logic. Directly instanciate the weather vane instance
in the flight tasks that support it.
2022-06-22 14:19:28 +02:00
Matthias Grob
8ca28f3796 Separate message for trajectory setpoint 2022-05-12 17:19:48 +02:00
Silvan Fuhrer
680fe86c05 FlightTaskAuto: fix Weather Vane during landing
Weather vane should only set a yawrate setpoint, but no yaw setpoint.
Setting it to NAN when WV is active makes sure that whatever _yaw_setpoint
is set previously (e.g. through Waypoint) is not used.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-04-23 18:14:42 +02:00
Matthias Grob
97b2947416 FlightTaskAuto: refactor _commanded_speed_ts -> _time_last_cruise_speed_override 2022-04-13 12:23:27 +03:00
Matthias Grob
68cf686892 FlightTask: rename and move setCruisingSpeed() -> overrideCruiseSpeed() 2022-04-13 12:23:27 +03:00
RomanBapst
d41de33a85 FlightModeManager: handle MAV_CMD_DO_CHANGE_SPEED
- support setting the cruise speed of the auto flight task via command

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2022-04-13 12:23:27 +03:00
Junwoo Hwang
f78465428c Stick Verbose Functions : Edit other FlightTasks using checkAndUpdateStickInputs() functions and correct Throttle returned value inverse issue 2022-03-23 11:54:05 +01:00
Silvan Fuhrer
f4c300af25 FlightTaskAuto: Nudging: only set yawrate_sp if WV is disabled or stick out of dead-zone
Otherwise the setpoint from weather vane is constantly overwritten by it,
even if the yaw stick is not moved.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-03-11 09:18:31 +01:00
bresch
a3b2550f07 mc_auto: only check for offtrack, infront and behind in XY-plane
This fixes the issue when changing the altitude during a goto for
example, where the vehicle was going backwards and upwards to reach the
closest point to the line. Now the vehicle simply goes towards the
target waypoint.
2022-02-11 16:14:48 +01:00
Thomas Debrunner
fb8b9b647a land-detector: switch to crawl speed for intent detection 2022-02-04 21:56:20 -05:00
Thomas Debrunner
2a6d9bc1dd fligh-mode-manager: First implementation of a three-stage-landing for multirotos, in case LIDAR is available 2022-02-04 21:56:20 -05:00
Matthias Grob
8525a8e520 FlightTaskAuto: fix typo pos(i)tion 2022-01-25 11:45:31 +01:00
Matthias Grob
443406ea2b FlightTaskAuto: use longerThan() when possible in vector calculations 2022-01-12 15:12:24 +01:00
bresch
4fc7348582 mpc: leave room for altitude error control during descent and descent
Since the same parameter is used to generate the trajectory and to
saturate the controller, there is no additional space for the output of
the position controller once it is filled with the feedforward, letting
the altitude grow uncontrolled.
2022-01-12 13:33:48 +01:00
bresch
ea7d2334c9 mpc: add parameter for ascent/descent speed in auto modes 2022-01-12 13:33:48 +01:00
Matthias Grob
bbad4a5397 FlightTaskAuto: Respect altitude with offtrack state
To avoid weird cases where the altitude is different enough and
the offtrack state flies to the target altitude instead of the closest
point on the track between the waypoints.
2022-01-07 10:30:39 -05:00
Silvan Fuhrer
b00ebe53bb FlightTaskAuto: use MPC_VEL_MAX instead of MPC_XY_CRUISE for emergency braking thresholds
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-12-08 09:13:01 +01:00
Thomas Debrunner
8db7a6225b geo: Moved the map_projection_* functions and state into a self-contained C++ class 2021-12-06 14:30:14 +01:00
Thomas
9345f68a93 reapply PR 18614 to refactored FlightTaskAuto 2021-11-30 14:52:16 +01:00
Matthias Grob
35d4986ea7 FlightTasks: remove updateFinalize() concept because it got obsolete 2021-11-18 19:12:44 -05:00
Matthias Grob
9eac0edbc0 FlightTaskAuto: remove generateSetpoints function, replace by implementation 2021-11-18 19:12:44 -05:00
Matthias Grob
ece8fdddec FlightTaskAuto: simplify early setpoint preparation based on triplet type 2021-11-18 19:12:44 -05:00
bresch
4a14a8bc7f AutoLineSV: Always publish a valid yaw setpoint
In MPC_YAW_MODE 3 (along trajectory), the flight task is asked to
produce a yaw setpoint. If the previous yaw value was NAN (e.g.: during
early takeoff), the setpoint should then be reset to the current
estimate.
2021-11-16 18:09:37 -05:00
bresch
f751dd2242 FlightTask: set yaw_setpoint to NAN when yaw should not be controlled 2021-11-16 18:09:37 -05:00
Matthias Grob
179b1cdf56 FlightTaskAuto: merge activate(), reActivate() and update() from FlightTaskAutoLineSmoothVel 2021-11-16 10:08:47 +01:00
Matthias Grob
51ebb0f294 FlightTaskAuto: move in helper methods from FlightTaskAutoLineSmoothVel 2021-11-16 10:08:47 +01:00
Matthias Grob
50e13f132f FlightTaskAuto: move in members from FlightTaskAutoLineSmoothVel 2021-11-16 10:08:47 +01:00
Matthias Grob
7ec8dd9d23 vehicle_constraints: remove deprecated speed_xy constraint 2021-11-09 21:47:06 -05:00
Matthias Grob
b40dbd3d6f FlightTaskAuto: hotfix filter for yawspeed feed-forward
to get rid of derivative spikes when navigator is
continuously updating the yaw setpoint in the
triplet for a POI but is running at a lower rate.

The proper solution is to generate that yaw setpoint
with high rate in the flight task and have the triplet
just guid to the next waypoint at low rate.
2021-10-06 14:06:58 -04:00
Matthias Grob
0cc13f0799 FlightTaskAutoMapper: add horizontal and yaw nudging during final descent 2021-10-05 18:05:54 -04:00
Jukka Laitinen
532f370e7d Fix implicit float to double conversions
The both results of ?: should be of same type, and some compilers give error
on this:
	" implicit conversion from 'float' to 'double' to match other result of conditional"

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-05-05 09:31:07 +02:00
Daniel Agar
4d7b875ee2 flight_mode_manager: merge with flight_tasks 2021-01-17 15:46:30 +01:00