We propagate the bus parameters from the bus interface to the sensor
devices. Thus, the device ID of the sensor driver is set to the correct
bus id and address. Otherwise it would be zero, which is an issue if several MPU9250s
are running at the same time.
This fixes the following corner case:
1. Upload a mission.
2. Set mission mode.
3. Set loiter mode.
4. Arm.
At this point it will shoot up and go to the takeoff waypoint even
though we're not in mission but in loiter mode.
The fix makes sure that the triplet is reset to invalid (and idle) in
loiter mode if we're landed and disarmed.
It will lead to the vehcle sit in idle on the ground until you issue a
start mission (or takeoff) command.
- fix a bug where the wrong rotation order was used to compute the attitude
setpoint when using the pusher assist feature
Signed-off-by: Roman <bapstroman@gmail.com>
This makes the onboard check consistent with hmc5883_bus_option
initialization. If the current bus is the onboard bus, return !external.
It fixes the onboard mag (HMC5883) for AeroFC. Its priority is now 100,
previously it was 255, so that if an external mag is attached, it will be
preferred.
This reverts commit 126172d70c.
This commit is going in the wrong direction: it's actually the same as
it was before, but allows changing the autostart configuration to
something other than 4070, which means people could wrongly assume it
would work in other configurations.
- fixed a bug where tilt compensation was done also when the horizontal
velocity was controlled. This is not needed because in this case
the controller outputs a 3D thrust vector.
Signed-off-by: Roman <bapstroman@gmail.com>
(leads to double publishing on the console when a new link is established, but this is the best compromise between fixing and completely restructuring)
This resolves a bug where a takeoff would go sideways instead of
straight up. What happened was that the position setpoint got shifted
around even though there was actually no real setpoint set but only a
setpoint of type IDLE. This then lead to a position setpoint far away
from the takeoff point and therefore scary takeoffs.
This fix prevents the part of the position controller which
moves/integrates the position setpoint from running in the case of an
idle setpoint.
This bug could be reproduced by switching the vehicle to mission mode
without a valid mission, then switch to hold mode, and then send the arm
and takeoff command.
This way user can set aftwards any other AUTOSTART value and it will
not be overwritten.
Also move the block up and set SYS_AUTOCONFIG, this way if air frame
configuration was reset in ground station it will wipe the parameters
before load new ones.
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.
The mapping of PX4_SPIDEV_ACCEL_MAG to PX4_SPIDEV_ICM is not
a clean approach and the PX4_SPIDEV_MPU is already used by the
mpu9250 leaving the only (and the correct) option to the use
PX4_SPIDEV_ICM and make it map to the reused ACCEL_MAG_CS PC15
as 206080D_CS
AeroFC is updated by Aero board using the UART between AeroFC
and Aero board.
This script will copy firmware and px_uploader.py to Aero board and run
px_uploader.py with the correct paremeters. User only needs to have a
network connection (Ethernet over USB or WiFi) with Aero board to update
AeroFC firmware. The IP/hostname can be given by AERO_HOSTNAME
environment variable.
Right now it's only possible to use ttyS2 as the UART for connecting a
companion computer. Add a variable that can be set so other boards may
be better supported.
As ASC use a non-standard UART for mavlink it is necessary check for
the board name and set SYS_AUTOSTART to initialize mavlink on the
right interface otherwise there is no way to change the SYS_AUTOSTART.
Remove what's not used like SPI and UART ports, ADC, etc. Add UART5 and
I2C1 that are going to be used.
This also received contribution from
José Roberto de Souza <jose.souza@intel.com>.
This allows to set the environment variable NO_PXH to start SITL without
the interactive pxh> shell. For this, px4 is called with the -d arg
which sets it to deamon mode.
This feature is handy to script sitl_run.sh.
This disables the following modules to save flash:
- mpu9250 driver because the MPU9250 is rarely used on Pixhawks
- Snapdragon RC PWM passthrough which is rarely used and definitely a
special/custom configuration. Also, it will soon be obsolete with the
upcoming PWM support on Snapdragon.
I could not figure out how to make sense out of the binary git data.
Therefore, I replaced the px4_git_version_binary with the first 8 bytes
of px4_git_version (char[]) and this is easily readable when it arrives
on the other side.
- we interface over the base class pointer so we don't need any pointers
to the derived classes of VtolType
Signed-off-by: Roman <bapstroman@gmail.com>
If the Python versions are specified, this breaks the build on Ubuntu systems
where Python3 is also installed but the extensions such as python-empy
are not installed. One could, of course, install python3-empy to fix
this but that's not in the instructions or error messages and therefore
not straightforward.
It is therefore probably better to just use the system default which
ends up being 2.7 on Ubuntu.
- do not try to shift the target waypoints when a reset occurs in position
control mode. Just make it lock into the current heading.
Signed-off-by: Roman <bapstroman@gmail.com>
If a single sensor is fitted, the calculation is not performed and zero values are published.
If dual IMU's are fitted, the vector length difference between the primary IMU and the second sensor is output for the angular rates and accelerations. The vector difference is low pass filtered before the length is taken.
If three IMU's are fitted, the vector length is calculated for both alternative sensors and and the maximum values output.
Fourth and subsequent IMU's are ignored.
- during large transients in pitch demand the pitch integrator value
was shifted such that the final demanded pitch did not violate given
limits. Since this strategy can cause large knock-backs of the pitch
integrator we remove this logic completely. We already have logic in place
which reduces the integrator at the pitch time constant in case the
pitch limits are exceeded so we don't need to limit it further. This
has the advantage that spikes in the specific energy balance error
signal does not lead to integrator knock-back.
Signed-off-by: Roman <bapstroman@gmail.com>
Constrain the specific energy balance integrator input to prevent increasing saturation of pitch demand.
Decay the specific energy balance integrator state if the pitch demand is saturated to reduce saturation to zero and do so at the same tome constant as the control loop
Relax the clipping threshold on the specific energy balance integrator to allow the input constraint and decay functions to do more of the work
Improve variable naming and commenting
- when limiting the pitch integrator input the value was related to
a quantity with different units (specific energy error rate vs delta pitch)
- once the unconstrained pitch demand is larger / smaller than the max/min
allowed pitch angle the integrator input should only be allowed to drag
the integrator into the direction leading to less pitch demand violation
Signed-off-by: Roman <bapstroman@gmail.com>
- if the specific energy balance correction term produced a demanded
pitch value which exceeded the aircraft pitch limits then the pitch
integrator was shifted such that the pitch demand violation was prevented.
However, this meant that the exceeding pitch was just unloaded into the
integrator and caused unexpected behavior of the pitch loop.
In an underspeed condition e.g. this has lead to the plane pulling up it's
nose very quickly shorty after the underspeed condition kicked in.
Signed-off-by: Roman <bapstroman@gmail.com>
- the method in TECS for detecting an underspeed condition was run after
the method which calculated the airspeed demand. As a result the specific
engergy balance error signal showed a spike when TECS detected an underspeed
condition.
Signed-off-by: Roman <bapstroman@gmail.com>
In most cases, really only 1 element is needed. The dynamic allocation
handles cases where more are necessary. This is all done within a locked
state, so no races can occur.
Frees roughly 2.3KB RAM.
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
This saves ~1.1KB of RAM for systems with only 1 sensor of each type.
If there are more sensors, they will be dynamically added, such that
failover still works.
Current implementation checks against geofence only if it is in polygon form.
When it's created via params, it accepts all the waypoints as the number of vertices = 0.
Thus, changed the function to the one that is used to check whether geofence is breached in flight.
Update the comment, to explain how to achive a different perescale
value.
Added PX4_IO_TIMER_ALTERNATE_RATE one board agnostic ifdef
PX4_IO_TIMER_ALTERNATE_RATE that is non board specific.
N.B. I would like to eliminate PX4_IO_TIMER_ALTERNATE_RATE
as well, but I need crazyflie HW to validate that the startup
script can just set the rate on the PWM to 3921 fast enough to
not effect the motors.
1) Remove uneeded spi and reset code
2) Use the Board commin for providing the BOARD_NAME
3) Add PX4_PWM_ALTERNATE_RANGES in suport of a board agnostic
way to override the PWM_.*_{MIN|MAX} values
4) Remove #ifdefs from the IO timers*. Drive the config deltas
from the crazyflie_timer_config.c and one board agnostic
ifdef PX4_IO_TIMER_ALTERNATE_RATE that is non board specific
*I would like to eliminate PX4_IO_TIMER_ALTERNATE_RATE
as well, but I need HW to validate that the startup
script can just set the rate on the PWM to 3921 fast
enough to not effect the motors.
'mavlink stop-all' during a log streaming session previously led to a
resource leak, and log streaming could only be re-started by rebooting the
system.
Using cout drags in std::localeconv which isn't defined
on QURT. While this file is also used for POSIX, it doesn't
seem to harm much to use printf there as well.
pwm_input was not working correctly (only after a pwm_input reset) on
Pixracer because fmu was started on all PWM output channels.
This moves the check if PWM input is needed up before the fmu start.
Instead of sending actuator controls from -1..1 for SITL, we should send
0..1 like we already do for HIL. This will enable negative thrust in the
future, e.g. for pusher props that spin backwards, or for vehicles with
variable pitch propellers.
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.
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.
The "targets" posix_rpi_common, qurt_sdflight_default and
posix_sdflight_default are not real targets; they are
just files in cmake/configs that are included by other
targets.
These are some changes that I needed to compile
most of the unsupported targets.
After this all (make list_config_targets) compile
for me except: posix_eagle_muorb, posix_sdflight_default
and qurt_eagle_legacy_driver_default.
This is the equivalent to Greg's upstream solution for ctype.h &
cctype with the necessary shadow waning fix.
It also deletes the Hack in pa4_defines.h
This change fixes a wrong behaviour when a takeoff command is sent.
An example:
- MIS_TAKEOFF_ALT set to 10 meters
- Takeoff command with alt setpoint of 2 meters
Old behaviour:
1. Climb to 10 meters -> takeoff WP reached
2. Go to setpoint at 2 meters
New behaviour:
1. Climb to 10 meters and stay there but notify that altitude was
overridden.
In the normal sitl `commander takeoff` case, the takeoff jump was never
actually carried out because the default altitude radius is set to 3m
and the takeoff altitude to ~2m which means that the takeoff waypoint is
"reached" immediately.
This works around this edge case by using the altitude between the home
altitude and takeoff altitude divided by 2 as a acceptance radius.
Since orb_copy is guarded with a orb_check, we ended up not having the
corrent landed state in the beginning which could lead to some
unexpected behaviour on takeoff.
In most cases, _extern_address was unused, thus wasting cycles & RAM. This
adds a separate class BlockParamExt with the field and uses it in ekf2_main
Frees roughly 0.5KB of RAM on Pixracer
The lifetime of the string is guaranteed because we never delete
DeviceNode objects and the strings in question are already on the heap.
This frees roughly 2.2KB of RAM on Pixracer
reorder & reduce instance to uint8_t (which is more than enough).
Reduces sizeof(MavlinkOrbSubscription) from 40 to 24.
On Pixracer this frees almost 2KB of RAM
The limits the maximum queue size to 255, which I think is ok for the
forseable future.
sizeof(uORB::DeviceNode) is reduces from 128 to 112 on NuttX, and with
~80 instances, this saves over 1KB of RAM.
Instead use a single timestamp for subscription checks. This frees up
~800B of RAM.
Also make sure the subscription checks are distributed over time. On each
update, at most 1 topic subscription is checked. Reduces the load of the
logger from 7.3% to 5.8% (Pixracer)
ulog_message_info_header_s *msg = reinterpret_cast<ulog_message_info_header_s *>(buffer);
members of msg could end up unaligned, because of the uint8_t buffer.
_baro_topic can be null in init sequence
init call collect before the topic is inited.
I think this pattern is repeated in other drivers. I would suggest
allowing null in orb_publish to just return.
app.h, generated from app.h_in, has unnecessary code duplication
and isn't a header file (it defines globals, static functions
and doesn't have a header guard, moreover, it has a 'using namespace
std;'). Because of this, a real headerfile that declares the stuff
defined in apps.h was missing leading to even more code duplication:
scattered forward declarations in .cpp files and an often repeated
type of std::map<std::string, px4_main_t>.
This patch moves cmake/qurt/apps.h_in to src/platforms/apps.cpp.in
(with some changes) and removes cmake/posix/apps.h_in.
Then src/platforms/apps.cpp.in is split into src/platforms/apps.cpp.in
and src/platforms/apps.h.in, splitting declarations from definitions.
A typedef is defined for the map (apps_map_type).
The main difference between cmake/posix/apps.h_in and
cmake/qurt/apps.h_in was that the first defined a global 'apps',
while qurt stores the apps in QShell. I opted to get rid of
the global variable (which are in general evil for various reasons)
and used the API of cmake/qurt/apps.h_in where a provided 'apps'
map is initialized with a call to init_app_map. Thus removing
the existing code duplication.
fixes a 'test: syntax error' message on startup. There were two problems:
- the expansion of $MAVLINK_F lead to multiple arguments in the test
when the variable contained spaces. Fixed with ""
- the x prevents interpretation as a unary expression, if $MAVLINK_F starts
with a - character (in that case the expansion would be:
if [ -r 1200 ... and nsh interprets - as unary expression)
This limits the maximum bandwidth of ulog streaming to 70% of the specified
mavlink datarate. If less is used, the leftover is assigned to the mavlink
streams, if more is used, it starts to drop.
mavlink status outputs the currently used rate, to check if a link is
saturated.
tested on Pixracer: 14 still produces some dropouts once in a while, but I
think it's a fair tradefoff between RAM usage & dropouts. The queue needs
about 3.5KB of RAM.
When topic sizes/logging rates change, this will have to be reevaluated.
The packet_count was actually an error_count, therefore we should
process RC input only when the error_count since the last packet is 0.
Also, this commit fixes the RSSI scaling for st24.
The firmware binary is to large to fit into the onboard memory of the Parrot
Bebop. It could be uploaded to the emmc, but for ease of use it would be nice
to have it in /usr/bin. To strip the binary seems to be the best option right now.
The pthread linker flags were changed in c6a2641 and it was questioned in #5504 if the
exception for the Bebop is necessary. It is not, so remove those lines from the cmake
file.
This adds the capability to forward the commands
- MAV_CMD_VIDEO_START_CAPTURE
- MAV_CMD_VIDEO_STOP_CAPTURE
- MAV_CMD_IMAGE_START_CAPTURE
- MAV_CMD_IMAGE_STOP_CAPTURE
at waypoints which will then be sent over mavlink to component id
100 aka MAV_COMP_ID_CAMERA.
We don't need to poll for vehicle commands, we will get them anyway by
doing orb_check. Also, the polling for them wasn't implemented correctly
anyway.
It was found inconvenient that auto-disarm triggers too quickly right
after arming when the vehicle has not actually taken off yet.
Therefore, the auto-disarm takes now by a factor of 5 longer if the
vehicle has not taken off yet.
The Nuttx CAN driver is not used with UAVCAN. However to
facilitate compilation to allow the Nuttx CAN Example to be
compiled and linked, the missing proto type was needed.
Futhermore to include the NuttX CAN eaxample the following changes
are needed:
1 ) In cmake/configs/<target>.cmake
Add can to config_extra_builtin_cmds as:
set(config_extra_builtin_cmds
serdis
sercon
can
)
Add:
add_custom_target(can)
set_target_properties(can PROPERTIES
PRIORITY "SCHED_PRIORITY_DEFAULT"
MAIN "can" STACK_MAIN "2048"
COMPILE_FLAGS "-Os")
2) Update the nuttx-configs/<target>/nsh/defconfig
Run make oldconfig and make menuconfig and set the follwoing:
CONFIG_CAN=y
CONFIG_STM32_CAN1=y or CONFIG_STM32_CAN2=y
CONFIG_CAN_EXTID=y
CONFIG_CAN1_BAUD=250000
CONFIG_CAN_FIFOSIZE=8
CONFIG_CAN_NPENDINGRTR=4
CONFIG_EXAMPLES_CAN=y
By default the baudrate in flight stack (Mavlink or NSH) 57600 and the default
baudrate of bootloader is 115200. So we may need to set different
baudrates.
The Mavlink reboot messages was only requesting the board to reboot.
If the flashed bootloader has a small or no timeout user will
never be able to update firmware.
The integrators were set to publish at 800Hz which was overwhelming
the CPU with the EKF running. This brings them in line with what we
get from the MPU6k device.
- 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>
If they're in the header and the header is used in multiple .cpp, there
are multiple definitions. Oddly it did not lead to an error, but there
were multiple structs of the same topic but with different adresses.
This lead to a metadata mismatch, when running eg:
uorb_tests
uorb_tests latency_test
The thread name is used from within the entry of the new thread, but the
provided name could live on the stack of the caller thread. Thus we need to
copy the name.
The simulated timer interrupt always adds a new scheduled work task, which
is called from the work queue thread. Sending the signal creates measurable
overhead (~5% of the px4 CPU runtime) and is unnecessary, since the thread
is not sleeping anyway.
With this change only builds for NuttX which are very much flash size
constraint are optimized for size. All other builds (e.g. SITL,
Snapdragon, etc.) are left at the default for debugging or -O2 for the
usual use.
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.
This fixes a corner case where the first advertise/publish of a
vehicle_command_ack was missed. What happened was that the
orb_subscribe_multi was not called until the topic had been published
and therefore orb_exists was happy. This means that by the time
orb_subscribe_multi was finally called, the first vehicle_command_ack
was already history and not detected by orb_check.
This changed adds a flag to the MavlinkOrbSubscription which tells it to
subscribe to a topic from the beginning.
This reset the cruise speed which can be set by mission items/waypoints
to set a custom speed. Once, switched out of mission, it makes sense to
use the speed set by the param again.
The px4_os_add_flags defined in cmake/posix/px4_impl_posix.cmake did
add (threading) libraries to added_exe_linker_flags, which subsequently
end up in CMAKE_EXE_LINKER_FLAGS and then have no effect because those
flags are passed to the linker before any of the object files and static
libraries.
Those libraries are already added correctly in the corresponding
src/firmware/*/CMakeLists.txt files (for qurt, nuttx AND posix).
I left in the non-library linker flag '-pthread' for the bebop board,
although it seems very weird to me that this is needed (is it?).
If that is needed then it seems weird to link manually (that is,
src/firmware/*/CMakeLists.txt) with -lpthread.
For linux/g++ -pthread is added to the CXXFLAGS as it should be:
this causes the compiler to define _REENTRANT which is needed
for (the interface of) certain libraries to become thread-safe.
Offically one also can just pass -pthread to the linker, which then
causes the right libraries to be linked, but just linking with
-lpthread -lm -lrt works too.
I ran into this while adding support for libcwd, which explicitly
complains that _REENTRANT isn't defined when trying to link with
the thread-safe version of libcwd (-lcwd_r) and then tells you
to use -pthread.
add missing break
uorb topics generator: add multi-topics to the list of all topics
topic names with '# TOPICS <name>' were previously not in orb_get_topics().
This means the logger could not find them.
Affects for example actuator_controls_0.
px_generate_uorb_topic_files.py: add multitopics to generate_topics_list_file_from_files method
switch simulated attitude to new topic: vehicle_attitude_groundtruth
logger: add input_rc topic. needed for web plotting
input_rc.msg: remove timestamp_publication, use timestamp instead
mixer.cpp: warnx -> PX4_ERR
logger: initialize timer_call to 0 (hrt_call_every reads some fields)
position_setpoint_triplet topic: set the timestamp when publishing
px_generate_uorb_topic_files.py: add multitopics to generate_topics_list_file_from_files method
add vehicle_attitude_groundtruth to default topics
change to hil_state_quaternion
topic names with '# TOPICS <name>' were previously not in orb_get_topics().
This means the logger could not find them.
Affects for example actuator_controls_0.
On second thought, using % just isn't correct. When a make
target looks like:
foo% bar%:
...
Then that implies that it will build BOTH foo% and bar% whenever
that rule is triggered (by either) for any value of the pattern %.
Clearly that is not what we want / intend.
So, this commit goes back to using config targets without a % in it
by generating a full list of them.
It also turns sitl_deprecation into a Hidden Target.
Finally, now that we have those target lists anyway, I added
a 'help' and 'list_config_targets' targets that print the
available targets.
Note that the '%' catch-all target only works when all other targets
either have a recipe or are marked as .PHONY, otherwise such targets
are only interpretted as dependencies and still executre the '%'
target afterwards, which is not what we want.
* navigator/mavlink: always send last reached item
Since we can't rely on mavlink that every message arrives, it makes
sense to continuously send the last reached waypoint.
* navigator: don't report reached for takeoff
If a takeoff waypoint has been inserted, we should not report that we
reached a mavlink mission item because we actually have not.
* This allows one to run 'make posix list_vmd_make_targets' and get output like
>make posix list_vmd_make_targets
[...]
-- Build files have been written to:
/usr/src/debian/px4/Firmware/Firmware.git/build_posix_sitl_default
PX4 CONFIG: /usr/src/debian/px4/Firmware/Firmware.git/build_posix_sitl_default
Scanning dependencies of target list_vmd_make_targets
[100%] List of acceptable 'posix_sitl_default' <viewer_model_debugger> targets:
none
none_iris
none_iris_opt_flow
none_tailsitter
[...]
replay_solo_valgrind
replay_typhoon_h480_valgrind
[100%] Built target list_vmd_make_targets
Or, run 'make list_vmd_make_targets' from the build_posix_* directory.
* This adds the list_cmake_targets make target to print all
cmake targets that one can match with PX4_NO_OPTIMIZATION.
PX4_NO_OPTIMIZATION is ignored (do optimization as normal)
when the CONFIG isn't posix_sitl_*.
* Add comment in Makefile on how/where to find all targets.
This allows one to set a semi-colon separated list of regular
expressions in the environment variable PX4_NO_OPTIMIZATION
to control which (cmake generated) targets should be compiled
without optimization.
Suppressing optimization can be necessary for debugging in
a debugger, especially when trying to step through the code
or needing to print variables that otherwise are optimized out.
EXAMPLE
export PX4_NO_OPTIMIZATION="px4;^modules__uORB;^modules__systemlib$"
will result in the following messages during cmake configuration:
[...]
-- Disabling optimization for target 'platforms__posix__px4_layer'
because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'modules__systemlib' because it
matches the regexp '^modules__systemlib$' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'modules__uORB' because it matches
the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'examples__px4_simple_app' because
it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'modules__uORB__uORB_tests' because
it matches the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION
-- Disabling optimization for target 'px4' because it matches the regexp
'px4' in env var PX4_NO_OPTIMIZATION
Note that a list of all (currently used) target names can be printed
with the following command line from within the required build directory:
find . -wholename '*/CMakeFiles/*.dir/flags.make' | xargs dirname | xargs basename -a | sort -u | sed -e 's/.dir$//'
While the config_sitl_rcS_dir is used more extensively (and actually
only depending on the base cmake target), the variables
config_sitl_viewer and config_sitl_debugger are just used to be
passed on for the run_config target; config_sitl_debugger is even
*always* 'disable'. Hence, they don't really need to be cached
(INTERNAL or not). Before this patch FILEPATH was used instead
of INTERNAL, but I doubt very much that that was intended. That
only makes sense when cmake-gui would be used and then would pop-up
a file browser to let the user pick a file (while really they
need to pick a directory, so it's wrong either way).
The ONLY reason caching would be used is when a developer edits
the build_posix_sitl_*/CMakeCache.txt files, changes these values
and then runs cmake in the build directory again, now overriding
the values intended here. Nevertheless, I left in the caching.
The main change in this commit (that theoretically has no real effect)
is that I removed the duplicated maintenance of
posix_sitl_broadcast.cmake. When that file was added, it was an
exact copy of posix_sitl_default.cmake and is since not always
maintained to remain the same. I don't think that difference is
in anyway relevant for the broadcasting part though.
Note that I think that something like that also holds for the
posix_sitl_replay.cmake; it would be a lot better - maintenance-wise
- when it was just derived from (or the same as) posix_sitl_default,
I think.
Doesn't really do anything, but while working on understanding
things I did this cleanup, making the Makefile a lot shorter
and more flexible for future changes ;).
Over time I made a few changes unrelated to what I'm really working on.
These changes are hereby committed first. The bug fixes are related to
what I'm doing in that I need them to be fixed for future commits.
Tools/sitl_run.sh: rename label to rcS_dir and fix usage help.
cmake/common/px4_base.cmake: Remove the check on OUT_UNPARSED_ARGUMENTS,
and a few typos and indentation issues.
cmake/configs/posix_sitl_replay.cmake: Set the correct variable
(config_sitl_rcS_dir) to the correct directory.
cmake/nuttx/px4_impl_nuttx.cmake: typos and indentation issues,
and removal of a redundant FORCE (INTERNAL implies FORCE).
cmake/posix/px4_impl_posix.cmake: typos and indentation issues.
cmake/qurt/px4_impl_qurt.cmake: typos and indentation issues.
src/modules/mavlink/mavlink_ftp.cpp : possible strict-aliasing breakage.
NOTES
The second argument passed to sitl_run.sh is the value of
config_sitl_rcS_dir. This fact is missing from the usage help.
I renamed 'label' to 'rcS_dir' to better reflect this.
Also, for the 'replay' config the wrong variable was set causing
the call to sitl_run.sh to skip an argument and fail (ie the
debugger was passed as rcS_dir and so on).
The check on OUT_UNPARSED_ARGUMENTS in px4_parse_function_args
basically causes every passed IN variable to be REQUIRED and is
therefore a bug. The test for the presence of the REQUIRED arguments
follows directly after and is sufficient for this job. This bug went
unnoticed because currently every argument to OPTIONS, ONE_VALUE,
and MULTI_VALUE is actually passed to the function(s) calling
px4_parse_function_args (them being REQUIRED or not).
The changes in mavlink_ftp.cpp are to avoid a possible aliasing bug
and (mostly) to avoid the compiler warning/error: dereferencing type-
punned pointer will break strict-aliasing rules [-Werror=strict-aliasing].
GCC 6.1.1 output:
../src/modules/fw_att_control/fw_att_control_main.cpp:884:41: error:
implicit conversion from ‘float’ to ‘double’ to match other operand of
binary expression [-Werror=double-promotion]
It is useful to run jmavsim separately, for example when debugging mainapp
separately, or running some other external tool on mainapp (like heap
analysis)
This splits vmount into inputs and outputs modules with a small API in
between. It allows for greater flexibility, as any input method can be
combined with any output method. At the same time it is easy to add a new
input or output module.
MavLink spec implementation
implemented vehicle_roi topic
rename old gimbal to rc_gimbal
little changes
corrected RC Gimbal group
Starting ROI implementation in commander
implementation done, needs to be tested
uhm..
add todo
Change to float32 for x,y and z
remove mission topic again, not needed
change roi coordinates to lat, lon and alt
adjust to float64
starting mount implementation
correcting small mistakes, compiles now
add todos
further progress
implementing parameters
adjust default parameters
started implementation of mavlink
fix typo
change to lat, lon and alt
fix typo :D
change to double (to represent float64)
add global_position_
add mount topic
commander mount implementation done
cleanup
almost finished
little fix
codestyle fixes
leave pitch at 0 degrees
added pitch calculation
codestyle changes
Undo vehicle_mount, react to updated parameters, parsing of CMD_DO_MOUNT_* in mount.cpp
start implementing mode override
forgot a semikolon.
add debug
Finish implementation of mount override and manual control.
fix codestyle
correct cleanup
rename to vmount
works now
fix rebase error
fix polling
refactoring and custom airframe for gimbal
couple changes
remove warnx
almost done
finally
What is going on?
change back to actuator_controls_2
working
bump parameter version number and some clarification
fix submodules
When running a simulation with, for example,
make posix jmavsim
px4 crashed almost 100% reproducable near start up.
This turned out to be a stack overflow. On gitter
it was suggested that the main reason for this could
be stack sizes, as currently used, assume a 32bit pointer
size and that doubling the stack size for everything
but NuttX would be the Right Thing.
This is the solution that I came up with (it makes
my core dumps disappear).
Fix build error
Capitalization mistake for headers
Non-Mac compiler issue
Baudrate for crazyflie nrf and fix code style
Save space
Cleanup mpu9250 driver
Working crazyflie firmware build
* Console on USART3
* Could not disable building PX4IO firmware, currently commented out
Don't build PX4IO firmware if the board doesn't ask for it
Added crazyflie motor driver
Fixed wrong register
CLK_SEL is in PWR_MGMT_1
Initial I2C/SPI MPU9250 device
* Tested with I2C
* Need to add error checking
* Intermittent crash on stop call
Working ak8963 mag driver
Functional lps25h driver. Work in progress.
Works well enough to probe and allow sensors task to start.
Added serial port test module
HACK! Get sensors module working
Set crazyflie PWM range
Extend baudrate for Crazyflie's NRF radio
Added dummy tone alarm to allow for init
Added autostart script for Crazyflie
After I got a compiler warning for a printf format in this file
(which I cannot reproduce anymore; for some reason g++ is usually
quite happy with all the errors in this file), I fixed all 'printf'
formats to match the type of their arguments as follows:
uint8_t : %hhu
uint16_t : %hu (or %hx)
uint32_t : %u (or %x)
int16_t : %hd
int and int32_t : %d
long int : %ld
Since this file is C++, what we REALLY should be using is
ostream operator<<'s of course (type safe by design and faster
(compile time type matching, no need for format decoding)).
readdir_r is deprecated since glibc version 2.24 and glibc manual
recomends usage of readdir instead of readdir_r.
Replacing readdir_r by readdir will also not be a problem for Nuttx,
because readdir_r is using readdir and filling parameters with the
return information.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
this lets a user select what msgs should be compiled for his project
Care must be taken though, to compile all orb_topcis that are required by the Rest of the Code.
Otherwise many compile errors will occur.
This commits adds by default the ./msg include path to reference to other msgs.
if an exisiting msg is used in another msg.
- ulog file message rate limited to 50Hz
- queuing with size 2
- this replaces the mavlink log message in the ulog
(but the mavlink warnings & errors still go to the ulog)
* Helicopter aiframe and basic PID control
* codestyle
* Blade 130x gains working but not optimal
* Changed behaviour of feedforward for all multicopter
* 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.
This parameter, when enabled, enforces that the UAVCAN ESC driver never outputs zero throttle
while the system is armed. This feature is disabled by default, so the change will not break
the experience of current users.
- replay was not working without these values as only range measurements
were given to the filter which were between the min/max value
Signed-off-by: Roman <bapstroman@gmail.com>
Reasons:
- DeviceMaster::_node_map does not need to be shared among instances,
because there is at most 1 instance per Flavor and different Flavors
have non-intersecting device paths.
- Keeping it static would also require a static lock
- DeviceMaster::_node_map was not locked at all when used from
uORB::Manager
So this fixes two synchronization issues:
- Different DeviceMaster objects could access the same static data in
parallel
- getDeviceNode() called from uORB::Manager did not use any locking at all
This has the following benefits:
- Manager can ensure that there is at most one instance of DeviceMaster
per Flavor
- The Manager needs access to (static) data of DeviceMaster already.
This will make it easier to access this data in a non-static way, and
does not introduce new dependencies.
It uses a queue length of 6. There are 3 RTCM msgs/s, but due to
fragmentation and WiFi lags, there can be more than that. During several
tests, a length of 6 showed no queue overflows.
The mission feasability checker was called with the same arguments
twice which made it hard to understand when a mission is marked valid.
The mission check should run in these two cases:
- When initializing (if home comes up) if there is already a mission saved.
- When the mission gets updated.
The mission feasability checker was called with the same arguments
twice which made it hard to understand when a mission is marked valid.
The mission check should run in these two cases:
- When initializing (if home comes up) if there is already a mission saved.
- When the mission gets updated.
We should not spam the console just because the input data is
degenerate, it would only make things worse because everything would
slow down due to the printfs.
Opening/seeking/closing the file for each data chunk was extremely
expensive and drastically slowed the download process as the position
in the file increased. Over USB with large files this change + nuttx
update results in ~ 10x speedup for log downloads.
issue (GCC 6.1.1):
../src/modules/fw_pos_control_l1/fw_pos_control_l1_main.cpp:1284:27: error: implicit conversion from ‘float’ to ‘double’ to match other operand of binary expression [-Werror=double-promotion]
if ((fabs(air_gnd_angle) > M_PI) || (ground_speed_2d.length() < 3.0f)) {
If the circuit breaker to disable IO safety is engaged, the safety
button should still blink in the appropriate pattern: double flash for
safety off, solid on for armed.
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.
The result from `!get_freefall_state()` was always true because
`get_freefall_state()` is already called before `get_landed_state()` is
called. Only if we're not in a freefall, we check if we are landed.
The hysteresis was not properly implemented in the land detector and is
therefore replaced by the library call, both for the freefall detector
and the land detector.
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.
The override checking was scattered across two places and is now unified
in controls_tick(). The part in mixer_tick only decides which mixer (or
none) to use give the override flag.
This fixes a bug where multirotors got into override mode when the FMU
is dead/not responding.
The main bug was that the check was for FMU_OK || MANUAL_OVERRIDE_OK
in order to get further in the override checks.
Also a mixer_tick was called inside the controls_tick even though these
are called in px4io.c after each other anyway.
In order to test what happens in px4iofirmware when the FMU stops
sending PWM or control commands, I added a test mode. When the test mode
is activated, no controls are sent.
If disarmed PWM values have been set, we can't accept a disarm command.
If we did, the PWM output stop alltogether after the high pulse of the
ESC calibration.
* logger: prevent logpath buffer overflows
The handling of the log path had the potential to cause buffer
overflows, especially on POSIX platforms where the paths are often much
longer than just 64 chars.
* sdlog2: prevent logpath buffer overflows
When the log folder path was created, this was done with the unsafe
sprintf function instead of snprintf. This caused buffer overflows in
SITL but the overflow was usually not detected until recent testing of
some work in progress.
- attitude setpoint generation for stabilized mode was shifted back
to the fw attitude controller. since the fw position controller is polling
on global position attitude setpoints were not generated when global
position was not published.
Signed-off-by: Roman <bapstroman@gmail.com>
- generate complete attitude setpoint for position and altitude
control mode
- fix generation of roll setpoint for position control which lead to
wing rock
- add roll and pitch setpoint offsets so that they are logged as well
Signed-off-by: Roman <bapstr@ethz.ch>
The reason for this change is that RPi2 and RPi3 are compatible, and
hopefully all differences coming up can be resolved without ifdefs but
at runtime.
* logger: disable some default topics, which are most likely not used
This is also to safe CPU and lower the amount of file descriptors used.
* logger: use the hrt timer for more accurate scheduling
Under NuttX with the default rate of 285Hz, the actual measured rate was
only 200Hz while on Linux it was ~280Hz. The reason is that NuttX only
uses a usleep() granularity of 1ms, so that the typical sleep time is
longer than what we set.
Now the logger waits on a semaphore, which gets activated periodically
with a hrt timer. With this the measured rate is exactly the expected one,
285Hz.
This fixes a bug with following setup:
- two (or N > 1) connected gyros
- ekf2 enabled
In this case, sensors would publish with the combined rate of the gyros,
but with N following messages having the same gyro data & timestamp.
Apparently ekf2 cannot handle this, the other estimators can.
We may want to rethink what the proper solution is here.
The MavlinkOrbSubscription only had an interface to either always copy
or copy based on a timestamp. This commit adds a copy interface if the
topic has been updated.
since pure manual control for fixed wings in handled on the io side
the scale parameters for roll, pitch and yaw had to be introduced there
as well.
Signed-off-by: Roman <bapstr@ethz.ch>
These will only start replay if there's an environment variable 'replay',
otherwise they do nothing.
We apply the parameters even before loading the modules, so that the
modules 'see' the same state as the recorded system had. We will have to
see how well this works in practice.
__STDC_FORMAT_MACROS changes the behavior of inttypes.h to allow
defining format macros for printf-like functions. It needs to be defined
before any include is done, otherwise due to include chains and header
guards it may not take effect.
Instead of having to define it everywhere it is used, move the define to the
build system. Also update ecl and DriverFramework submodules to deal with the
changed definitions.
Sdlog2 misses least updates when the CPU scaling governor is set at
maximum performance. This is not optimal to save power but the best
effort until there is a RT patched kernel on Snapdragon.
Previously, the MAX and MIN were both 512 meaning that usually it would
start writing at > 512 bytes but only write 512 bytes which results in
a 512 bytes write shortly followed by a e.g. 30 bytes write.
Also, performance (measured in missed poll updates) seems slightly
better on Snapdragon with bigger chunks.
This only applies parameters from the log file and user-supplied overrides.
It is intended to be called as one of the first startup commands (after
param load), so that during startup, all applications find the parameters
from the replayed system.
Note that this is an optional command and 'replay start' will again load
and apply the parameters in any case.
This adds a new module that does:
- read an parse an ULog file, given via ENV variable 'replay'
- apply all parameters from the log file
- read and apply user-defined override parameters from a file
- publish all messages in 'real-time' from the log file and add a constant
offset to the timestamp to match the system time.
- apply changed parameters in the log (which are not overridden)
If enabled, orb reads a rules file (./rootfs/orb_publisher.rules) on
startup. This can contain rules about which module is allowed to publish
which topic. It is completely transparent, so a publisher does not know
if he's not allowed to publish, and publications will look as if they
succeeded.
To test, add
#define ORB_USE_PUBLISHER_RULES
to uORBManager.hpp
Reason: the value is easier to read & handle (for example plotting). In
most places the value is needed, not the integral.
Note that this breaks the replay format for sdlog2 replay
- voting is now at a central place instead of duplicated within the
estimators
-> this also means that estimators that did not do voting so far,
now have voting, like ekf2
- estimators requiring more than that can still subscribe to the raw
sensors
- allows sensors_combined to be 3 times smaller
- reduces logger, memcpy (cache) & RAM overhead
- all modules requiring only 1 or 2 sensor values now automatically get
the voted result
- this also adds voting to baro
Decreases the message size from 780 to 280 bytes.
In particular, all modules using sensor_combined must use the integral now.
The sensor value can easily be reconstructed by dividing with dt.
Voters now need to be moved into sensors module, because error count and
priority is removed from the topic.
Any module that requires additional data from a sensor can subscribe to
the raw sensor topics.
At two places, values are set to zero instead of subscribing to the raw
sensors (with the assumption that no one reads them):
- mavlink mavlink_highres_imu_t::abs_pressure
- sdlog2: sensor temperatures
These are not really used. differential_pressure is just copied from the
topic with the same name.
for sdlog2 we assume no one needs the diff pressure fields and set it to 0.
We plan to switch to the new logger soon anyway.
Drawbacks of the previous method: when writing to the SD card, there are
high delays in the write() call of several 100ms, every now and then. The
frequency and length of these events depend on:
- SD card
- used logger bandwidth
- bandwidth of gps data (RTCM)
Since the whole gps thread was blocked during this period, it lead to
gps timeouts and lost module.
What we do now is: publish an orb topic with queuing. This makes it async
and the logger takes care of buffering. This means it's best to:
- use high logger rate
- use large logger buffer
- reduce logger bandwith by disabling unused topics
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.
* Use variance to control publishing for LPE.
* Don't stop publishing if we have gps/ baro.
* LPE tuning and cleanup.
* Added bias saturation to LPE.
* Added vector enabled low pass filter block.
* Added rk4 integration and pub lowpass to LPE.
* Fix std::abs issue on mac/ reset lowpass on state reset.
* Don't estimate gyro bias when rotating at high speed att_est_q.
* Lowered low pass on position to 5 Hz for LPE.
* Streamline state space update for LPE.
* Added health flags to est2 log.
* Revert to old tuning, more conservative, less faults.
* Formatting.
* Fix for fault message on LPE.
* Added subscription throttling to LPE.
* Formatting.
GCC output:
implicit conversion from ‘float’ to ‘double’ to match other operand of
binary expression [-Werror=double-promotion]
It seems gcc 6.1.1 uses the float variant of fabs, whereas older gcc's
use the double version. This makes it compile for both.
* mavlink receiver: added handling of battery status
handle incoming battery status messages in order to support external
battery monitoring
Signed-off-by: Roman <bapstr@ethz.ch>
* sensor params: added parameter for battery monitoring source
Signed-off-by: Roman <bapstr@ethz.ch>
* sensors: only publish battery status if we don't have external battery
monitoring activated
Signed-off-by: Roman <bapstr@ethz.ch>
fixed logic such that parameters are saved when vehicle just landed.
only save parameters once when state changed from in_air to landed.
Signed-off-by: tumbili <roman@px4.io> and bkueng <beat-kueng@gmx.net>
The flow control state is improperly reflected as enabled if the arch/HAL rejects an IOCTL to turn it on. Mavlink::enable_flow_control updates _flow_control_enabled only if the IOCTL call does not fail.
- priority field uses only the lower 8 bits, so we can merge with the
update_reported flag
- orb_set_interval is not used often, so make the necessary data an
optional pointer and alloc only when needed.
Memory savings:
- pixracer (w. ekf2): 7.3kB
- pixhawk: 5.3kB
in altitude control mode for fixed wings the roll setpoint was not
logged because the position controller publishes the attitude setpoint
but the desired roll setpoint is calculated in the attitude control
module. Now the position controller calculates the roll setpoint as well
for the sake of logging.
Signed-off-by: tumbili <roman@px4.io>
If the failsafe state is ended when landed, we would switch back to
POSCTL and therefore take off again, however, all we want is stay on
ground and wait for the auto disarm.
The param COM_ARM_WO_GPS is set to 1 by default to allow arming without
GPS. This then sets a bool arm_without_gps which translates to
!GNSS_check in preflightCheck.
The deleted code conflicts with the failsafe handling in set_nav_state.
Also, flight termination was usually disabled by circuit breaker which
means this code had no effect anyway.
The param NAV_RCL_ACT was not implemented as described. Also, it has the
completely the wrong name. It should be a COM param and not NAV.
Therefore, remove the param and delete the partly implemented
and probably never used functionality.
Always use the DESCEND mode and not LANDGPSFAIL because LANDGPSFAIL will
try to loiter for some time and then request termination instead of
descending gently and trying to land.
Sometimes when flashing new firmware, the IO update fails because safety
is off. In this case, we should set safety on first before putting the
IO board into bootloader mode.
By running the loop in mc_pos_control without successfully polling on
position data, we still copy the manual input over so that
mc_att_control can consume it. This allows to fly in manual mode without
GPS and no position estimate.
&&if [ "$GCC_VER" = "4.8" ]; then GCC_URL="https://launchpadlibrarian.net/186124160/gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2" ; fi
&&if [ "$GCC_VER" = "4.9" ]; then GCC_URL="https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2" ; fi
&&wget -O gcc.tar.bz2 ${GCC_URL}
&&tar -jxf gcc.tar.bz2 --strip 1
&&exportline="export PATH=$HOME/gcc/bin:\$PATH"
&&if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
This repository holds the [PX4 Pro](http://px4.io) flight control solution for drones, with the main applications located in the src/modules directory. It also contains the PX4 Drone Middleware Platform, which provides drivers and middleware to run drones.
* Official Website: http://px4.io
*License: BSD 3-clause (see [LICENSE.md](https://github.com/PX4/Firmware/blob/master/LICENSE.md))
* Supported airframes (more experimental are supported):
* Official Website: http://px4.io (License: BSD 3-clause, [LICENSE.md](https://github.com/PX4/Firmware/blob/master/LICENSE.md))
*Supported airframes (more experimental types than listed here are supported):
Please refer to the [user documentation](http://px4.io) and [user forum](http://discuss.px4.io) for flying drones with the PX4 flight stack.
Please refer to the [user documentation](http://px4.io/user-guide/) and [user forum](http://discuss.px4.io) for flying drones with the PX4 flight stack.
### Developers ###
* [Developer Forum / Mailing list](http://groups.google.com/group/px4users)
* [Developer Forum](http://discuss.px4.io)
* [Guide for Contributions](https://github.com/PX4/Firmware/blob/master/CONTRIBUTING.md)
# BASEDIR may not contain a space, that's just too hard to get to work.
expr index "$BASEDIR"" " >/dev/null && fatal "it is not supported that BASEDIR contains a space."
# Make sure that worked.
test -f $BASEDIR/cmake/posix/px4_impl_posix.cmake || fatal "Failed to determine BASEDIR: '\$BASEDIR/cmake/posix/px4_impl_posix.cmake' is not a regular file."
# Parse command line parameters.
debug=0 # Set to non-zero to enable debugging.
force=0 # Set to 1 to force running of script even when there are uncommitted changes.
merge=0 # Set to 1 when merging a branch that didn't run this script into master that did already run this script.
while[[$# -gt 0]]
do
case$1 in
--debug)
debug=1
;;
--force)
force=1
;;
--merge)
force=1
merge=1
fatal "--merge is not implemented yet."
;;
-*)
fatal "Unknown option $1"
;;
--|*)
break
;;
esac
shift
done
non_option_arguments=$#
if[$non_option_arguments -eq 0 -a $debug -ne 0];then
fatal "--debug screws up the source files with debug output! You must provide a single filename to run on."
fi
# Better not run this script with changes that still need to be committed.
cd"$BASEDIR"|| fatal "Could not change directory to \"$BASEDIR\""
header = $is_header; # 0: do not look for a header guard; 1: treat first #ifndef as header guard.
in_if = 0; # The number of nested levels inside #if, #ifdef or #ifndef ... #endif constructs.
in_if_base = 0; # 0: no header guard was found (or #pragma once); 1: an #ifndef header guard was found.
in_decl = 0; # 0: not inside a __BEGIN_DECLS ... __END_DECLS block; 1: inside such a block.
found_guard = 0; # 0: no header guard was found; 1: a header guard was found (including #pragma once).
base_if = 0; # The current base-level #if that we are scanning.
drag = 0; # The number of lines since the last certainly relevant line (a base-level #include or a base-level #endif containing one of more #includes).
skipped = 0; # 0: No #include was encountered in the current (base-level) #if block; 1: one or more #include's encountered in the current base-level #if block.
in_comment = 0; # 0: not in a multi-line C comment; 1: in a multi-line C comment.
cdbl = 0; # Current debug line.
error = 0; # 0: no error occured; 1: an error occured.
ptr = 0; # Current pointer into line[] and type[].
found_comment_end = 0; # The last line (possibly the current line) that is/was a multi-line C comment termination.
last_none_type = -1; # The last non-emptyline type that was added.
last_nonws_type = -1; # The last non-whitespace type that was added.
error_msg=$(echo"$result"| grep "^$EP"| sed -e 's/^....//')
if[$debug -ne 0];then
len=$(echo"$result"| wc --lines)
echo"$result"| head -n $((len -1))| grep -v "^$EP"# Debug messages
echo"vars: $vars"
fi
# Evaluate the last line printed in END.
error=1;eval$vars
test -z "$error_msg"|| print_error "$error_msg"||return
test$error -eq 0 -a $first_line -gt 0|| print_error "FAILED to find an #include in $1?!"||return
test$last_line -ge $first_line|| print_error "FAILED to find a sensible last line in $1?!"||return
# Calculate the number of lines starting from the current line.
# Use sed to count lines, because wc --lines doesn't report the last line when that doesn't end on a new-line, contrary to the fact that tail treats such lines as lines.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.