Commit Graph

23276 Commits

Author SHA1 Message Date
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
Andrew Tridgell
c926d7d41f Plane: fixed typo in quadplane landing detector
thanks to Paul for spotting this!
2016-07-08 18:38:43 +10:00
Andrew Tridgell
1a3b292aa3 autotest: fixed run_in_terminal_window() on Linux
try to retain MacOS functionality too
2016-07-08 08:20:20 +10:00
Lucas De Marchi
efb6b4c57e DataFlash: ifdef both __APPLE__ and __MACH__
This is how we do in other places and should mean that we are targetting
MacOS, not other apple products or other OSes using a mach kernel.
2016-07-07 12:41:51 -03:00
Siddharth Bharat Purohit
d65f453da1 AP_HAL_SITL:use common fenv function 2016-07-07 11:35:18 -03:00
Lucas De Marchi
c728b6c164 AP_Common: missing/fenv: fix coding style 2016-07-07 11:35:18 -03:00
Siddharth Bharat Purohit
484db9ff82 AP_Common: add replacements for fe control functions systems without them 2016-07-07 11:35:18 -03:00
Lucas De Marchi
e2498a1090 autotest: add function to kill tasks on MacOS
Like done on other cases, add an explicit function for that, which turns
the comment redundant.
2016-07-07 11:35:18 -03:00
Siddharth Bharat Purohit
4f0dad19ea autotest: support mac osx terminal launch 2016-07-07 11:35:17 -03:00
Siddharth Bharat Purohit
71c2f69a63 waf: add support for sitl build on mac 2016-07-07 11:35:17 -03:00
Lucas De Marchi
1923d9029e mk: use SYSTYPE for Darwin and append to LIBS 2016-07-07 11:35:17 -03:00
Siddharth Bharat Purohit
98c97a689f MK: remove unused and undefined librt as build flag for macosx 2016-07-07 11:35:17 -03:00
Siddharth Bharat Purohit
8903bc9eab AP_HAL: add support for get realtime on Darwin systems 2016-07-07 11:35:17 -03:00
Andrew Tridgell
3a8ed06267 Copter: added TKOFF_NAV_ALT parameter
this adds TKOFF_NAV_ALT which controls the altitude above takeoff that
navigation can begin. It is meant for unstable vehicles such as helis
to prevent blade strike during initial takeoff.

This also adds a new parameter class ParametersG2 which can hold 64
parameters. This is to avoid running out of parameters in the first
256 block
2016-07-07 14:21:47 +09:00
Andrew Tridgell
f090e9b27c HAL_Linux: fixed makefile build with PRIu64 2016-07-07 15:10:59 +10:00
Lucas De Marchi
3ba27df405 AP_Compass: BMM150: minor refactors
- Correctly sort includes and add missing AP_Math.h
  - Use anonymous struct for trim_registers in _load_trim_values,
    renaming its members so they don't start with underscore
  - Don't change _dig* values when we failed to read from sensor
  - Add some blank lines
  - Make _dig_* members be inside a _dig struct
  - Use constrain_int32 instead of if/else chain
  - s/time_us/time_usec/
  - Construct raw_field with a single constructor in _update()
  - Add missing copyright notice
  - Group methods together in declaration
2016-07-06 10:04:05 -03:00
José Roberto de Souza
6e53854122 AP_Compass: Add BMM150 backend 2016-07-06 10:03:30 -03:00
stefanlynka
fd2eb8bb31 Tracker: Adding altitude difference calculation using relative altitude. 2016-07-06 16:55:13 +09:00
stefanlynka
ca22f6612d Tracker: Changing pitch_range to pitch_min and pitch_max 2016-07-06 16:51:31 +09:00
stefanlynka
18e51da12d Tracker: Changed yaw slew margin 2016-07-06 16:40:22 +09:00
Andrew Tridgell
b6f58bdd98 Plane: don't give tuning errors when VTOL inactive 2016-07-06 14:41:49 +10:00
Randy Mackay
50bfd6e7fd Tracker: set armed state in mavlink heartbeat 2016-07-06 12:01:12 +09:00
Randy Mackay
a079c7bf4c Tracker: bug fix re ignoring invalid START_LAT message 2016-07-06 12:01:04 +09:00
Fernandes Pinheiro, Daker
51bf638ad3 PID: Remove unused method get_pid_4500 2016-07-06 08:45:01 +09:00
Tom Pittenger
19713200e5 AP_TECS: coverity scan: init variable struct 2016-07-05 14:09:40 -07:00
Tom Pittenger
6d0cf22358 AP_TECS: spelling 2016-07-05 14:09:39 -07:00
Tom Pittenger
753c0d47f0 AP_TECS: coverity scan - variables not initialized in constructor 2016-07-05 13:53:26 -07:00
Tom Pittenger
5f16d873b8 AP_L1_Control: coverity scan - ignoring get_position() result
- if no GPS location is available, do not continue computing navigation values. Hold old nav/target bearings and allow GPS failsafe to switch modes
2016-07-05 13:32:34 -07:00
Tom Pittenger
a74e86c234 GCS_MAVLink: coverity scan - computed value overwritten without use for SITL
- when building for SITL we should just skip the num_sends work instead of overwriting the value
2016-07-05 13:32:29 -07:00
Tom Pittenger
bd8debdf8b GCS_MAVLink: coverity scan - variables not initialized in constructor 2016-07-05 13:32:24 -07:00
Tom Pittenger
8d2872d3ab AP_Baro: coverity scan - variables not initialized in constructor 2016-07-05 13:32:06 -07:00