Commit Graph

1458 Commits

Author SHA1 Message Date
MaEtUgR 6472b579dc FlightTaskOrbit: switch rotation direction
Switch to positive tangential velocity being clockwise because with NED
frame z-axis points down and mathematically positive around the z-axis
results in clockwise yaw rotation when seen from above. Also MAVLink
messages and other components in PX4 are defined this way.
2018-07-24 15:03:53 +02:00
MaEtUgR 8d88fa2fca FlightTasks: fix multiple comments 2018-07-24 15:03:53 +02:00
MaEtUgR 675b6bbabc mathlib: fix comment typo 2018-07-24 15:03:53 +02:00
MaEtUgR 3b7d31de75 FlightTasks: reintroduce vehicle command handling
The handling for vehicle commands inside the FlightTasks library
was already there but commented out because the previously used
MAVLink messages were tied to the specific application we used and
there was no clean common message definition. Because there is now
a well defined message for the orbit task I'm uncommenting and using
the working message handling again here.
2018-07-24 15:03:53 +02:00
Matthias Grob 93bab20510 FlightTaskOrbit: switch to FlightTaskAltitudeSmooth
Nice smooth altitude control is already provided by the existing
flight task for altitude mode. We inherit from it to resuse the
functionality and just all its update first not altering the setpoints
for the z-axis it produced.
2018-07-24 15:03:53 +02:00
Matthias Grob ce49ac0259 FlightTaskOrbit: better member descriptions 2018-07-24 15:03:53 +02:00
Matthias Grob 26e3dbec2e FlightTaskOrbit: name member constants start with underscore 2018-07-24 15:03:53 +02:00
Matthias Grob 2b6926fe9d FlightTaskOrbit: speed up stick input to a fixed time frame
Maximum velocity achievable in 4 seconds,
maximum radius achievable in 8 seconds for futher testing.
These should be parameters as soon as it works fine.
2018-07-24 15:03:53 +02:00
Matthias Grob 33ba041120 FlightTaskOrbit: improve yaw tracking with feed-forward
To make the vehicle front always point exactly to the center and not
lag behind.
2018-07-24 15:03:53 +02:00
Matthias Grob c2223030d9 FlightTaskOrbit: add acceleration limit & unify checks 2018-07-24 15:03:53 +02:00
Matthias Grob 79aaa59715 FlightTaskOrbit: adapt comments to convention and 2018 2018-07-24 15:03:53 +02:00
Matthias Grob 993d76c0da FlightTaskOrbit: fix vehicle yawing to the center
I accidentally swapped yaw setpoint and yawspeed setpoint when switching
to the new setpointinterface in 309237c4a2
2018-07-24 15:03:53 +02:00
ChristophTobler 99e58e2923 FlightTask StraightLine: make format 2018-07-24 08:40:05 +02:00
Matthias Grob 7e547e6322 FlightTask StraightLine: use 2D Vector and remove newline 2018-07-24 08:40:05 +02:00
ChristophTobler ccd8a47015 FlightTask StraightLine: set origin and target at the same time
This avoids issues with reseting/calculating the max vel/acc
2018-07-24 08:40:05 +02:00
ChristophTobler 9e8c3ff0dc FlightTask StraightLine: check if target and origin are the same 2018-07-24 08:40:05 +02:00
ChristophTobler 8998714130 FlightTask StraightLine: remove unused target reached flag 2018-07-24 08:40:05 +02:00
ChristophTobler 090db6a115 FlightTask StraightLine: set max vel/acc/dec if value is bigger 2018-07-24 08:40:05 +02:00
ChristophTobler c619009364 FlightTask StraightLine: replace powf(x,2) with x*x
Apparently this is faster
2018-07-24 08:40:05 +02:00
ChristophTobler 8b3716c0df FlightTask StraightLine: remove 10% safety margin 2018-07-23 12:54:39 +02:00
ChristophTobler 7e0976f0ef FlightTaskStraightLine: fix braking distance corner cases
check if target vel is bigger than desired vel
accelerate if already inside braking distance but vel is lower
2018-07-23 12:54:39 +02:00
ChristophTobler e527a51de6 FlightTaskStraightLine: add descriptions for defines 2018-07-23 12:54:39 +02:00
ChristophTobler 37d4f714b2 FlightTaskStraightLine: replace define with parameter 2018-07-23 12:54:39 +02:00
ChristophTobler ebceac5fff FlightTasks: add lib for setpoints on a straight line 2018-07-23 12:54:39 +02:00
Daniel Agar b1d3bb0403 stop ignoring Wmissing-field-initializers and fix (#9912) 2018-07-22 12:45:52 -04:00
Paul Riseborough 73a7aa75a8 FlightTasks: update terrain hold transition logic.
Use pre-existing MPC_HOLD_MAX_XY parameter for speed threshold.
Use _stick_expo variable for stick movement check.
Update documentation.
2018-07-22 17:42:31 +10:00
Paul Riseborough 2baa6caacb FlightTasks: Fix transition between use of local and ground height (+2 squashed commits)
Squashed commits:
[ed2a243] FlightTasks: Preserve control loop tuning when applying max altitude limit
[b33b947] FlightTasks: Add terrain hold function

This new mode of altitude control uses terrain following when holding position and normal altitude control when moving.
2018-07-22 17:42:31 +10:00
Kurt Kiefer fc16dce8f1 spektrum_rssi: initialize rssi lookup as constexpr
Rather than initializing the rssi percentage lookup table at runtime
on the heap, we would like it to be stored in flash.

This change pre-computes the rssi lookup table.
2018-07-22 08:42:30 +02:00
Kurt Kiefer 597372bec9 Gather RSSI data from Spektrum Telemetry receivers
On SPM4649T receivers with firmware versions at least 1.1RC9, the
serial data will contain an rssi value in dbm, as outlined in the
Remote Receiver Interfacing document section 8.3.1.

If the value received is greater than or equal to zero, the receiver
does not support rssi data, and the incoming value will be ignored.
However, if the value is negative, we can use the rssi value.

When we have a valid rssi, it gets mapped to a percentage from 0 to
100 as expected by mavlink. This mapping is constructed as a
logarithmic function over Spektrum's published minimum and maximum
rssi values, -92dBm to -42dBm as 0 to 100:
100 Log10[1 + (x - min) * (9 / (max - min))]

This change updates all calls to the dsm input rountes to return
the rssi value.

Note that one place this doesn't work with the px4io enabled.
There is a comment left in the absence of analog rssi that:
"we do not actually get digital RSSI regs[PX4IO_P_RAW_RC_NRSSI]".
This restriction has been left in place, as removing it exposes a
problem where the frequency of the control tick is greater than
that of valid dsm frames so the rssi isn't valid every cycle.
2018-07-22 08:42:30 +02:00
Dennis Mannhart b5731e0ccd FlightTaskOffboard: only start task if control mode flags are met 2018-07-20 09:26:18 +02:00
Dennis Mannhart eb7139bc56 FlightTaskManualAltitude: respect maximum altitude if there is a valid distance sensor 2018-07-20 09:26:18 +02:00
Dennis Mannhart c907e7a9dc FlighttaskManualAlititude: replace SENS_FLOW_MINRNG with hagl_min 2018-07-20 09:26:18 +02:00
Dennis Mannhart 4af9d79986 FlighttaskManualPosition: check if estimator velocity maximum is finite
before applying limits
2018-07-20 09:26:18 +02:00
MaEtUgR efed766919 FlightTasks: small rebase naming and typo fixes 2018-07-20 09:26:18 +02:00
Dennis Mannhart 29fb5089bd FlightTasks: construct all tasks in constructor 2018-07-20 09:26:18 +02:00
Dennis Mannhart b1530d1a81 FlightTasks: create struct that contains FlightTask and FlightTaskIndex 2018-07-20 09:26:18 +02:00
Dennis Mannhart 83cc2b0e72 FlightTaskAuto: reset lock position to NAN 2018-07-20 09:26:18 +02:00
Dennis Mannhart c12dcb4eed FlightTaskAuto: take care of case when triplet.lat/lon are invalid, which corresponds
to position lock.
2018-07-20 09:26:18 +02:00
Dennis Mannhart 65ad6edaf0 ManualSmoothingXY: remove empty lines 2018-07-20 09:26:18 +02:00
Dennis Mannhart b9d5189fe5 ManualSmoothing: direction change with maximum acceleration 2018-07-20 09:26:18 +02:00
Dennis Mannhart 33d0a4e8ed FlightTaskAuto: replace target with destination for checks 2018-07-20 09:26:18 +02:00
Dennis Mannhart 92e93639d3 FlightTaskAuto: require valid position in 3D 2018-07-20 09:26:18 +02:00
Dennis Mannhart c4c01358b9 FlightTaskManualAltitude: do terrain following when distance sensor active and
below minimum distance to ground.
2018-07-20 09:26:18 +02:00
Dennis Mannhart bd85f5f993 FlightTask: set min_distance_to_ground to NAN as default and when
distance sensor is used to SENS_FLOW_MINRNG
2018-07-20 09:26:18 +02:00
Dennis Mannhart ee7d5c3f38 FlightTaskAuto: remove unused member variable 2018-07-20 09:26:18 +02:00
Dennis Mannhart e408870857 FlightTaskManual: remove unused override 2018-07-20 09:26:18 +02:00
Dennis Mannhart be6f3a5b48 FlightTaskOffboard: valid position and velocity is required 2018-07-20 09:26:18 +02:00
Dennis Mannhart bd2de0e585 FlightTaskAuto: valid target is required and valid reference 2018-07-20 09:26:18 +02:00
Dennis Mannhart 4713f47668 FlightTaskManualPosition: valid position/velocity in xy required 2018-07-20 09:26:18 +02:00
Dennis Mannhart 72a213aff7 FlightTaskManualAltitude: valid altitude/climb-rate is required 2018-07-20 09:26:18 +02:00