535 Commits

Author SHA1 Message Date
Paul Riseborough
8b55c8ec55 systemlib mixer: Add public method for multi_rotor saturation status 2016-12-13 16:14:15 +01:00
Paul Riseborough
c4ccfeae0d mixer: improve multirotor motor limits reporting 2016-12-13 16:14:15 +01:00
Lorenz Meier
d817d331fd Add set trim API for helicopter mixer 2016-12-10 14:45:49 +01:00
Bart Slinger
a7c8d77453 Generic helicopter mixer
fix code style
2016-12-10 14:45:49 +01:00
Mark Whitehorn
dbc149c224 change trim units from absolute usec to normalized values 2016-12-10 12:56:39 +01:00
Mark Whitehorn
009a413438 fix argument order in pwm_limit_calc call, clean up
note that FMU does not update AUX pwm outputs if no RC signal
2016-12-10 12:56:39 +01:00
Mark Whitehorn
a0c8a78a14 use trim values to set mixer:scaler.offset
clamp mixer output offset to [-.2,.2] ([-2000, 2000] in mixer file)

add 8 main PWM trim parameters

add long desc to parameters and bump minor parameter version
2016-12-10 12:56:39 +01:00
Bartosz Wawrzacz
619efa7b45 [PX4IO/PWM driver] Added trim values to the PWM output drivers 2016-12-10 12:56:39 +01:00
Andreas Antener
64778b9540 Load monitor: added parameter to disable stack check 2016-12-09 21:12:12 +01:00
Lorenz Meier
c53d828e09 Set EKF2 as default estimator 2016-12-02 21:13:34 +01:00
Beat Küng
b020be13f6 flashparams: fix memory leak when saving parameters
A large buffer on the heap was not deallocated when parameters were saved,
but there were no changes to the parameters. In that case
parameter_flashfs_write() was not called, which was previously responsible
for freeing the buffer.

This patch moves the responsibility of freeing the buffer to the calling
side, which already explicitly allocates the buffer.
2016-11-29 10:38:11 +01:00
Dennis Shtatnov
37641042cc Explicit internal battery resistance params 2016-11-19 14:55:52 +01:00
Dennis Shtatnov
a634c14582 Scale throttle outputs by battery level. Fixes #4751 2016-11-19 14:55:52 +01:00
Carlo Wood
de85fbe1dc Remaining fixes needed before running Tools/fix_headers.sh
<systemlib/err.h> --> "systemlib/err.h" that fix_headers.sh
would miss because it comes after code it doesn't understand.

Effectively remove the '__EXPORT extern perf_counter_t perf_alloc('
line, because currently perf_alloc is defined to be NULL, and
after running fix_headers.sh that happens *before* this header
is included (the order of headers will be changed).

Do not define NULL to be (void*)0: that only works for C.
In fact, the conversions needed for NULL are so full of exceptions
that standard C++ introduced a new *keyword*: nullptr.
That's what we really should be using for C++ code.
In this case I just include the correct header to define NULL
the correct way.

