Commit Graph

304 Commits

Author SHA1 Message Date
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Andy Little 0d113b265c Examples: fix examples for px4
The change to use AP_BoardConfig messed up the examples. Here are some
updated but there are plenty more to do.
2016-10-04 12:50:47 -03:00
Lucas De Marchi e217faacab AP_Baro: MS56XX: cosmetic changes to members
- reorder and document members.
    - remove tentative of vertical alignement
    - like was done for accumulated values, move the calibration
      values to a struct
2016-07-30 00:55:28 -03:00
Lucas De Marchi f7b453359d AP_Baro: MS56XX: convert to threaded bus
This converts MS56XX to use the thread started by SPI/I2C instead of
using the timer thread. This also fixes a possible starvation of the
main thread:

    1) INS driver registers itself to be sampled on timer thread
    2) MS56XX registers itself to be sampled on timer thread
    3) Main thread waits for a sample from INS with
       ins.wait_for_sample()
    4) timer thread is waiting on update from MS56XX and consequently
       the main thread is waiting on an I2C/SPI transfer

Besides this starvation there's another one due to reuse of the timer
lock in order to pump values from the timer thread to the main thread. A
call to the update() method when we have a sample available would need
to wait on any other driver holding the timer lock.

Now there's a lock just to pass the new values from the bus thread to
the main thread with a very tiny critical region, not waiting on any
bus transfers and/or syscalls.
2016-07-30 00:55:28 -03:00
Lucas De Marchi 929348ff75 AP_Baro: MS5611: always use timer thread
Remove support to run MS5611 on main thread since we shouldn't be doing
I2C transactions there and we are moving to "thread per bus"
nonetheless.
2016-07-30 00:55:28 -03: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 8d2872d3ab AP_Baro: coverity scan - variables not initialized in constructor 2016-07-05 13:32:06 -07:00
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