154 Commits

Author SHA1 Message Date
Daniel Agar
65745a3676 purge broken qurt support and atlflight boards 2021-07-16 08:53:36 -04:00
Daniel Agar
b5430c22c4 AlphaFilter: move from ecl -> mathlib 2021-07-15 10:38:24 -04:00
Daniel Agar
a5ee28883a gyro_fft: track FFT peaks and median filter frequency 2021-07-06 12:32:25 -04:00
Daniel Agar
d430e13401 sensors: wait for real sample rate to initialize LowPassFilter2p 2021-06-01 08:58:10 -04:00
Daniel Agar
438b0abc7a mathlib: Biquad filters use internal fields for parameter update 2021-06-01 08:58:10 -04:00
Daniel Agar
9661eddef8 mathlib: LowPassFilter2p initialize b0 to 1 for safety 2021-06-01 08:58:10 -04:00
Daniel Agar
5493d96d17 mathlib: merge LowPassFilter2p, LowPassFilter2pArray, and LowPassFilter2pVector3f
- fix reset for direct form 2
 - push NAN checks out to filter users
2021-05-31 10:26:45 -04:00
Daniel Agar
f25a70a674 mathlib: Notchfilter updates
- merge NotchFilterArray into regular NotchFilter (apply vs applyArray)
 - only use direct form 1 to prevent reset confusion
 - safe default field initialization
 - update VehicleAngularVelocity usage
2021-05-31 10:26:45 -04:00
Daniel Agar
015849b402
mathlib: LowPassFilter2p and NotchFilter add magnitude response getter 2021-04-05 22:47:30 -04:00
Daniel Agar
e57aaaaa5e
rotate accel/gyro FIFO before publish and fix angular velocity filter resets
- rotates accel & gyro FIFO data before publication both to simplify downstream usage (including log review) and fix other issues
     - to best handle int16_t data rotations are now either performed with swaps if possible, otherwise promoted to float, rotated using the full rotation matrix, then rounded back to int16_t
 - fix sensors/vehicle_angular_velocity filter reset both with proper rotation and new calibration uncorrect helper
      - in FIFO case filtering is done before calibration is applied, but we need to handle a possible reset from a completely different sensor (vehicle body angular velocity -> sensor frame uncorrected data)
2021-03-22 12:01:12 -04:00
Daniel Agar
2257c3767e simple gyro auto calibration module 2021-03-15 09:46:47 +01:00
bresch
be9b3404a2 lpf test: test several sampling frequencies 2021-02-26 14:06:45 -05:00
bresch
3277648959 lpf test: move to common function 2021-02-26 14:06:45 -05:00
bresch
844602c961 Add unit tests for Butterworth 2nd order low-pass filter 2021-02-26 14:06:45 -05:00
Daniel Agar
6482120d9a
sensors/vehicle_angular_velocity: use full raw FIFO data (sensor_gyro_fifo) if available 2021-02-25 10:06:17 -05:00
Matthias Grob
a637f282ce FunctionsTest: cover lerp 2021-02-24 17:27:31 +01:00
Beat Küng
14bf9cf753 mc: add SYS_VEHICLE_RESP param to configure vehicle responsiveness 2021-02-24 17:27:31 +01:00
Julian Kent
e014954c91 Remove old matrix inversion routines 2021-01-28 09:14:08 +01:00
Julien Lecoeur
343cf5603e initial control allocation support
- control allocation module with multirotor, VTOL standard, and tiltrotor support
 - angular_velocity_controller
 - See https://github.com/PX4/PX4-Autopilot/pull/13351 for details

Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
Co-authored-by: Roman Bapst <bapstroman@gmail.com>
2021-01-18 11:25:37 -05:00
Julian Kent
a5dfa0c803 Add helper function for decel distances
Co-authored-by: RomanBapst <bapstroman@gmail.com>
2021-01-13 10:26:10 +01:00
Matthias Grob
badaf1eae0 Functions: add squareroot linear function 2020-12-03 18:19:42 +01:00
Daniel Agar
d14deb0e5a FFT add simple median filter 2020-11-02 12:58:46 -05:00
Daniel Agar
d5e68bc05a mathlib: NotchFilter delete unused update method 2020-10-27 12:30:59 -04:00
Matthias Grob
400d97e60c math: add unit tests for everything in Functions.hpp 2020-07-24 11:31:15 +02:00
Matthias Grob
0b391fdcfc mc_att_control: add gradual3 function to cover hover thrust rescaling 2020-07-24 11:31:15 +02:00
Samuel Garcin
b12a655c5b
Notch filter Direct Form I implementation that support dynamic change of frequencies
* New NotchFilter methods ahead of RPMFilter implementation.
 * Added Direct Form I implementation that support dynamic change of frequencies.
 * Added update method to update frequency on an existing filter.
 * Added setCoefficients method to easily and efficiently create clones of a filter.
 * LowSide, HighSide, Onnotch and array tests testing the applyDF1 method.
