Commit Graph

23256 Commits

Author SHA1 Message Date
Randy Mackay e34aa0bc72 AP_GPS_MAV: minor formatting fixes
No functional change
2016-07-12 15:44:19 +09:00
Allan Matthew 1aaeceac2e Rover: support GPS_INPUT mavlink message 2016-07-12 15:35:23 +09:00
Allan Matthew c479fcab39 Plane: support GPS_INPUT mavlink message 2016-07-12 15:35:09 +09:00
Allan Matthew 860773260f Copter: support GPS_INPUT mavlink message 2016-07-12 15:34:51 +09:00
Allan Matthew 4249f7dbe6 AP_GPS: Add GPS_MAV type and accept GPS_INPUT message 2016-07-12 15:34:27 +09:00
Randy Mackay da71e7667f mavlink: submodule update to include GPS_INPUT 2016-07-12 15:11:24 +09:00
Tom Pittenger 84ce499a0d AP_Baro: remove zero-init in constructor 2016-07-11 22:11:34 -07:00
Tom Pittenger 1d81df8144 Revert "AP_Baro: coverity scan - variables not initialized in constructor"
This reverts commit 8d2872d3ab.
2016-07-11 22:02:41 -07:00
Tom Pittenger 7751bee3be Revert "Plane: coverity scan - variables not initialized in constructor"
This reverts commit 9b807fa8a5.
2016-07-11 22:02:30 -07:00
Tom Pittenger 9fb4a928e5 Revert "AP_Airspeed: coverity scan - variables not initialized in constructor"
This reverts commit 93462d0fe3.
2016-07-11 22:02:22 -07:00
Tom Pittenger fc02908c0d Revert "GCS_MAVLink: coverity scan - variables not initialized in constructor"
This reverts commit bd8debdf8b.
2016-07-11 22:01:50 -07:00
Tom Pittenger 773372d2f3 Revert "AP_TECS: coverity scan - variables not initialized in constructor"
This reverts commit 753c0d47f0.
2016-07-11 22:01:26 -07:00
Tom Pittenger c38c3ae7fe Revert "AP_TECS: coverity scan: init variable struct"
This reverts commit 19713200e5.
2016-07-11 22:01:02 -07:00
Tom Pittenger be752164f4 Revert "AP_L1_Control: coverity scan - variables not initialized in constructor"
This reverts commit d558f32142.
2016-07-11 21:59:12 -07:00
Andrew Tridgell 871219d199 SITL: support helicopters with X-Plane 10
we get collective from "throttle2" and get interlock from generator1 on/off
2016-07-12 14:40:08 +10:00
Andrew Tridgell e8976d3a89 Plane: check for optflow enable in more places 2016-07-12 09:05:52 +10:00
mirkix d018a32545 Plane: Only init optflow when enabled by parameter 2016-07-12 09:00:46 +10:00
priseborough 8793c75da0 AP_NavEKF2: clean up mag field learned logic 2016-07-11 00:44:33 +10:00
priseborough e6592186fc AP_NavEKF2: Tuning update
Slow down magnetic field learning
2016-07-10 08:21:18 +10:00
priseborough 10470b2dc1 AP_NavEKF2: fix bug in initialisation of declination co-variances
Co-variances were being re-zeroed after being set. This meant that the initial declination learning was sensitive to measurement errors which could result in poor initial yaw accuracy.
2016-07-10 08:21:18 +10:00
priseborough 6b04a81b8d AP_NavEKF2: Fix plane in-flight yaw reset bug
Fixes bugs that prevented planes being able to reset yaw to GPS to recovery from takeoff with a bad magnetoemter.

