Commit Graph

296 Commits

Author SHA1 Message Date
Tom Pittenger f1f58e2026 AP_Baro: created baro drift offset accessor 2016-05-13 17:22:11 -07:00
Tom Pittenger d55050e5e3 AP_Baro: slow down the LPF for slewing to a new GND_ALT_OFFSET
Instead of a couple seconds, make it about 15sec. This makes TECS happy by not glitching the height demand as much. When applied too fast the TECS height demand causes a large single oscillation as it chases the filter lag.
2016-05-13 17:15:53 -07:00
Tom Pittenger 37ee3b44d2 AP_Baro: add accessor for baro drift 2016-05-13 17:15:41 -07:00
Lucas De Marchi 3c7d80a270 AP_Baro: BMP085: use a moving average of 10 samples in BMP085
Instead of depending on the frequency accumulate() is called, use
AverageIntegralFilter with 10 samples. The data obtained by BMP085 is
too noisy with any value of OVERSAMPLING so use twice the number of
samples as currently used. Besides that now we are sure there's always
10 samples used in the average.
2016-05-10 14:24:59 -03:00
Lucas De Marchi 8da5275b03 AP_Baro: BMP085: don't average temperature in BMP085
The temperature readings is not subject to white noise so there's no
point in averaging its reading. Moreover since for a normal 50Hz
accumulate() / 10Hz update() it would read temperature only once per
update(), it's pointless to keep averaging and introducing rounding
error.

The temperature doesn't need to be checked as frequent as pressure, too.
The datasheet even suggests on section 3.3, page 10 to enable standard
mode and read the temperature at 1Hz. Here we reduce it to 2Hz
(considering the accumulate() function being called at 50Hz).
2016-05-10 14:24:59 -03:00
Lucas De Marchi c5c52076ca AP_Baro: BMP085: rename private member 2016-05-10 14:24:58 -03:00
Lucas De Marchi e40b88aa70 AP_Baro: BMP085: use DigitalSource interface in BMP085
Use the DigitalSource interface rather than going through the "static"
interface hal.gpio provides
2016-05-10 14:24:58 -03:00
Lucas De Marchi 56fa1b6214 AP_Baro: BMP085: change oversampling in BMP085 without EOC
If we don't have EOC pin and assuming the accumulate() function is
called at 50Hz (or higher) we would take very few samples to accumulate
before the update is called. That's because since we have to wait 26ms
to get a sample and we calling accumulate() every 20ms, half of the
times it will return without getting anything.  So we will
be using 2 or 3 samples only to average.

If we don't have EOC, use OVERSAMPLING=2 which gives us more noise, but
that we can filter out by using measurements to average. When we have
EOC we don't need it because most of the time the conversion will take
less than 20ms: I'm getting 16ms on most of them while bench-testing.
2016-05-10 14:24:58 -03:00
Lucas De Marchi 37e2f6c52e AP_Baro: BMP085: allow to easily change oversampling in BMP085
This way it's possible to easily change it if a board requires.
2016-05-10 14:24:58 -03:00
Andrew Tridgell 8b7bf5cf7a AP_Baro: allow setHIL to set last update time 2016-05-07 18:27:21 +10:00
Andrew Tridgell 0b71652afc AP_Baro; allow for exact replay of baro data 2016-05-07 18:27:20 +10:00
Andrew Tridgell 8a987bf67d AP_Baro: removed filtering of baro data in HIL/SITL
this was just causing lag in replay and doesn't actually help in SITL
2016-05-07 18:27:18 +10:00
Don Gagne cae7ea0d13 Add @Volatile, @ReadOnly support 2016-03-17 10:58:05 +11:00
Andrew Tridgell 0a72c2bbd5 AP_Baro: prevent bad ground pressure from making a board unbootable 2016-02-23 16:34:06 +11:00
Lucas De Marchi f1ade970a3 AP_Baro: MS5611: Use AP_HAL::Device abstraction
This allows to share almost all the I2C/SPI code and remove the
AP_Serial abstraction since that is now handled by AP_HAL itself.
2016-02-16 19:49:09 -02:00
Lucas De Marchi b05954660a AP_Baro: BMP085: use I2CDevice interface 2016-02-16 19:49:09 -02:00
Tom Pittenger f435c5ee50 AP_Baro: tolerate GND_ALT_OFFSET step inputs
large inputs make the EKF angry, this will allow the param update to slew over a few seconds
2016-02-08 21:13:58 -08:00
Lucas De Marchi 56e4de0bdd AP_Baro: MS56XX: remove initialization to 0 from constructor 2016-02-01 14:18:50 -02:00
Lucas De Marchi 9d5fb97819 Global: rename enum SPIDevice to SPIDeviceType
Free the SPIDevice name so to have a consistent name for I2C/SPI device
classes.
2016-02-01 14:18:50 -02:00
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Julien BERAUD d15097f3fc AP_Baro_MS5611: Support for timesliced timers
fallback if current scheduler doesn't support it
2016-01-18 16:57:48 -02:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
Jonathan Challinger dcfc95fadf AP_Baro: fix example build 2015-12-29 10:46:35 -08:00
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Andrew Tridgell ff44a63007 AP_Baro: added QURT driver 2015-12-27 16:21:25 +11:00
Andrew Tridgell 1f4e503d91 AP_Baro: added qflight driver 2015-12-27 16:12:27 +11:00
Andrew Tridgell ef83f39029 AP_Baro: renamed _C* vars to avoid conflict with qurt 2015-12-20 17:55:39 +11:00
Lucas De Marchi 5b1769cd2b AP_Baro: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:42 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Lucas De Marchi 8eee888b3e AP_Baro: BMP085: move data-ready macro to a method 2015-12-02 10:40:50 +11:00
Lucas De Marchi c5e97129c1 AP_Baro: BMP085: follow coding style
- Spacing changes and variable renames to follow coding style
 - No need to initialize variables to 0, it's already done by our
   global new operator.
