581 Commits

Author SHA1 Message Date
Daniel Agar
045f6233d4
FlightTasks: switch to uORB::Subscription
- delete SubscriptionArray
 - all FlightTasks are now responsible for updating their own subscriptions (typically in updateInitialize()).
2019-09-30 18:16:36 -04:00
Matthias Grob
6a5ca6e336 FlightTask: use inline assignment initializer for reset_counters struct 2019-09-24 10:34:08 +02:00
bresch
679b1659eb AutoLineSmoothVel - Reorganize functions declarations to match cpp file 2019-09-24 10:34:08 +02:00
bresch
c811cf4784 FlightTask - Move ekf reset counter monitoring logic in the base FlihtTask
Each child FlightTask can simply implement what it wants to do in case
of an EKF reset event by overriding one of the _ekfResetHandler functions
2019-09-24 10:34:08 +02:00
bresch
6f3868b5ba ManualVelocitySmoothing - Fix unlock initialization 2019-09-19 17:31:49 +02:00
bresch
0153e1b126 Matrix - Explicitly cast array[3] to Vector3f
Use .xy() for Vector2 -> Vector3 assignment
2019-09-19 17:31:49 +02:00
bresch
f405bf506b AltitudeSmoothVel - Use ManualVelocitySmoothingZ class instead of re-implementing the logic 2019-09-19 17:31:49 +02:00
bresch
ce96d98621 ManualVelocitySmoothing - Cosmetic changes (renaming, indentation,..)
Set the classes as final and set destructor to non-virtual
2019-09-19 17:31:49 +02:00
bresch
7cdb2364e9 ManualVelocitySmoothingXY - Add simple unit test 2019-09-19 17:31:49 +02:00
bresch
f5d7eb4d87 Refactor FlightTaskManualPositionSmoothVel 2019-09-19 17:31:49 +02:00
bresch
080eedfd02 ManualPositionSmoothVel - Split large function into smaller ones, split XY and Z axes
Next step is to move as much as possible to a library in order to
reuse the Z axis in the Altitude FlightTask
2019-09-19 17:31:49 +02:00
Dennis Mannhart
453b6a39e4 TrajMath: move from FlightTasks/Utility into mathlib library because the function is also used by other libraries 2019-09-19 14:09:44 +02:00
Dennis Mannhart
e6b7062442 TrajMath: replace type placeholder with floats 2019-09-19 14:09:44 +02:00
Matthias Grob
270e12a4df VelocitySmoothing: refactor local scope t variables instead of array 2019-09-17 09:27:00 +02:00
bresch
da8ac8cafb VelocitySmoothing - Clean up updateTraj function based on Matthias' comments 2019-09-17 09:27:00 +02:00
bresch
b82fa68893 VelocitySmoothingTest - Fix typo and use "zero" instead of "null" 2019-09-17 09:27:00 +02:00
bresch
42cedb7fda VelocitySmoothing - Change direction of "brake" as braking means that
only the T3 part is required and that the jerk applied during T3 is the
opposite of the one defined by "_direction".
2019-09-17 09:27:00 +02:00
bresch
8490266be8 VelocitySmoothing - (Re)set _state_init every time _state is (re)set 2019-09-17 09:27:00 +02:00
bresch
654938f6a1 VelocitySmoothing - Cosmetic changes (new lines, reorganize functions),
regroup both updateTraj functions and edit some comments
2019-09-17 09:27:00 +02:00
bresch
0b765a1642 AltitudeSmoothVel - Update to use new implementation of VelocitySmoothing
Remove jerk reduction (not needed in the new implementation)
2019-09-17 09:27:00 +02:00
bresch
862454827e VelocitySmoothingTest - Test that the trajectory is always within the constraints 2019-09-17 09:27:00 +02:00
bresch
8cc2a7018e VelocitySmoothing - Re-enable time stretch, integrate dt to get local time.
Also split a few functions into smaller ones for readability, fix
formatting, use geters to get the current state of the trajectory
instead of return arguments.
2019-09-17 09:27:00 +02:00
bresch
c7696488fe VelocitySmoothing - Improve computation of the direction of the trajectory by predicting the velocity at zero acceleration instead of the current velocity
This helps when the current velocity is smaller than the target but that
the acceleration is too large such that the velocity will overshoot.
Without this check, the algorithm increases the acceleration which leads
to an even larger overshoot.
2019-09-17 09:27:00 +02:00
bresch
052932fa95 VelocitySmoothingTest - Update unit test to use the same parameters ordering (time, setpoint) as the VelocitySmoothing class 2019-09-17 09:27:00 +02:00
bresch
c13499e64b test_velocity_smothing - Update test script to use new polynomial evaluation algorithm 2019-09-17 09:27:00 +02:00
bresch
a03cc495ce VelocitySmoothing - Refactor class to use polynomial evaluation instead of numerical integration
This solves many numerical issues when the trajectory is close to the
primary NE axes (small velocities). It is also more robust when dt is
large and has some jitter.
2019-09-17 09:27:00 +02:00
Matthias Grob
d4f984fea5 FlightTaskAutoLineSmooth: Fix comment to be style compliant 2019-09-13 18:10:05 +02:00
bresch
47401d1177 AutoLineSmoothVel - Replace min/max absolute constraints with a function named constrainAbs
This function constrain the absolute value of some value but keeps the original sign.
2019-09-13 17:46:01 +02:00
bresch
3c5b24037a AutoLineSmoothVel - Improve virtual pilot logic that provides velocity setpoints to the trajectory generator.
Constrain the generated velocities in the NE inertial frame rather than
just constraining the norm.
2019-09-13 17:46:01 +02:00
Martina Rivizzigno
78279f6587 Unit tests for Obstacle Avoidance interface (#12816)
* FlighTask: remove legacy definition of empty_trajectory_wapoint

* add unit tests for the ObstacleAvoidance interface
2019-09-12 14:37:31 +02:00
Matthias Grob
d3c7d06288 FlightTaskOrbit: don't apply yaw feed forward in circle approach
The yaw pointing towards the center makes sense since that's the approach
direction anyways. But with the yaw feed forward results in a weird looking
bias when not orbiting yet.
2019-08-31 14:25:39 +02:00
Matthias Grob
7774b150a9 FlightTaskOrbit: only reapproach circle if center changed
The condition that the vehicle is more than 3m away from the circle line
was too sloppy. That often happens when the radius is changed by sticks.
A reapproach is only necessary when the center is moved and that's only
possible through the orbit command.
2019-08-31 14:25:39 +02:00
Matthias Grob
cca7596bcd FlightTaskOrbit: use StraightLine library to approach circle
The initial approach to the circle to orbit on was very agressive since
it was just the controller trying to stay on the circle reaching the
limits. Now there's first an approach phase in which the vehicle reaches
the circle trajeectory in a smooth perpendicular line before starting the
orbit execution.
2019-08-31 14:25:39 +02:00
Matthias Grob
345ad06d7e StraightLine: rewrite old implementation
Before it was:
- not used anywhere
- copied from an old mission implementation version
- didn't plan in advance
- had a lot of broken cases
- dependent on a lot of parameters

I'm starting with a new relatively simple implementation that works as
expected for a minimum viable implementation and can be improved over time.
The first version is used to approach the circle path in Orbit mode to
verify the interface and get testing such that it gets eventually used
everywhere.
2019-08-31 14:25:39 +02:00
bresch
fe73cef224 TestVelocitySmoothing - Split time synchronization and final state checks into two different test functions
Also improve the comments
2019-08-29 15:20:53 +02:00
bresch
94d15931f2 TestVelocitySmoothing - Remove useless function override, use ceil instead of ceilf and remove line duplicate 2019-08-29 15:20:53 +02:00
bresch
5b82fa3a0f TestVelocitySmoothing - add check for time synchronization and final acceleration 2019-08-29 15:20:53 +02:00
bresch
f40d571858 VelocitySmoothing - add zero setpoint test 2019-08-29 15:20:53 +02:00
bresch
c59bcc686c VelocitySmothing - Add gtest script 2019-08-29 15:20:53 +02:00
roangel
1e510f5a44 [FlightTasks] Added class enum for FlightTasks errors (#12822) 2019-08-29 14:48:52 +02:00
bresch
f4b40865af SmoothVel - Fix altitude lock logic.
It was broken because _velocity_setpoint is used for input and output
and was assumed to be the input at a place where it was already overwitten
To clarify this, the input setpoint is renamed "target"
2019-08-22 16:43:41 +02:00
Silvan Fuhrer
ab28f1e4f7 Navigator: VTOL: disable weather vane during yaw aligning before front transition
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2019-08-21 10:08:04 +02:00
baumanta
af0d63250c check velocity_setpoint instead of sticks in altitude mode 2019-08-21 10:02:40 +02:00
baumanta
d168d5049f check vel_setpoint instead of stick input for position lock 2019-08-21 10:02:40 +02:00
bresch
4eb9c7d812 Create TrajMath library and move waypoint speed calculations in it 2019-08-09 12:04:48 +02:00
bresch
b1698b78bc AutoSmoothVel - scale down acc_hor using traj_p parameter in the computation of the maximum waypoint entrance speed 2019-08-09 12:04:48 +02:00
bresch
de10f1e04d MC auto - Modify yaw_sp_aligned to take mis_yaw_error tolerance.
Add check for this flag in AutoLine
2019-08-09 12:04:48 +02:00
Dennis Mannhart
9e9b2ab9e8 FlightTaskAutoLine/SmoothVel: stop at waypoint if altitude is has not been reached yet 2019-08-09 12:04:48 +02:00
bresch
255c911155 AutoSmoothVel - Compute desired speed at target based on angle between previous-current and current-next waypoints
Also remove crosstrack P controller that produces overshoots when the
acceptance radius is large (crosstrack error is suddenly large at
waypoint switch).
2019-08-09 12:04:48 +02:00
bresch
50fbb56737 Yaw mode 3 - Add check for minimum distance to target in MPC_YAW_MODE 3 (along trajectory) to be consistent with the other yaw modes 2019-08-07 10:30:34 +02:00