Running this script will parse the top of all source files
that are not submodules, examples or test cases, to find
all #include's and then do basically two things:
1) Reorder and group the headers so that px4_* headers are
included first, then local headers (headers of the project
that aren't submodules) then C++ headers if any, then C
headers if any, then system headers (which includes submodules)
and finally any #includes that are inside #if*...#endif
constructs.
2) Fix the use of "" or <> in a consistent manner.
Afterwards few fixes might be necessary for compile errors that
pop up. Most of those are already fixed in my previous commits.
However, I was not able to test a compilation for ros
(with __PX4_ROS defined) -- so some more fixes might be necessary
because of the header reordering.
The script comes with a progress counter and an error summary
(if any) at the end (so no scrolling back is necessary).
It is highly recommended to only run this script in a clean
project with no outstanding changes that need to be committed.
In fact, the script enforces this (unless you pass --force).
Reverting a run of the script is then easy with 'git checkout .'.
It is also possible to run the script on a single file
by passing that on the command line. In that case it
might make sense to pass --debug too, though that was really
meant for just me, while developing the script. This will write
debug output into the file that is passed, so you don't
want to commit that! ;)
<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.
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.
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.
Displaying the RMS innovation values at the end of each replay assets with rapid iteration for time delay parameter tuning without having to plot or post process using another tool.
Baro data arriving too soon after the last measurement due to a high sampling rate or timing jitter is rejected inside the ecl EKF to prevent the data buffer overflowing.
This patch checks the timestamp difference from the last measurement, and if to small, the data is accumulated and the average sent to the EKF when the time delta
is acceptable.
Fixes:
1) Invalid data with a zero time stamp could be the EKF ends up in the data buffers and result in loss of 'good' data from the buffers
2) Magnetometer data was arriving at a rate faster than the data buffers could handle resulting in loss of data.
If the replay data for the baro or mag data has a zero time stamp, then the corresponding relative timestamp published over the combined sensor topic must be se to RELATIVE_TIMESTAMP_INVALID so that the ekf2 module does not try to use this data.
* Fix jmavsim HITL simulation of MAV_CMD_DO_REPOSITION in the case where you have no radio attached to the PX4 and so you have disabled RC link loss for that reason (set NAV_RCL_ACT = 0) but you still want the jmavsimulation to work. The line of code changed here causes failsafe RTL to kick in without this fix.
* Add altitude hold option using Z position control, while doing velocity control on vx and vy.
* Fix style and rebase issues