2015-12-02 10:40:50 +11:00
Lucas De Marchi 81a298c9c8 AP_Baro: reduce header scope
We don't need to expose to other libraries how each backend is
implemented. AP_Baro.h is the main header, included by other libraries.

Instead of including each backend in the main header, move them to where
they are needed. Additionally standardize the order and how we include
the headers.

The advantages are:
	- Internals of each backend is not exposed outside of the
	  library
	- Faster incremental builds since we don't need to recompile
	  whoever includes AP_Baro.h because a backend changed
2015-12-02 10:40:50 +11:00
Lucas De Marchi 30f631de8f AP_Baro: MS5637: fix CRC check
The configuration of MS5637 is different from MS5611 in 2 ways:

    - The PROM is of 112 bytes rather than 128
    - The CRC is located in the first MSB of the first word, not the
      last one

For CRC calculation we also need to zero out the last (missing) word.

This renames _check_crc() to _read_prom(), which returns false when the
PROM doesn't contain valid data. It also makes it virtual so MS5637 can
override it. This also moves the PROM read to be all in the same place
rather than split between the CRC field and coefficient fields. Finally
calculate_crc() is renamed to crc4() to be shorter and add info on what
it does.
2015-12-02 10:38:09 +11:00
José Roberto de Souza 7457588d7c AP_Baro: Move initialisation code from MS56XX constructor to init()
On MS5637 we will need to override the method to read and calculate the
PROM's crc. Thus we need a 2-phase init.

It also makes the constructor of AP_Baro_MS56XX protected since only the
derived classes should instantiate the base one.
2015-12-02 10:38:09 +11:00
José Roberto de Souza 29791c9cec AP_Baro: Make _check_crc more readable 2015-12-02 10:38:09 +11:00
Caio Marcelo de Oliveira Filho 8cce3067f4 AP_Baro: examples use millis/micros/panic functions 2015-11-20 12:29:38 +09:00
Caio Marcelo de Oliveira Filho 5a280838f8 AP_Baro: use millis/micros/panic functions 2015-11-20 12:29:31 +09:00
Lucas De Marchi 977f6aaf15 AP_Baro: MS5611: remove empty statement 2015-11-11 13:48:48 +11:00
Lucas De Marchi 94d01934f7 AP_Baro: MS5611: reduce OSR to 1024
This is the same change as done in PX4:

	This reduces self-heating of the sensor which reduces the amount
	of altitude change when warming up. Apparently some individual
	sensors are severely affected by this.

	Unfortunately it raises the noise level, but Paul is confident
	it won't be a significant issue.
2015-11-11 13:48:48 +11:00
Andrew Tridgell 840c9e65bb AP_Baro: don't notify the GCS of new pressure reference too often 2015-11-09 14:34:07 +11:00
Peter Barker 1b13315092 AP_Baro: notify GCS of calibration 2015-11-09 09:23:20 +11:00
Lucas De Marchi 8eef58a8c2 AP_Baro: remove check for AVR CPUs
Remove the checks for HAL_CPU_CLASS > HAL_CPU_CLASS_16 and
HAL_CPU_CLASS >= HAL_CPU_CLASS_75. Corresponding dead code will be
removed on separate commits.
2015-11-04 12:14:14 +11:00
Lucas De Marchi 4bd8b2ae35 AP_Baro: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:11 +11:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Lucas De Marchi 386547427d AP_Baro: support MS5611 on second i2c bus 2015-10-22 12:04:52 +11:00
wsilva32 da9118fbd0 AP_Baro: average SITL baro measurements using update() 2015-10-21 10:25:08 +11:00
Lucas De Marchi 4d3229daa2 AP_Baro: remove check for HAL_CPU_CLASS
We don't support HAL_CPU_CLASS <= HAL_CPU_CLASS_16 anymore. This makes
BARO_MAX_INSTANCES and BARO_MAX_DRIVERS constant for all supported
boards.
2015-10-21 10:05:18 +11:00
Caio Marcelo de Oliveira Filho 24178c3e10 AP_Baro: remove unnecessary includes in example 2015-10-21 09:16:10 +11:00