138 Commits

Author SHA1 Message Date
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
Daniel Agar
cf74166801 double promotion warning fix or ignore per module 2018-07-01 09:36:55 +00:00
Daniel Agar
222a91c6be mathlib delete Matrix, Quaternion, Vector 2018-05-23 17:27:09 -04:00
Daniel Agar
ea3acb7121 cmake remove circular linking and reorganize
- px4_add_module now requires MAIN
 - px4_add_library doesn't automatically link
2018-04-29 21:48:54 -04:00
Matthias Grob
efd240904f FlightTasks: added possibility to apply task parameters from the vehicle command 2018-04-05 07:30:12 +02:00
Daniel Agar
e63f9d9bf6
mathlib Limits move radians/degrees to header (#9102) 2018-03-19 12:45:42 -04:00
Matthias Grob
d2ead02fb5 mc_att_control: catch numerical corner cases
- Delete left over identity matrix.

- Corner case with a zero element when using the signum function:
We always need a sign also for zero.

- Corner case with arbitrary yaw but and 180 degree roll or pitch:
Reduced attitude control calculation always rotates around roll
because there's no right choice when neglecting yaw. In that small
corner case it's better to just use full attitude contol and hence
rotate around the most efficient roll/pitch combination.
2018-03-15 17:16:14 +01:00
Daniel Agar
b3b1161d53 mathlib filters include automatically 2018-02-04 18:15:57 +01:00
Matthias Grob
11d480240a mathlib Functions: removed inline, fixed style 2018-02-02 00:38:01 -05:00
Matthias Grob
8e68f5ed79 mathlib Functions: improve documentation and limit checking 2018-02-02 00:38:01 -05:00
Matthias Grob
455ba0e1b5 mathlib Functions: added SuperExpo function for stick feel enhancement 2017-10-17 16:54:16 +02:00
Matthias Grob
1d7f760a96 mathlib, mc_pos_control: rename functions file and add gradual linear function 2017-07-07 18:25:35 +02:00
Daniel Agar
9b08cf686f mathlib remove Matrix and Vector virtual destructors 2017-06-08 22:03:08 -04:00
Daniel Agar
c56df948ee mathlib expo template style 2017-06-02 19:35:18 -04:00
Daniel Agar
6e1113ae4d clang-tidy mathlib remove redundant void 2017-06-02 19:35:18 -04:00
Daniel Agar
e112161a04 clang-tidy fix mathlib headers and format 2017-06-02 19:35:18 -04:00
Mohammed Kabir
c8dad56300 mathlib : switch min/max to constexpr to match std::min/max 2017-04-24 12:24:11 +02:00