1) If the velocity innovation check had not failed by the time the in-air transition occurred, then the yaw reset would not be performed
2) The velocity states were not being reset
3) The non fly-forward vehicle (copter) reset could occur first and effectively lock out the fly-forward vehicle (plane) yaw check.
2016-07-10 08:21:18 +10:00
priseborough 51dbed2338 AP_NavEKF2: remember mag field states between flight on same power cycle
Remember the mag bias and earth field states learned during flight when the vehicle  lands.
This improves performance for vehicles that do multiple flight on one power cycle
2016-07-10 08:21:18 +10:00
priseborough 136df7cb5c AP_NavEKF2: reduce declination errors on start of 3-axis fusion
Reset co-variances for NE field states.
2016-07-10 08:21:18 +10:00
priseborough 744f19cd2d AP_NavEKF2: Improve scaling of output predictor I gain
Provide consistent overshoot of 5% across a wider range of time constants and prevent selection of larger time constants causing 'ringing' in the position and velocity outputs.
2016-07-09 15:57:36 +10:00
priseborough a49c16d63c AP_NavEKF2: Update output filter tuning
Updated tuning to take advantage of corrected time delta dtEkfAvg
2016-07-09 15:57:36 +10:00
priseborough 55dee347e0 AP_NavEKF2: Fix bug in averaged filter delta time
Average EKF time delta was not being updated.
2016-07-09 15:57:36 +10:00
priseborough cc7caa27bc DataFlash: Use a unique struct for EKF2 logging 2016-07-09 15:57:35 +10:00
priseborough 772c719df3 DataFlash: log tracking error for active instance of EKF2 2016-07-09 15:57:35 +10:00
priseborough 927186339c AP_NavEKF2: Improved output predictor tracking
Implement a PI feedback controller for velocity and position state tracking
2016-07-09 15:57:35 +10:00
priseborough 00b66ddc07 DataFlash: Log EKF2 output predictor tracking data 2016-07-09 15:57:35 +10:00
priseborough 253f744824 AP_NavEKF2: Collect output predictor tracking data 2016-07-09 15:57:35 +10:00
priseborough 14bb4f4574 AP_NavEKF2: Publish output observer tracking errors 2016-07-09 15:57:35 +10:00
priseborough fa435d0323 AP_NavEKF2: Allow for faster accel bias change in-flight
Fixes a problem observed in a flight log where rapid temperature change caused the accel bias to change faster than the EKF could keep up.
This allows the bias to be learned faster but with acceptable level of noise in the estimate
2016-07-09 15:57:35 +10:00
priseborough 191c34612d AP_NavEKF2: Fix bug in use of corrected IMU data
IMU data was being corrected before being used by the co-variance prediction, whereas the delta angles and velocities in the derivation were supposed to be uncorrected.
This patch creates separate variable for the corrected data
2016-07-09 15:57:35 +10:00
priseborough 118d5b88b2 AP_NavEKF2: Clean up output observer and reduce pos vel time constant
Previous Time constant was too large leading to poor tracking of EKF states in the presence of bad quality IMU data.
2016-07-09 15:57:35 +10:00
Lucas De Marchi b9f65996bc AP_HAL: sparse-endian: unconditionally use byteswap.h
This is either provided by a system header or a minimal header from
'missing' directory.
2016-07-08 19:49:32 -03:00
Lucas De Marchi 471de28967 AP_Common: provide minimal byteswap.h and endian.h 2016-07-08 19:49:32 -03:00
Lucas De Marchi 8a27680fbb build: check for endian.h and byteswap.h 2016-07-08 19:49:32 -03:00
Lucas De Marchi a014d0c790 mk: define missing headers for px4/qurt/sitl 2016-07-08 19:49:32 -03:00
Lucas De Marchi 40338c3272 AP_HAL: sparse-endian: use pragma once 2016-07-08 19:49:32 -03:00
Lucas De Marchi 6a80c3d70d AP_HAL: RingBuffer: remove trailing whitespaces 2016-07-08 16:44:26 -03:00
Lucas De Marchi 24c7f76034 AP_HAL: RingBuffer: remove C++11 initialization
They are already initialized in the constructor.
2016-07-08 16:44:09 -03:00
Murilo Belluzzo 3e1acdcbbf AP_HAL: Use atomic instead volatile on RingBuffer head/tail
Volatile will provide protection to sequence re-ordering and guarantee
the variable is fetched from memory, but it won't provide the memory
barrier needed to ensure that no re-ordering (by either the compiler or
the CPU) will happen among other threads of execution
accessing the same variables.

For more info about this effect can be found on articles about
std::memory_order.
2016-07-08 16:12:53 -03:00
Murilo Belluzzo b7dd4dad64 AP_HAL: Fix ByteBuffer::reserve() breaking buffer state
When using reserved(), the reserved memory cannot be read before it's
written, therefore we cannot update 'tail' until the caller of
reserved() is done writing.

To solve that, a method called 'commit()' was added so the caller can
inform that is done with the memory usage and is safe to update 'tail'.
The caller also has to inform the length that was actually written.

This solution was developed to work considering the usage context of
this class: 1 reader and 1 writer **only**.
2016-07-08 13:10:16 -03:00
Murilo Belluzzo 43d4012884 AP_HAL: Fix TOCTOU in ByteBuffer::peekiovec() 2016-07-08 13:10:16 -03:00
Murilo Belluzzo 9951b94d40 AP_HAL: Change the return type of 'peekiovec'
Possible values are '0', '1' and '2' so uint8_t is a better fit. Also,
invert 'if' condition so it's clear that is returning 0, 1 or 2.
2016-07-08 13:10:16 -03:00
Murilo Belluzzo 625f47def7 AP_HAL: Improve ByteBuffer::set_size
So it doesn't delete and re-create the buffer if the size
happens to be the same. Still resets the buffer content.
2016-07-08 13:10:16 -03:00
Murilo Belluzzo e9e31172c0 AP_HAL: Simplify ByteBuffer::readptr logic 2016-07-08 13:10:16 -03:00
Leandro Pereira fbefe32017 AP_HAL: Add method to reserve space in the ring buffer
Adds a method called `reserve()`, that will take a ByteBuffer::IoVec
array of at least two elements, and return the number of elements
filled out.  0 will be returned if `len` is over the total space of
the buffer; 1 will be returned if there's enough contiguous bytes in
the buffer; 2 will be returned if there are two non-contiguous blocks
of memory.

This method is suitable to be used with POSIX system calls such as
readv(), and is an optimization to not require temporary memory copies
while reading from a file descriptor.

Also modify the write() method to use reserve(), so that similar checks
are performed only in one place.
2016-07-08 13:10:16 -03:00
Leandro Pereira e3b676ba89 AP_HAL: Add method to peek non-contiguous parts of a ByteBuffer
Modify ByteBuffer class to have a `peekiovec()` method, that takes in a
`struct IoVec` array (similar to `struct iovec` from POSIX), and a
number of bytes, and returns the number of elements from this array
that have been filled out.  It is either 0 (buffer is empty), 1
(there's enough contiguous bytes to read that amount) or 2 (ring buffer
is wrapping around).

This enables using scatter-gather I/O (i.e. writev()), removing calls
to memcpy().  That's one call when no wrap-around is happening, and
two calls if it is.

Also, rewrite `ByteBuffer::peekbytes()` to use `peekiovec()`, so that
some of the checks performed by the former are not replicated in the
latter.
2016-07-08 13:10:16 -03:00