2020-05-08 12:00:27 -04:00
Matthias Grob
eb3b0f6b55 mathlib: get rid of now duplicate sign() function
Instead use the one that was copied to the matrix library in
https://github.com/PX4/Matrix/pull/116/
2020-03-17 10:01:42 +01:00
Daniel Agar
24f0c2d72a
sensors: move gyro filtering to sensors/vehicle_angular_velocity
- gyro filtering (low-pass and notch) only performed on primary gyro in `sensors/vehicle_angular_velocity` instead of every gyro in `PX4Gyroscope`
 - sample rate is calculated from actual updates (the fixed value was slightly wrong in many cases, and very wrong in a few)
 - In the FIFO case the array is now averaged and published in `sensor_gyro` for filtering downstream. I'll update this in the future to use the full FIFO array (if available), but right now it should be fine.
2020-01-27 10:05:33 -05:00
Mathieu Bresciani
5adf23a6a8 Add gyroscope notch filter - IMU_GYRO_NF_(FREQ|BW)
* NotchFilter: add NotchFilter template and test for float type
* NotchFilterTest: add test for Vector3f notch filter
* PX4Gyroscope: add notch filter with IMU_GYRO_NF_(FREQ|BW) parameters to
set the notch center frequency and bandwidth
2020-01-06 16:53:36 -05:00
Matthias Grob
1484dfed6a FlightTasks: remove deprecated AutoLine mission task 2020-01-06 15:39:07 +01:00
Julian Kent
75d7a049c1 Use the new trajectory constraints to synchronize and limit velocities 2020-01-06 15:39:07 +01:00
Daniel Agar
1a395fb6d9 ST ISM330DLC IMU driver 2019-12-03 16:16:49 -05:00
Daniel Agar
a8ea55d9b6
remove all <cmath> usage
* the NuttX c++ library is incomplete, let's avoid including it until we have a real standard library in place
2019-11-25 10:04:04 -05:00
Julian Kent
b8b7527d05 Fix off-track tracking in AutoLineSmoothVel (#13321)
* Use position instead of last setpoint

This calculates the target velocities better taking into account disturbances along
the flight route. Previously entry angles and more were calculated assuming the flight path
originates directly from the direction of the previous waypoint. This corrects this assumption
to instead make the direction come from the vehicle location.

* Allow to specify a final speed given a braking distance.

This is to allow planning to not stop at a waypoint, but instead
to reach the waypoint while maintaining a certain velocity

* Updated src/lib/matrix

* Account for speed at target when determining constraints

* Separate constraints into x/y components

* Use setpoint position, not vehicle position

* Fix whitespace, add documentation
2019-11-04 11:57:12 +01:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01: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
bresch
59f54a7fd8 mathlib - Add FLT_EPSILON deadzone in sign computation 2019-09-13 17:46:01 +02:00
Daniel Agar
2217faf812
mathlib Limits constexpr helpers don't use references (#11411)
- fixes #11408
 - cleanup Limits.hpp
2019-02-08 14:10:09 -05:00
Beat Küng
c659d2bcc2 mixer: minor refactoring to reduce header include dependencies
- avoid including <px4_defines.h> from the math headers
- avoid driver include <drivers/drv_mixer.h> from the mixer
2018-12-13 09:50:07 +01:00
Dennis Mannhart
55947d2782 exponentialFromLimits make small number const 2018-11-30 09:30:00 -05:00
Dennis Mannhart
6110ddc8b1 math Functions constrain X_in of exponentialFromLimits function 2018-11-30 09:30:00 -05:00
Dennis Mannhart
23afb939f0 math Functions: exponential function with constraints 2018-11-30 09:30:00 -05:00
Dennis Mannhart
80193cd227 math Functions: replace float with T 2018-11-30 09:30:00 -05:00
Lukas Woodtli
a7d297ed57 Fix division by zero and cast of to big floats to int 2018-10-28 16:54:36 +01:00
Beat Küng
294af5daad LowPassFilter2p: fix _cutoff_freq <= 0 (disabled filter)
If the filter was disabled, the apply() would always return 0.
2018-10-24 20:43:42 +02:00
Daniel Agar
297c1b777b mathlib LowPassFilter2p sync with LowPassFilter2pVector3f 2018-10-20 10:34:02 -04:00
Daniel Agar
ac85230700 mathlib: add Vector3f low pass filter 2018-10-20 10:34:02 -04:00
Dennis Mannhart
00e09524f7 SearchMin and BezierQuad: replace define with static constexpr (#10050) 2018-07-30 12:28:27 -04:00
Dennis Mannhart
c8842665da mathlib: add golden section search 2018-07-25 08:50:10 +02:00
MaEtUgR
675b6bbabc mathlib: fix comment typo 2018-07-24 15:03:53 +02:00