Not really related to the header line:
Removed an #include <time.h> because I noted that px4_time.h
was already included... and moved a #include <sys/time.h>
to the top of the file (not really a fan of including headers
in the middle unless absolutely necessary).
Removed a include of queue.h because I noted it wasn't used.
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
Beat Küng
66ffc834d3 startup scripts: remove INAV, start LPE if INAV selected 2016-11-08 11:17:07 +01:00
Henry Zhang
309c256e9e fix param interface (#5797)
* param: fix bug when param value is changed to 'zero' for the first time, it won't be saved.

* param: revert incorrectly removed code.
2016-11-06 14:45:17 +01:00
Carlo Wood
90f3e3b5d3 Do not include headers inside __BEGIN_DECLS ... __END_DECLS blocks.
We don't have C++ unsafe headers (anymore).

I added a test to fix_headers.sh that checks if certain "unsafe"
headers are ONLY included inside a __BEGIN_DECLS ... __END_DECLS
(because after all, they are unsafe), as well as checking that
no other header files are included inside such a block. The rationale
of the latter is that if a file is a C header and it declares
function prototypes (otherwise it doesn't matter) and is sometimes
included outside a __BEGIN_DECLS ... __END_DECLS block (from a C++
source file) then it has to be C++ safe and doesn't ever to be
included from inside such a block; while if a file is a C++ header
then obviously it should never be included from such a block.

fix_headers.sh subsequently found several safe headers to be
included from inside such a block, and those that were (apparently
in the past) unsafe were included only sometimes inside such a
block and often outside it. I had a look at those files and saw
that at least an attempt has been made to make them C++ safe,
but especially because they already are included OFTEN outside
a __BEGIN_DECLS ... __END_DECLS (from C++ source files) the
best decision seems to treat them as safe.

This is not risky: .c files that define such functions still
generate C-linkage for their functions. If a C++ unsafe C header
is included outside a __BEGIN_DECLS ... __END_DECLS block then
the only possible result would be an undefined reference to
a function with C++-linkage that will not exist. Aka, when
something links after this commit, then the commit was correct.
I did build all targets and they all linked.
2016-10-28 11:57:08 +02: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
Beat Küng
b2d45732c2 system_params: add missing crazyflie to the param description 2016-10-19 13:13:47 +02:00
David Sidrane
db44129ec0 Prevents the posibility of buffer overflow in mixer parsing.
The fix limits scanf from overwritting the geomname buffer local
variable. Thus preventing stack corruption as noted by chungkim.
2016-10-12 22:58:55 +02:00
Lorenz Meier
569cceb059 Fix task load measurement in NuttX. Reported by @chungkim. Fixes #5645. 2016-10-12 08:43:45 +02:00
Gregory
ddea179e95 Adding support for 19200 and 38400 baud TELEM2 2016-10-10 22:24:17 +02:00
Roman
cf8f484868 mixer class: updated comments on slew rate limit method
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-30 13:55:53 +02:00
Roman
c2a511d81d multirotor mixer slew rate limiting: naming and fixes
- avoid dividing by zero when calculating max delta output
- better comments when calculating max delta output
- better naming of functions and variables

Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-30 13:55:53 +02:00
Roman
cced6fc8b2 multirotor mixer: use correct version of delete operator for array pointer
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-30 13:55:53 +02:00
Roman
2607769470 slew rate limiting: moved logic to multirotor mixer
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-30 13:55:53 +02:00
Roman
66ddea01d1 implemented slew-rate 2016-09-30 13:55:53 +02:00
Beat Küng
489f63a3d3 rc_check: replace mavlink_and_console_log_critical with mavlink_log_critical
these functions got merged.
2016-09-30 13:50:51 +02:00
Beat Küng
ce0d31b7d9 mavlink log: ensure all critical & emergency msgs are also logged to console & ulog
Critical messages that the user sees should also go to the log file, so
that the exact error (with time) can later be analyzed from the log file.
2016-09-30 13:50:51 +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
Sander Smeets
c4eabbd083 VTOL transition switch parameter checking (#5545)
* VTOL transition switch parameter checking

* Code style
2016-09-26 10:18:23 +02:00
Beat Küng
e2afb0be6b px4_log.h: remove hrt_absolute_time() declaration (it does not belong here) 2016-08-24 21:24:35 +02:00
Beat Küng
1fffd731b1 print_load_posix under DARWIN: remove unused variable basic_info (#5364) 2016-08-23 09:09:55 +02:00
James Goppert
818840b576 Path cleanup, low impact changes (#5340)
* Low impact changes from path_cleanup branch.

This is a step towards minimizing the diff with path_cleanup branch.

* Update ecl.

* Revert matrix update.

* Revert ecl and matrix.

* Update sitl gazebo.

* Revert sitl_gazebo and matrix changes.
2016-08-18 15:37:23 -04:00
Lorenz Meier
ae00abe468 Fix typo 2016-08-18 15:44:51 +02:00
Tiktiki
dfed00d870 Update multi_tables.py
Corrected HEX_T position and rotation for motors 1-2-5-6
2016-08-18 15:27:32 +02:00
Tiktiki
021da9b2e1 Update mixer_multirotor.cpp 2016-08-18 15:25:24 +02:00
Tiktiki
3daf4a3a67 Update multi_tables.py 2016-08-18 15:25:24 +02:00
Lorenz Meier
102f5b54d7 Revert "Improvements to SITL to make paths more flexible. (#5181)"
This reverts commit 699b6a2cb340f4b6ec3979ae7748ff9c56cfdb89.
2016-08-05 21:29:49 +02:00
James Goppert
699b6a2cb3 Improvements to SITL to make paths more flexible. (#5181) 2016-08-05 06:23:59 -04:00
Lorenz Meier
074a71173b Systemlib: Address init and copy constructors 2016-08-05 10:13:24 +02:00
James Goppert
437221bec2 Make LPE default estimator. (#4483) 2016-08-02 02:02:01 -07:00
Julian Oes
623b99327d param: lock the bus as short as possible (#5187)
Since the FRAM and the baro are on the same bus on the Pixracer, we
currently need to lock down everything (instead of just this SPI bus)
for the time when the params are written.
Therefore, we need to keep this locking as short as possible.

This change makes the locking even shorter by moving all param_get and
param_name and param_size calls out of the lock.
2016-08-01 02:15:21 -07:00
Julian Oes
3d0fa410a8 hysteresis: astyle 2016-07-30 12:26:56 +02:00
Julian Oes
f7ad8c03b4 hysteresis: use 64bit for everything in us 2016-07-30 12:26:56 +02:00
Julian Oes
ee1669e174 hysteresis: add to systemlib CMakeLists.txt 2016-07-30 12:26:56 +02:00
Julian Oes
f365832c0b hysteresis: we needed different hysteresis
Sometimes, we only need a histeresis in one direction.
2016-07-30 12:26:56 +02:00
Julian Oes
401d807261 systemlib: added library for hysteresis
There have been two cases where a hysteresis function wasn't working
correctly. It is therefore a good idea to abstract the hysteresis
functionality into a library.
2016-07-30 12:26:56 +02:00
David Sidrane
8a2df2a458 Avoid unnecessary Write Cycle 2016-07-13 20:42:05 +02:00