104 Commits

Author SHA1 Message Date
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
Matthias Grob
b32e5e7ec0 mc_pos_control: fixed all pull request complaints
mainly changing parameters to BlockParams, reorder them and comment
2017-03-22 15:21:34 +01:00
Matthias Grob
8fd27fddcd mc_pos_control: moved responsibility of the x,y stick deadzone to a mathematical function
to prevent a setpoint step when moving the stick over the border of the deadzone
and to enable very small inputs even from a control stick that needs a big deadzone
2017-02-25 11:05:53 +01:00
Matthias Grob
661832ca1d mathlib: added exponential curve function 2017-02-02 21:24:05 +01:00
Beat Küng
1da934049c matrix_alg: use PX4_ISFINITE() instead if isnan() & isinf() 2017-02-01 08:38:26 +01:00
Siddharth Bharat Purohit
b46b7a3ca3 mathlib: add matrix eval funcs for raw arrays 2017-02-01 08:38:26 +01:00
Carlo Wood
ebeb187522 Move #pragma once outside #ifdef's.
In this particular case it does no harm,
but since in other cases it can lead to
problems I didn't want to add an exception
for this case to fix_headers.sh, that currently
chokes on this because it doesn't know better
than that it's a bad thing.

Note on how #pragma once works: when encountered
(aka the #ifdef that it is inside has to
be true), the compiler marks the whole
file as "seen" (this is implementation
defined, but most implementations store
the inode of the file). Subsequent #include's
of that file/inode are then completely skipped.
Hence it doesn't matter if the #pragma is at
the beginning, at the end or in the middle,
but it should be encountered every #include,
usually, and thus not be inside an #if... #endif
construct.
2016-11-13 19:36:27 +01:00
Carlo Wood
04aa2bb3a4 Add missing header files.
These headers files were missing from the header files that
I added them to; the fact that they were missing didn't
lead to compile errors because by coincidence the missing
headers are included in the source files before including
these headers. But, after the reordering of header inclusions
by Tools/fix_headers.sh, these cases will give rise to compiler
errors.
2016-11-13 19:36:27 +01:00
Carlo Wood
baf89f4398 Clean up of px4_defines.h (remove math.h)
This patch reorders px4_defines.h to make it more readable (I think)
but more importantly, cleans up the #include <math.h>/<cmath>
and [std::]isfinite stuff.

My main goal was to completely get rid of including math.h/cmath,
because that doesn't really belong in a header that is supposed to
define macro's and is included in almost every source file (if not
all).

I'm not sure what it did before ;) (pun intended), but now it does
the following:

PX4_ISFINITE is only used in C++ code (that was already the case,
but hereby is official; for C code just use 'isfinite()') and is
defined to be std::isfinite, except on __PX4_QURT because that uses
the HEXAGON toolset which (erroneously) defines isfinite as macro.

I would have liked to remove PX4_ISFINITE completely from the code
and just use std::isfinite whereever that is needed, but that would
have required changing the libecl submodule, and at the moment I'm
getting tired of changing submodules... so maybe something for the
future.

Also, all includes of <math.h> or <cmath> have been removed except
for __PX4_NUTTX. Like the HEXAGON toolset NuttX currently defines
isfinite as macro for C++. So, we could have solved this in the
same was as __P4_QURT; but since we can fix NuttX ourselves I chose
to add a kludge to px4_defines.h instead that fixes this problem,
until the time that NuttX can be fixed (again postponing changing
a submodule). The kludge still demands including <cmath>, thus.

After removal of the math header file, it needed to be included
in source files that actually need it, of course.

Finally, I had a look at the math macro's (like M_PI, M_PI_F,
M_DEG_TO_RAD etc). These are sometimes (erroneously) defined in
certain math.h header files (like both, hexagon and nuttx).
This is incorrect: neither the C nor the C++ standard defines
math constants (neither as macro nor otherwise). The "problem"
here was that px4_defines.h defined some of the M_*_F float
constants in terms of the M_* double constant, which are
sometimes not defined either thus. So, I cleaned this up by
defining the M_*_F math constants as float literals in px4_defines.h,
except when they are defined in math.h for that platform.
This means that math.h has to be always included when using those
constants, but well; not much difference there as those files
usually also need/use the macro NAN (which *is* a standard macro
defined by math.h).

Finally finally, DEFAULT_PARAM_FILE was removed as it isn't
used anymore.

