Commit Graph

20007 Commits

Author SHA1 Message Date
Roman 896118281c TECS: remove logic which shifts or limits integrator during large transients
- 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>
2016-11-14 22:43:33 +11:00
Paul Riseborough 9221c74e46 tecs: improvements to pitch integration limiting
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
2016-11-14 22:43:33 +11:00
Roman 7106881cbc tecs: fix limiting of pitch integrator input, better comments and structure
- 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>
2016-11-14 22:43:33 +11:00
Roman 12ddf9d25e TECS: better handling of the constraint for the pitch integrator
- 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>
2016-11-14 22:43:33 +11:00
Roman eec55a0918 TECS: run underspeed detection method before calculating speed demand
- 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>
2016-11-14 22:43:33 +11:00
Beat Küng dc6ca7c372 VDev & CDev: dynamically allocate & resize _pollset array
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.
2016-11-14 10:27:57 +01:00
Beat Küng 14fd1b8693 ulog_stream_ack.msg: lower timeout & increase max retries
We expect a short round-trip time, so lowering the retry timeout will
increase throughput on links with high drop rate.
2016-11-14 10:27:57 +01:00
Beat Küng d54e22614f fix mavlink ulog: return if initial ack not yet received
Avoid sending data before we have an ack from the logger.
2016-11-14 10:27:57 +01:00
Carlo Wood a96ee50442 Stop people from using broken awk. 2016-11-13 19:36:27 +01:00
Carlo Wood 0fbf26e955 Add Tools/fix_headers.sh
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! ;)
2016-11-13 19:36:27 +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 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
Lorenz Meier 86c581b2ef Enable usage of UAVCAN node ID for params 2016-11-13 18:43:15 +01:00
Lorenz Meier 9866ff8959 Allow sending a param with a different component ID 2016-11-13 18:43:15 +01:00
Benoit3 83e9e1c382 The goal of this patch is to allow compatibility with GR12/GR16/GR24 graupner receiver by :
- allowing decoding of SUMD frame with failsafe bit set
- updating stack failsafe state with the sumd failsafe info

Refer to #5817 issue
2016-11-12 14:28:57 +01:00
Michael Schäuble 697d401b73 Fix boot process on Pixhawk 2 (#5844)
* Pixhawk2: Check for mpu9250 during boot

* Fix indentation style
2016-11-12 12:57:33 +01:00
Mark Whitehorn 77a23a043f use include statement instead of symbolic link 2016-11-11 09:50:42 +01:00
Mark Whitehorn 92ae763535 change board_config to symbolic link 2016-11-11 09:50:42 +01:00
Mark Whitehorn 40f2c4a8e4 add new board config for fmu-v3 2016-11-11 09:50:42 +01:00
Paul Riseborough bdec646736 ekf2_replay: Display RMS innovation values to assist with tuning
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.
2016-11-11 08:51:12 +01:00
Julian Oes ab76a37910 DriverFramework: update of cmake_hexagon 2016-11-10 07:56:28 +01:00
Mark Charlebois 47c14395d3 Updated cmake_hexagon for Semaphore CI fix
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-11-10 07:56:28 +01:00
Julian Oes 6bdca1053c Next cmake_hexagon in Firmware and DriverFramework 2016-11-10 07:56:28 +01:00
Julian Oes 88e81aa58e cmake_hexagon: rpcmem and linking fix
This updates cmake_hexagon and cmake_hexagon inside DriverFramework
which fixes somethine about rpcmem.a and the double linking issue.
2016-11-10 07:56:28 +01:00
James Goppert 068ef591ab Added fake landing xy velocity measurement to lpe. (#5820)
Flight tested and is working.
2016-11-09 19:40:25 -05:00
James Goppert 4d6d0b2850 Fix px4io bind failed message to say safet is off instead of armed. (#5834)
Minor message clarity fix.
2016-11-09 19:39:39 -05:00
James Goppert 3511f8abfb Add position ground truth. (#5819)
Have confirmed this works with gazebo sitl.
2016-11-09 19:38:38 -05:00
Julian Oes d1d47c4c27 mavlink: send MOUNT_STATUS msg if subscribed
This adds the message MOUNT_STATUS to report about the attitude of a
gimbal.
2016-11-09 10:23:34 +01:00
Julian Oes 18d69698a0 vmount: publish mount_status
We need feedback in mavlink about the attitude of the gimbal. Therefore
the gimbal output angles are published in vmount.
2016-11-09 10:23:34 +01:00
Julian Oes 7e312f3961 msg: Added message for mount status 2016-11-09 10:23:34 +01:00
Julian Oes 8ddda0a8fa mavlink: move the msg id from uint8_t to uint16_t
With mavlink2 new messages are added with msg IDs greated than 255.
Therefore the msg ID types needed to be raised everywhere.
2016-11-09 10:23:34 +01:00
Julian Oes 278d63eef6 mavlink: update both submodule to lastest master 2016-11-09 10:23:34 +01:00
Julian Oes 7df11b900d mavlink: use queueing for acks 2016-11-09 08:50:13 +01:00
Julian Oes d0b1983784 mavlink: send NACK if msg ID does not exist 2016-11-09 08:50:13 +01:00
Julian Oes 1e617f362d mavlink: send ACK for CMD_SET_MESSAGE_INTERVAL
There was no feedback if a CMD_SET_MESSAGE_INTERVAL went through or not.
2016-11-09 08:50:13 +01:00
Beat Küng 643ccd66b6 MavlinkParametersManager: output deprecation warning if INAV is selected 2016-11-08 11:17:07 +01:00
Beat Küng d32d250a50 px4fmu-v2_test.cmake: remove inav 2016-11-08 11:17:07 +01:00
Beat Küng 66ffc834d3 startup scripts: remove INAV, start LPE if INAV selected 2016-11-08 11:17:07 +01:00
Paul Riseborough 246dc5421b ekf2: remove unnecessary variables found during review 2016-11-08 11:17:07 +01:00
Paul Riseborough d19a62a8f6 px4fmu-v1: Remove INAV to free required flash space 2016-11-08 11:17:07 +01:00
Paul Riseborough d75600b8a4 px4fmu-v2: Remove INAV to free required flash space 2016-11-08 11:17:07 +01:00
Paul Riseborough 0ee75dbc6b ekf2: Allow adjustment of min arrival time delta parameter 2016-11-08 11:17:07 +01:00
Paul Riseborough 08a380ae2d ecl: update library reference
Enables optimum setting of sensor data buffer lengths using specified data delays and min arrival interval.
2016-11-08 11:17:07 +01:00
Paul Riseborough 5ac73f3440 ekf2: code style fixes 2016-11-08 11:17:07 +01:00
Paul Riseborough 699edd2535 ekf2: Prevent loss of baro data due to buffer time arrival checks
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.
2016-11-08 11:17:07 +01:00
Paul Riseborough ef7ed97cbd ekf2: Don't send un-usable mag and baro data to the EKF
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.
2016-11-08 11:17:07 +01:00
Paul Riseborough 7d0d29f62d ekf2_replay: fix time stamping bug
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.
2016-11-08 11:17:07 +01:00
Lorenz Meier 7be71459f5 Offboard control (#5816)
* 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
2016-11-07 12:09:41 +01:00
Michal Stasiak 9180268a17 Geofence: Param update fix (#5812) 2016-11-06 14:31:59 -05:00