Commit Graph

494 Commits

Author SHA1 Message Date
Matthias Grob 7c7d980cf0 FlightTasks: fix takeoff trigger for offboard 2019-05-22 22:05:38 +02:00
Matthias Grob e73218d665 mc_pos_control/FlightTasks: trigger takeoff based on task
The initial idea of the flight task architecture was that
a task can freely set it's setpoints and doesn't have to
worry about takeoff and landing. It would just takeoff
when it's landed and there's a setpoint to go up and
land when it puts a setpoint that pushes into the ground.
With the takeoff logic there are some significant interface
problems depending on the way a task is implemented:
From the setpoint is not high enough to trigger to
an unexpected takeoff because of some estimator
fluctuation affecting the setpoint. It's easiest to solve this
by allowing the task to determine when a takeoff is triggered.
If no condition is implemented by default a task is not
allowing a takeoff  and cannot be used to get the vehicle
off the ground.
2019-05-22 22:05:38 +02:00
bresch feefbb444b ManualSmoothVel - Remove unused _param_mpc_jerk_min declaration 2019-05-17 14:15:29 +02:00
bresch b726d8df0d Add jerk parameter for auto mode MPC_JERK_AUTO. Specify when a parameter is only used in a certain manual or auto mode 2019-05-17 14:15:29 +02:00
Julian Oes 9d8015d029 modules/lib: ignore address-of-packed-member
For now we need to ignore this warning which GCC 9 shows for the MAVLink
headers.
2019-05-16 13:06:25 +02:00
Matthias Grob 21194239c7 FlightTaskAuto: revisit yaw rate limit
There were multiple comments not addressed in pr #11904.
See commit 4bcb37f9bc9ef20b521ebcf33e7a0ed08fa86ccd
2019-04-26 18:58:50 +02:00
bresch 89bc68e12b Auto - Rename MC_YAWRAUTO_MAX -> MPC_YAWRAUTO_MAX 2019-04-26 12:43:26 +02:00
bresch 581d25f77f Auto mode traj - limit yaw setpoint rate of change when generated in the flight task instead of clamping the yaw rate in the controller
Move yaw setpoint slew rate from AutoLineSmoothVel to Auto. The slew rate is now applied consistently to all the auto FlightTasks
2019-04-26 12:43:26 +02:00
Martina Rivizzigno eba0bb389a ObstacleAvoidance: fix comment, update failsafe position if one axis is NAN 2019-04-24 08:54:50 +02:00
Martina Rivizzigno e037edd2cc ObstacleAvoidance: once the commadand loiter has been sent, keep using
the first position when the oa fails as setpoint to avoid jumps
2019-04-24 08:54:50 +02:00
baumanta c0a1f5b72f Collision prevention improvements (#11866)
* match max vel in col-prev to regular pos ctrl
* change warning criterium to avoid float error
* disable push back from obstacles
* use floats consistently
2019-04-17 13:20:29 -04:00
bresch 93d52581ef Auto - Fix cruise speed. Tested with and without SDK. Before that commit, the drone files at max speed instead of cruise speed if not precised by the SDK 2019-04-15 16:32:26 +02:00
Julian Oes e88f1b33b2 FlightTasks: fix mission DO_CHANGE_SPEED
This fixes the issue where the  DO_CHANGE_SPEED command was ignored and
the drone always travelled at the MPC_XY_CRUISE velocity.
2019-04-12 15:47:36 +02:00
Matthias Grob 1454694bdd FlightTaskAuto: separate default speed and limit
It wasn't possible to fly faster than cruise speed even if planned
in the mission.

Limiting the planned cruise speed is necessary because
the smoothed trajectory mission plans to the _mc_cruise_speed and
if that's higher than the maximum it gets capped for safety by the
position controller and the result is a jerky flight.
2019-04-12 15:47:36 +02:00
Martina Rivizzigno 6f5c97f184 ObstacleAvoidance: do not check for loiter nav state twice 2019-04-04 16:41:26 +02:00
Martina Rivizzigno 0dab5d3a11 ObstacleAvoidance: enforce camel case 2019-04-04 16:41:26 +02:00
Martina Rivizzigno c5dfcbc50e cosmetics changes to ObstacleAvoidance library 2019-04-04 16:41:26 +02:00
Martina Rivizzigno e5441a6565 make format 2019-04-04 16:41:26 +02:00
Martina Rivizzigno 34c0bb1723 ObstacleAvoidance: don't inject avoidance setpoint when in
loiter mode since it's the failsafe mode
2019-04-04 16:41:26 +02:00
Martina Rivizzigno 0e27b5cbfa include libraries without the need for full path, make ObstacleAvoidance
instance protected
2019-04-04 16:41:26 +02:00
Martina Rivizzigno 4dcc77b822 ObstacleAvoidance: remove printf and remove unnecessary new lines 2019-04-04 16:41:26 +02:00
Martina Rivizzigno c1258931da rename updateAvoidanceWaypoints->updateAvoidanceDesiredWaypoints and
updateAvoidanceSetpoints->updateAvoidanceDesiredSetpoints
2019-04-04 16:41:26 +02:00
Martina Rivizzigno b165c41737 ObstacleAvoidance: add comments 2019-04-04 16:41:26 +02:00
Martina Rivizzigno aa1b46f85a ObstacleAvoidance library: save current waypoint in global variable
to check progress
2019-04-04 16:41:26 +02:00
Martina Rivizzigno 94f73117c7 reintroduce obstacle avoidance failsafe. If OA fails, switch to loiter 2019-04-04 16:41:26 +02:00
Martina Rivizzigno e464502d2d remove empty_trajectory_waypoint and getter method for avoidance
waypoints in FlightTasks. In obstacle avoidace library reset desired
avoidance waypoints after publication
2019-04-04 16:41:26 +02:00
Martina Rivizzigno 34b0f33098 move all obstacle avoidance interfaces to the ObstacleAvoidance library 2019-04-04 16:41:26 +02:00
Martina Rivizzigno 4e806d79fe inject avoidance setpoints into AutoMapper 2019-04-04 16:41:26 +02:00
Martina Rivizzigno 320ed40806 use subscription array in ObstacleAvoidance library 2019-04-04 16:41:26 +02:00
Martina Rivizzigno a9bab81eb8 make format 2019-04-04 16:41:26 +02:00
Martina Rivizzigno 8c24ba9255 move injection of avoidance setpoints to flight task library 2019-04-04 16:41:26 +02:00
bresch dec96b0a3a revert FlightTasks: fix mission DO_CHANGE_SPEED 2019-04-03 18:08:24 +02:00
bresch 20adce5077 Add new line at the end of FlightTaskFailsafe.cpp and FlightTaskAutoLine.cpp 2019-04-03 15:38:50 +02:00
bresch b14446f0e5 Parameter update - Rename variables in lib
using paramter_update.py script
2019-04-03 15:38:50 +02:00
Julian Oes a21242b0e3 FlightTasks: fix mission DO_CHANGE_SPEED
This fixes the issue where the  DO_CHANGE_SPEED command was ignored and
the drone always travelled at the MPC_XY_CRUISE velocity.
2019-04-03 11:21:12 +02:00
bresch 99fb88ce83 AltitudeSmoothVel - Create new altitude flight task that uses the
velocity smoothing library to create a jerk-limited trajectory along the
Z axis. This FlightTask is used when MPC_POS_MODE = 3.
2019-04-03 10:43:31 +02:00
bresch a08b1682e3 [Position|AutoLine]SmoothVel - Update position and velocity states of the trajectories in case of EKF reset. Until now, only the position reset on XY axis was properly handled. Now, xy, vxy, z and vz are handled 2019-03-20 14:35:26 -04:00
bresch 0813f30723 AutoLineSmoothVel - change function contrain_one_side(..) from snake_case to camelCase 2019-03-20 14:35:26 -04:00
bresch aecf8fce58 ManualPositionSmoothVel - Force velocity and acceleration setpoints to zero if the velocity setpoint is smaller than 1mm/s and that the acceleration setpoint is null 2019-03-18 08:33:11 +01:00
bresch 1fefa76e5d ManualSmoothVel - Set jerk to 1.0 during position hold to help the optimizer to converge towards 0 vel and acc 2019-03-18 08:33:11 +01:00
bresch 06f683bdda VelocitySmoothing - Add simple test script 2019-03-18 08:33:11 +01:00
bresch b9cf4dfb6c VelocitySmoothing - Get rid of math.h, math.cpp and px4_defines dependencies 2019-03-18 08:33:11 +01:00
bresch ddab0ccdf1 VelocitySmoothing - Protect against division by zero and sqrt of a negative number 2019-03-18 08:33:11 +01:00
Daniel Agar b35d048566 cmake enable -Wcast-align and disable per module 2019-03-16 11:47:15 -04:00
bresch c5706f6283 FlightTaskAuto - Recover position control after local position reset (#11636)
* FlightTaskAuto - Explicitly check is _triplet_target is finite to decide if the target has to be updated or not. If the _target is NAN, always try to update it to get a valid setpoint.
2019-03-15 00:42:24 -04:00
baumanta d42b9205f9 Rename parameter MPC_OBS_AVOID to COM_OBS_AVOID and change the location to commander. 2019-03-12 11:24:33 +01:00
Matthias Grob f794ee0c8a FlightTaskManualAltitude: add slow upwards start
when still close to ground
2019-03-11 20:09:45 +01:00
Matthias Grob 63a6ab34f7 FlightTaskManualAltitude: slow down when landing manually 2019-03-11 20:09:45 +01:00
BazookaJoe1900 8947cb5841 FlightTaskAuto: removed non used _getMaxCruiseSpeed 2019-03-10 11:17:21 -04:00
bresch f229444722 ManualSmoothVel - Split position lock condition and flag action 2019-02-25 21:41:04 +01:00