All in all I think the resulting px4_defines.h is nice, giving me
much less the feeling of a nearly unmaintainable and over time
slowly growing collection of kludges and hacks.
2016-10-28 08:41:30 +02:00
Julian Oes
8ff237c69f Remove size optimization for individual modules
It makes more sense to set the optimization flags on a platform basis
instead of individually for each module. This allows for different
optimization options for SITL, NuttX, Snapdragon, etc.
2016-09-30 08:11:51 +02:00
Martin K. Schröder
97d9fd38be Update Matrix.hpp (#4966)
This was horribly wrong. Matrix is first cast into a matrix of size NxM (which is supposed to be the size of the result - NOT the starting point) so the transpose result becomes garbage. Instead make "Me" an MxN matrix as the original. Took me a whole evening to figure out this problem. Now my Kalman filter finally returns good results.
2016-07-03 12:29:58 +02:00
Lorenz Meier
fad07a45b9 Mathlib: Optimize for sixe 2016-07-01 18:21:35 +02:00
Beat Küng
8a12dee125 cmake: remove all module.mk files & cmake conversion script (#4918)
It seems these files are leftovers.
2016-06-28 09:26:36 +02:00
Beat Küng
dae12f1238 mathlib: replace math::{min,max,constrain} with template methods 2016-05-14 11:27:07 +02:00
Beat Küng
7055d3c929 fix tecs.cpp: use UINT64_C for uint64_t constant instead of UUL 2016-05-14 11:27:07 +02:00
James Goppert
d02abf2cc0 Removed CMSIS. 2016-03-25 18:43:43 +01:00
Roman Bapst
4e824e55d7 Merge pull request #3323 from PX4/att_est_q_declination
Attitude estimator Q: fix magnetic declination inducing gyro bias growth
2015-12-04 16:46:36 +01:00
Anthony Kenga
a5a3357928 Attitude estimator Q: fix magnetic declination inducing gyro bias growth 2015-12-04 16:11:57 +01:00
Andreas Antener
08a1797eec changed isnan checks and cmake compiler condition for apple machines 2015-12-03 15:39:41 +01:00
jgoppert
4636670130 Updated inverse in mathlib for new matrix call. 2015-11-08 12:18:47 -05:00
Lorenz Meier
ac893f26fb Update math lib include path 2015-11-07 09:47:58 +01:00
jgoppert
27df787bff Separated matrix lib into own repo. 2015-11-05 20:27:48 -05:00
jgoppert
99fb498cd2 Resurrect controllib testing. 2015-10-28 22:36:47 +01:00
jgoppert
d198c6a324 Removed comment. 2015-10-24 15:59:11 -04:00
jgoppert
6cce823dc6 Replaced wigen with custom matrix lib. 2015-10-24 15:10:20 -04:00
Lorenz Meier
fa5071b3c5 Remove module.mk files to prevent confusion of adopters upgrading 2015-10-06 11:23:20 +02:00
James Goppert
bf18c84652 Cleanup of module building. 2015-09-09 23:00:58 -04:00
James Goppert
1d6b31d196 Switch to cmake build system. 2015-09-07 20:37:45 -04:00
philipoe
64248f3ad5 mathlib: Bugfix to print function 2015-08-28 17:15:57 +02:00
philipoe
32ae3026be Mathlib: Fix to matrix division operator 2015-08-26 09:31:32 +02:00
Nghia Ho
a4726292b2 fixed double promotion warning when doing printf 2015-08-11 21:30:05 -07:00
Lorenz Meier
9745d16905 Merge pull request #1977 from devbharat/fix_issue_1963
Shifted the set() function for Matrix3x3, Vector2, Vector3, Vector4 to a...
2015-06-15 17:35:40 +02:00
Mark Charlebois
db52227409 Merge remote-tracking branch 'upstream/master' into linux
Signed-off-by: Mark Charlebois <charlebm@gmail.com>

Conflicts:
	src/modules/commander/accelerometer_calibration.cpp
2015-05-06 15:51:39 -07:00
Mark Charlebois
4cedcfc58e math/test/test.cpp has invalid calls
The function calls ceil() and floor() but passes an int and there
is obviously no implementation for that so clang fails.

It seems like exp should be a float from this code.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-24 01:40:46 -07:00
Mark Charlebois
f3b5076d70 Linux to posix conversion
Changed "linux" target to "posix". Most of the changes are shared with
QuRT and with OSX. The Linux specific parts are in for i2c which uses
<linux/i2c.h> and <linux/i2c-dev.h>.

There is also a check for __PX4_LINUX in mavlink for a tty ioctl that is
not supported.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-21 09:53:09 -07:00