Commit Graph

793 Commits

Author SHA1 Message Date
José Roberto de Souza d1ff4286c2 AP_InertialSensor: Make detect_backends() public
This method will be used to initialize and configure I2C backends that
have an auxiliary I2C bus that can be connected to the main I2C bus,
like MPU6000 and MPU9250.
2015-11-11 14:29:07 +11:00
José Roberto de Souza 0cbe99a862 AP_InertialSensor: MPU9250 I2C: Connect the auxiliary I2C bus to the main bus
Using MPU9250 over I2C we can connect the auxiliary bus where there is
a AK8963 and connect this bus to the main one, this way we don't need
any AuxiliaryBus infrastructure as we need with SPI and we can talk
with AK8963 as we would talk with a standalone AK8963.
2015-11-11 14:29:07 +11:00
José Roberto de Souza b3322ed1ae AP_InertialSensor: Add MPU9250 over I2C to detect_backends() 2015-11-11 14:29:07 +11:00
José Roberto de Souza 607ab5b005 AP_InertialSensor: MPU9250: Add I2C support 2015-11-11 14:29:07 +11:00
José Roberto de Souza c3dae6fcec AP_InertialSensor: MPU9250: Remove methods not used anymore
Those methods were used by AK8963 before it started to use auxiliary bus.
2015-11-11 14:29:06 +11:00
José Roberto de Souza 588df53429 AP_InertialSensor: Add support to get auxiliary bus of multiple instances of the same sensor 2015-11-11 14:29:06 +11:00
José Roberto de Souza 3e1b974fd2 AP_InertialSensor: MPU9250: Export auxiliary bus 2015-11-11 14:29:06 +11:00
José Roberto de Souza 206f0fb773 AP_InertialSensor: MPU9250: Add BusDriver abstraction
This adds a similar abstraction to the one in MPU60XX so it's possible to use
MPU9250 in other bus. The I2C implementation will come later.
2015-11-11 14:29:06 +11:00
Víctor Mayoral Vilches 30faf7e92a AP_InertialSensor: Add Erle-Brain 2 support 2015-11-04 13:58:24 +11:00
Lucas De Marchi 3142f21363 AP_InertialSensor: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:12 +11:00
Gustavo Jose de Sousa 8e351a058d AP_InertialSensor: MPU6000: enable data-ready pin for minlure
Data-ready pin wasn't being used before due to a bug in the Kernel with
concurrent accesses to GPIO in Intel Baytrail platforms. That has been fixed in
Kernel version 4.2.
2015-11-04 12:12:47 +11:00
Lucas De Marchi 3d1d6286e9 AP_InertialSensor: fix example build after PSTR removal 2015-11-04 12:11:59 +11:00
Lucas De Marchi 62ba8266ef AP_InertialSensor: fix wrong printf format for printf
"%S" is used for wide string, but we are passing a char*. Use lowercase
in this case to remove warnings like this:

libraries/AP_InertialSensor/AP_InertialSensor.cpp: In member function
'bool AP_InertialSensor::calibrate_accel(AP_InertialSensor_UserInteract*, float&, float&)':
libraries/AP_InertialSensor/AP_InertialSensor.cpp:620:61: warning:
format '%S' expects argument of type 'wchar_t*', but argument 3 has type 'const char*' [-Wformat=]
                 "Place vehicle %S and press any key.\n", msg);
                                                             ^
2015-10-30 14:35:40 +09:00
Lucas De Marchi 5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +09:00
Lucas De Marchi 1b07dabeb7 Replace prog_char and prog_char_t with char
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.

AVR-specific places were not changed.
2015-10-30 14:35:30 +09:00
Lucas De Marchi 132303db4b AP_InertialSensor: use printf() rather than _printf_P() 2015-10-30 14:35:27 +09:00
Lucas De Marchi 20c6ffc5e3 Replace use of UARTDriver::printf_P() with UARTDriver::printf()
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi 7ceffb1e2b Replace use of vprintf_P() with vprintf() 2015-10-30 14:35:23 +09:00
Lucas De Marchi 6f4904189b Replace use of println_P() with println() 2015-10-30 14:35:22 +09:00
Lucas De Marchi a964ac38ec Replace use of print_P() with print() 2015-10-30 14:35:21 +09: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 84d5fb006f Remove use of Util::{v,}snprintf_P()
These are now the same function as Util::snprintf().
2015-10-30 14:35:05 +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
Andrew Tridgell 142aa59bce AP_InertialSensor: fixed vibration logging after recent changes 2015-10-26 07:26:17 +11:00
Gustavo Jose de Sousa be8070e335 AP_InertialSensor: MPU9250: publish gyro raw sample rate
So that delta angle calculation is enabled.
2015-10-22 16:53:12 +11:00
Gustavo Jose de Sousa 887f81274d AP_InertialSensor: MPU6000: publish gyro raw sample rate
So that delta angle calculation is enabled.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 31a49d318c AP_InertialSensor: PX4: publish gyro raw sample rate
That enables delta angle calculation.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 25a499a41f AP_InertialSensor: use raw sample rate terminology
In order to avoid confusion between sample rate from sensor and sample rate
from the frontend class (AP_InertialSensor), use "raw sample rate" to refer to
the former.

The changes in the code were basically done with the following commands:

git grep -wl _accel_sample_rates | xargs sed -i "s,\<_accel_sample_rates\>,_accel_raw_sample_rates,g"
git grep -wl _set_accel_sample_rate | xargs sed -i "s,\<_set_accel_sample_rate\>,_set_accel_raw_sample_rate,g"
git grep -wl _accel_sample_rate | xargs sed -i "s,\<_accel_sample_rate\>,_accel_raw_sample_rate,g"

git grep -wl _gyro_sample_rates | xargs sed -i "s,\<_gyro_sample_rates\>,_gyro_raw_sample_rates,g"
git grep -wl _set_gyro_sample_rate | xargs sed -i "s,\<_set_gyro_sample_rate\>,_set_gyro_raw_sample_rate,g"
git grep -wl _gyro_sample_rate | xargs sed -i "s,\<_gyro_sample_rate\>,_gyro_raw_sample_rate,g"

And also with minor changes on indentation and comments.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 6feea5f64f AP_InertialSensor: Backend: remove function _publish_delta_angle()
Delta angle calculation is now unified, so there is no need for such a method.
That also avoids developers thinking they need that method being called
somewhere in their new drivers.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 7fef515555 AP_InertialSensor: unify delta angle calculation
This commit basically moves delta angle calculation that was previously done in
AP_InertialSensor_PX4 to a common place. Instances must publish their gyro raw
sample rate to enable delta angle calculation.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 4e83f7b02c AP_InertialSensor: PX4: don't calculate delta angle
Delta angle calculation will be unified.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa 9e05041234 AP_InertialSensor: allow publishing gyro raw sample rate to frontend
That information will be used for a unified delta angle calculation.
2015-10-22 16:53:11 +11:00
Gustavo Jose de Sousa dfd671c54e AP_InertialSensor: Backend: add hook for new gyro sample arrival
That hook will do common tasks for when new gyro raw sample is available.
2015-10-22 16:53:10 +11:00
Gustavo Jose de Sousa a3e2c82491 AP_InertialSensor: Backend: remove function _publish_delta_velocity()
The delta velocity calculation is now unified, so there is no need for such a
method. That also avoids delevopers thinking they need that method being called
somewhere in their new drivers.
2015-10-22 16:53:10 +11:00
Gustavo Jose de Sousa 75fdac648f AP_InertialSensor: unify delta velocity calculation
This commit basically moves delta velocity calculation that was previously done
in AP_InertialSensor_PX4 to a common place. Instances must publish their accel
raw sample rate to enable delta velocity calculation.
2015-10-22 16:53:10 +11:00
Gustavo Jose de Sousa f769a39449 AP_InertialSensor: PX4: don't calculate delta velocity
Delta velocity calculation will be unified.
2015-10-22 16:31:07 +11:00
Lucas De Marchi ed36ae9ef7 AP_InertialSensor: MPU6000: add rotation for minlure 2015-10-22 12:04:52 +11:00
Lucas De Marchi 30a50b362f AP_InertialSensor: remove check for vibe check
For all supported boards we have vibration check.
2015-10-21 10:05:17 +11:00
Lucas De Marchi db62e55753 AP_InertialSensor: remove check for max INS instances
For all supported boards the maximum number of instances is 3.
2015-10-21 10:05:17 +11:00
Lucas De Marchi a147b97d2b AP_InertialSensor: remove check for HAL_CPU_CLASS
We don't support HAL_CPU_CLASS <= HAL_CPU_CLASS_16 anymore. This makes
INS_MAX_INSTANCES, INS_MAX_BACKENDS and INS_VIBRATION_CHECK constant for
all supported boards.
2015-10-21 10:05:17 +11:00
Lucas De Marchi 4480956c68 AP_InertialSensor: MPU6000: remove dead code for !FAST_SAMPLING
The code with ifdef for !FAST_SAMPLING is bit rotting and the example
for AP_InertialSensor is currently broken for this case. Instead of
adding more ifdefs, remove the legacy implementation for !FAST_SAMPLING
since we don't support it anymore.

Reported by Grant:

	/home/grant/3dr/ardupilot/libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp:
	In member function 'void AP_InertialSensor_MPU6000::_accumulate(uint8_t*,
	uint8_t)':
	/home/grant/3dr/ardupilot/libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp:776:20:
	error: no match for 'operator+=' (operand types are 'Vector3l {aka
	Vector3<long int>}' and 'Vector3f {aka Vector3<float>}')
		 _accel_sum += accel;

	/home/grant/3dr/ardupilot/libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp:777:19:
	error: no match for 'operator+=' (operand types are 'Vector3l {aka
	Vector3<long int>}' and 'Vector3f {aka Vector3<float>}')
		 _gyro_sum += gyro;
2015-10-21 10:05:17 +11:00
Caio Marcelo de Oliveira Filho 191cff2035 AP_InertialSensor: remove unnecessary includes from examples 2015-10-21 09:16:11 +11:00
Caio Marcelo de Oliveira Filho ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
Jonathan Challinger 3b480bd6ec AP_InertialSensor: fix order of accelerometer corrections 2015-10-21 08:22:36 +11:00
Randy Mackay b751d2bb18 InertialSensor: remove gyro cal on first arming 2015-10-19 12:00:38 +09:00
José Roberto de Souza 30610fb17d AP_InertialSensor: Remove misspelled and unused method 2015-10-16 10:16:24 +11:00
José Roberto de Souza daa32725ac AP_InertialSensor: Fix typo: auxiliar to auxiliary 2015-10-16 10:16:24 +11:00
Julien BERAUD b37c52f7a3 AP_InertialSensor_MPU6000: Add heat support
Send current tempertaure to the Heater so the control loop sets the correct
temperature to the imu
2015-10-06 15:21:39 +11:00
Julien BERAUD 1aadcdf538 AP_InertialSensor_MPU6000: read temperature
Read temperature as part of the normal burst. This is not very costly since it
is part of the burst read in i2c and already read in spi.
It is meant to be used for imu heating.
The filter is set to 1Hz on temperature because of the inherent inertia of
heating systems.
2015-10-06 15:21:39 +11:00
Lucas De Marchi d3e8e8fd43 AP_InertialSensor: disable backend's copy constructor
We never want to copy a backend. This protects us of accidentally using
a copy instead of a reference for all subclasses.
2015-10-01 20:57:22 -03:00
Lucas De Marchi a58bb0fc32 AP_InertialSensor: MPU6000: Fix using copy instead of reference
In 294298e ("AP_InertialSensor: use method for downcast") I was too eager
to use "auto" and ended up using the implicit copy constructor instead
of actually getting a reference to the object.
2015-10-01 20:57:22 -03:00
mirkix 840f583d23 AP_InertialSensor: Add MPU9250 multiple instance support 2015-09-24 13:11:38 +10:00
Lucas De Marchi 294298ea34 AP_InertialSensor: use method for downcast
Instead of just doing a static cast to the desired class, use a method
named "from". Pros:

  - When we have data shared on the parent class, the code is cleaner in
    child class when it needs to access this data. Almost all the data
    we use in AP_HAL benefits from this

  - There's a minimal type checking because now we are using a method
    that can only receive the type of the parent class
2015-09-23 09:01:29 +10:00
Randy Mackay ada26082ca InertialSensor: remove INS start style from example sketch 2015-09-21 17:06:20 +09:00
Randy Mackay ec82aa68c4 InertialSensor: add GYR_CAL to control when gyro calibration occurs 2015-09-21 17:06:16 +09:00
raspilot 1421cf600a AP_InertialSensor: added support for raspilot 2015-09-14 14:22:15 +10:00
Víctor Mayoral Vilches 6d762f62b3 AP_InertialSensor: ERLEBOARD legacy support
This config referred to the legacy Erle-Board
https://erlerobotics.com/blog/product/erle-board/
The configuration is preserved to support the
existing boards.
2015-09-09 10:31:55 +10:00
Gustavo Jose de Sousa 305ec7b08a AP_InertialSensor: MPU6000: publish sample rate
So that vibration and clipping may be calculated.
2015-09-07 11:14:43 +10:00
Gustavo Jose de Sousa eb480e959c AP_InertialSensor: MPU9250: publish sample rate
That enables the default vibration calculation.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa a76eb9c15f AP_InertialSensor: MPU9250: use macros for sample rate
Instead of hardcoded values.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa a0b1337646 AP_InertialSensor: PX4: publish sample rate
By publishing the sample rate, the vibration and clipping are magically
calculated.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa 77a4f10d89 AP_InertialSensor: PX4: don't call calc_vibration_and_clipping()
That calculation will be unified.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa 6aa973dd47 AP_InertialSensor: Backend: calculate vibration and clipping on new raw sample
This is a good way of letting each implementation easily calculate vibration
and clipping: all they need to do is publish their sample rate and they don't
need to worry about the call for calculation.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa e06627dfcb AP_InertialSensor: Backend: add hook for new raw accel samples
That hook will eventually do necessary things when a new accelerometer raw
sample arrives (like calculating vibration levels).
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa 5329e63742 AP_InertialSensor: allow publishing sample rate to frontend
That information will be used for a "centralized" vibration calculation.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa ac3a677626 AP_InertialSensor: remove param rotate_and_correct from publish functions
Once that parameter is always false.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa a56c8deaee AP_InertialSensor: Oilpan: apply correction on each new sample
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.

Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa fc38691e0b AP_InertialSensor: MPU9250: apply correction on each new sample
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.

Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa b844b220c3 AP_InertialSensor: MPU9150: apply correction on each new sample
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.

Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa 487135afa2 AP_InertialSensor: MPU6000: apply correction on each new sample
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.

Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:42 +10:00
Gustavo Jose de Sousa f946f48dce AP_InertialSensor: LSM9DS0: apply correction on each new sample
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.

Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:41 +10:00
Gustavo Jose de Sousa 0963159bb8 AP_InertialSensor: Flymaple: apply correction on each new sample
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.

Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:41 +10:00
Gustavo Jose de Sousa 2ea8f1de3f AP_InertialSensor: L3G4200D: apply correction on each new sample
These changes are for enabling unified accelerometer vibration and clipping
calculation. For that, we need the values "rotated and corrected" before they
are filtered and the calculation must be called as soon as a new sample arrives
as it takes the sample rate into account.

Thus, move code that applies "corrections" to be executed as soon as accel data
arrive and call _publish_accel() passing rotate_and_correct parameter as false.
Also, do the same for gyro so we can keep it consistent.
2015-09-07 11:14:41 +10:00
Lucas De Marchi a66a201bf5 AP_Compass: HMC5843: Add support for MPU6000 auxiliary bus
Allow HMC5843 to be on MPU6000's auxiliary bus.
2015-08-28 12:39:09 +10:00
Lucas De Marchi c66800dfec AP_InertialSensor: add singleton interface
In order to allow other libraries to use the InertialSensor we need a
way to let them to get the only instance of InertialSensor. The
conventional way to do a singleton would be to let the constructor
private and force it to be instantiated from the get_instance() method.

Here however we just call panic() on the constructor if there's already
an instance alive. This allows us to let the vehicles as is. Later we
can change it so they call the get_instance() method instead.
2015-08-28 12:39:08 +10:00
Lucas De Marchi 565c18603d AP_InertialSensor: MPU6000: export auxiliary bus 2015-08-28 12:39:08 +10:00
Lucas De Marchi caae933c28 AP_InertialSensor: Add support for auxiliary buses
Add an AuxiliaryBus class that can be derived for specific
implementations in inertial sensor backends. It's an abstract
implementation so other libraries can use the auxiliary bus exported. In
order for this to succeed the backend implementation must split the
initialization of the sensor from the actual sample collecting, like is
done in MPU6000.

When AP_InertialSensor::get_auxiliary_bus() is called it will execute
following steps:
	a) Force the backends to be detected if it's the first time it's
	   being called
	b) Find the backend identified by the id
	c) call get_auxiliary_bus() on the backend so other libraries can
	   that AuxiliaryBus to initialize a slave device

Slave devices can be used by calling AuxiliaryBus::request_next_slave()
and are owned by the caller until AuxiliaryBus::register_periodic_read()
is called. From that time on the AuxiliaryBus object takes its ownership.
This way it's possible to do the necessary cleanup later without
introducing refcounts, that we don't have support to.

Between these 2 functions the caller can configure the slave device by
doing its specific initializations by calling the passthrough_*
functions. After the initial configuration and register_periodic_read()
is called only read() can be called.
2015-08-28 12:39:08 +10:00
Lucas De Marchi 3cb6f391d4 AP_InertialSensor: MPU6000: split detection and initialization 2015-08-28 12:39:08 +10:00
Lucas De Marchi 7d9579c5d8 AP_InertialSensor: identify backend with ID
Identify backend with an id, allowing other libraries to connect to
them. This is different from the _product_id member because it
identifies the sensor, not the board the sensor is in, which is
meaningless for our use case.
2015-08-28 12:39:07 +10:00
Lucas De Marchi 22c787058e AP_InertialSensor: allow to split detection and initialization
This allows backends to have a separate detection and initialization
logic. It doesn't change any backend yet and with the current code
there's no change in behavior either. This only allows
AP_InertialSensor::_detect_backend() to be called earlier so
AP_InertialSensor object can be used by other libraries. If it's not
called, later on AP_InertialSensor::init() will detect and start all
backends.
2015-08-28 12:39:07 +10:00
Lucas De Marchi f7954ee885 AP_InertialSensor: MPU6000: allow to read generic block
We were able to read only the block of registers that are part of the
data output from accelerometer/gyroscope. In order to support reading
the external sensors we need support for reading a generic block of
registers.
2015-08-28 12:39:07 +10:00
Lucas De Marchi b5da8ad61f AP_InertialSensor: MPU6000: rename method
We're reading the sensor data available in MPU6000 so name the method
accordingly, which is also the same name used in MPU9250.
2015-08-28 12:39:07 +10:00
Lucas De Marchi d9a4d3e777 AP_InertialSensor: MPU6000: fix leaking samples 2015-08-28 12:39:07 +10:00
Lucas De Marchi f18dd17377 AP_InertialSensor: fix typos
resister->register and fix copy and paste error from MPU6000 to MPU925.
2015-08-28 12:39:07 +10:00
squilter dfc35cca8b AP_InertialSensor: update severities 2015-08-28 10:04:35 +10:00
ziltoid2 0b1a997800 AP_IntertialSensor: don't require acceleration calibration in hil mode 2015-08-23 16:48:48 +10:00
Tom Pittenger 2620a57700 AP_InertialSensor: Added is_still() check
very strict check that all axis are not vibrating much at all
new param: INS_STILL_THRESH used to be a vibration threshold for different platforms
// @Description: Threshold to tolerate vibration to determine if vehicle is motionless. This depends on the frame type and if there is a constant vibration due to motors before launch or after landing. Total motionless is about 0.05. Suggested values: Planes/rover use 0.1, multirotors use 1, tradHeli uses 5
2015-08-23 10:34:17 +10:00
Tom Pittenger 220163e269 AP_InertialSensor: correct USE param storage index
USE, USE2, USE3 have 20, 21, 21 but should be 20, 21, 22
2015-08-21 11:35:37 +09:00
Randy Mackay e5615ec349 INS: add USE parameters 2015-08-19 16:44:15 +09:00
Randy Mackay affbd67c43 InertialSensor: add vibration monitoring of 2nd IMU 2015-08-19 16:44:12 +09:00
Lucas De Marchi 2c44f3e313 AP_HAL_InertialSensor: standardize inclusion of libaries headers
Do the missing header changes due to changing the code before the pr
getting accepted.
2015-08-18 17:12:52 +10:00
Andrew Tridgell dc455a5fd6 AP_InertialSensor: setup for MPU9250 support on PX4 2015-08-17 09:33:15 +10:00
Andrew Tridgell 980659d346 AP_InertialSensor: removed AVR1280 specific ifdef 2015-08-11 16:47:56 +10:00
Gustavo Jose de Sousa 7789aec85b AP_InertialSensor: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:43 +10:00
Randy Mackay 69bfeaf58e INS: accel offset parameter range desc to 3.5m/s/s 2015-08-10 10:30:34 -07:00
Lucas De Marchi cf1273668e AP_InertialSensor: refactor constructors to avoid leak
We were previously leaking the AP_MPU6000_BusDriver if the
~AP_InertialSensor_MPU6000::detect*() failed. In order to avoid the
leak move the repeated code in a single private _detect() member that
receives everything as argument. Then this method takes ownership of the
objects.

By a adding a destructor to AP_InertialSensor_MPU6000 it becomes easier to
free the objects it takes ownership of.
2015-08-08 14:12:22 +10:00
Lucas De Marchi c3063f0ab2 AP_InertialSensor: MPU6000: be agnostic to I2C bus/address
This decision is better made by the caller rather than polluting the
driver with board-specific details.
2015-08-08 14:12:22 +10:00
Lucas De Marchi 4d4dac867e AP_InertialSensor: pass backend instead of pointer to function
Different detect() function might need different arguments and passing a
pointer to function here is cumbersome. For example, it forces to have a
method like "detect_i2c2" rather than allowing hal.i2c2 to be passed as
parameter.
2015-08-08 14:12:22 +10:00
Gustavo Jose de Sousa d3eebdb6aa AP_InertialSensor: L3G4200D: add probe code
This driver works properly but had the initialization logic missing. Add
the support to probe it.
2015-08-08 14:12:22 +10:00
Lucas De Marchi 55279664c2 AP_InertialSensor: remove out of place ifdef
AP_InertialSensor isn't a good place to comment about board issues.
2015-08-08 14:12:21 +10:00
Lucas De Marchi 2e76d998df AP_InertialSensor: remove unused enum bus_speed
The methods actually use the enum from AP_HAL::SPIDeviceDriver, so don't
declare a new one. The I2C implementation is empty; if we actually start
to use it we'd better move the bus abstraction to HAL.
2015-08-08 14:12:21 +10:00
Lucas De Marchi f3f54157be AP_InertialSensor: fix copying wrong number of bytes
We should copy only the bytes we read, not the maximum number.
2015-08-08 14:12:21 +10:00
Lucas De Marchi 209e1924a5 AP_InertialSensor: fix whitespace usage 2015-08-08 14:12:21 +10:00
Lucas De Marchi 3851862f60 AP_InertialSensor: remove unused drivers
Nobody is using these drivers, they need to be rewritten using the
backend logic and give the false impression they are supported.
2015-08-07 20:57:49 +10:00
Andrew Tridgell 212898d02b AP_InertialSensor: don't use INT_STATUS drdy to lower SPI bus speed
as pointed out by Lucas in PR#2604 this is probably a bad idea
2015-07-30 14:05:20 +10:00
Grant Morphett e2eda97ec6 AP_InertialSensor: fix coverity warnings - param init in construct 2015-07-30 12:37:08 +10:00
Tom Pittenger 01161135d6 AP_InitialSensor_MPU6000: compiler warning - init order 2015-07-27 10:30:17 +09:00
Lucas De Marchi eda4879f3f AP_InertialSensor: use ARRAY_SIZE macro 2015-07-21 14:25:07 +09:00
Andrew Tridgell 6df33dd3f4 AP_InertialSensor: fixed MPU6000_SPI bus initialisation
we need _spi for get_semaphore()
2015-07-10 16:46:30 +10:00
Julien BERAUD 3cf952d1f8 AP_InertialSensor: add fifo support for MPU6000
And remove the use of data rdy in this case
2015-07-10 14:24:09 +10:00
Julien BERAUD 8a76ff53bd AP_InertialSensor: add i2c bus driver for MPU6050 2015-07-10 14:24:09 +10:00
Julien BERAUD 1679728730 AP_InertialSensor: Configure SPI as a generic bus for MPU6000
Add the possibility to implement an i2c bus communication for the
MPU6050 on parrot bebop
2015-07-10 14:24:09 +10:00
Lucas De Marchi efec7723ff AP_InertialSensor: reset the MPU9250 chip on startup
Now that the initialization of MPU9250 is shared between the
AP_InertialSensor and other drivers using it as a backend, we can reset
the MPU9250 in order to put it in a known state.
2015-07-06 10:48:07 +10:00
Lucas De Marchi eb4e2ac2e5 AP_InertialSensor: factor out MPU9250 initialization
Now we have the initialization code split in 2 parts:

1) Making sure the MPU9250 chip is alive and working: this is now in a
static function that may be called by other drivers that use MPU9250 as
backend.

2) The configuration of gyro and accel. Once the first part is completed
successfully the AP_InertialSensor_MPU9250 finishes the configuration of
the sensors it uses.

The only change in behavior here is that before we would try 25 time (5x
inside _hardware_init time 5x inside _init_sensor() that calls the first
function) to "boot the chip" and now we are doing "only" 5.
2015-07-06 10:48:07 +10:00
Lucas De Marchi 953bfbd3fe AP_InertialSensor: provide static methods for spi transactions
Add static methods to do the SPI transactions and provide the wrapper
methods when we have an instance of the object. This is useful so these
methods can be called from other contexts when the AP_InertialSensor
hasn't been initialized yet.
2015-07-06 10:48:07 +10:00
mirkix f82344358f AP_InertialSensor: Change BBBMINI standard orientation 2015-07-06 10:12:39 +10:00
Staroselskii Georgii d40b45c9ae AP_InertialSensor: disable reset on MPU9250
The Compass library is initialized before the InertialSensor. AK8963 with
MPU9250 as backend already takes care of resetting MPU9250. The problem with
also resetting it in the MPU9250 initialization code is that if the reset
happens during an internal I2C transaction, the AK8963 may hang. So here we
remove the reset inside MPU9250. There still a possibility that the first
MPU9250 initialization is not successful and it resets the chip, but it's not
happening in tests.
2015-07-01 20:44:09 +03:00
Andrew Tridgell ac3200fd32 AP_InertialSensor: make max_abs_offsets a single float, not a vector 2015-06-30 10:51:43 +10:00
Gustavo Jose de Sousa 0fcd98c804 AP_InertialSensor: disable debug on LSM9DS0 2015-06-30 10:28:05 +10:00
Gustavo Jose de Sousa c168e19e73 AP_InertialSensor: fix coding style with uncrustify on LSM9DS0
This commit makes backend source code for LSM9DS0 comply with the configuration
files "uncrustify_cpp.cfg" and "uncrustify_headers.cfg".
2015-06-30 10:28:02 +10:00
Gustavo Jose de Sousa 2f2a627002 AP_InertialSensor: use runtime GPIO drdy pins numbers instead C constant macros
As we intend to eventually get board related parameters from a configuration
file, this commit makes the GPIO numbers for data-ready pins be instance
variables instead of from C constant macros.

Another advantage of using instance variables in this context is the
possibility of using more than one LSM9DS0.
2015-06-30 10:27:59 +10:00
Gustavo Jose de Sousa 0ef914adac AP_InertialSensor: don't take SPI semaphore if not necessary on LSM9DS0
If the data-ready polling is done entirely on GPIO pins, it isn't necessary to
hold the semaphore before we now we have data to consume. In that case, only
take the SPI semaphore if there's new data available.

On the other hand, if at least one SPI transaction is done in order to check
for new data, then it makes sense to take the semaphore beforehand.
2015-06-30 10:27:57 +10:00
Gustavo Jose de Sousa a82ab25ed3 AP_InertialSensor: use bitfield macros instead of literal values on LSM9DS0
This commit makes accel and gyro initialization routines use bitfield macros
instead of hardcoding the literal value when wrinting on registers. That is
less prone to typos and a lot of times self-explanatory. Also, due to the
latter, the long comments explaining each register field were removed (any
detail can be checked on the datasheet).
2015-06-30 10:27:54 +10:00
Gustavo Jose de Sousa 1572324315 AP_InertialSensor: add macros for LSM9DS0 registers' bitfields 2015-06-30 10:27:51 +10:00
Gustavo Jose de Sousa 033409c629 AP_InertialSensor: set max abs calibration offset for LSM9DS0 2015-06-30 10:27:48 +10:00
Gustavo Jose de Sousa 42eb73a1d1 AP_InertialSensor: add LSM9DS0 backend
This adds the backend driver for LSM9DS0. This implementation is based on the
legacy driver coded by Víctor Mayoral Vilches (under folder LSM9DS0) and makes
some necessary adaptations and fixes in order to work properly. The legacy
driver folder was removed.
2015-06-30 10:27:46 +10:00
Gustavo Jose de Sousa c340e072f2 AP_InertialSensor: use accel instance max abs offset instead of a constant value
The calibration on LSM9DS0 was giving offsets between 4.0 and 4.2 on x-axis and
around 3.6 on y-axis. It turned out that those offsets were actually right.

The maximum absolute values of calibration offset should be a sensor
characteristic rather than a constant value for all sensors.

The constant value previously used (3.5 m/s/s for all axes) is set here as a
default maximum absolute calibration offset for every instance to keep it
working.
2015-06-30 10:27:44 +10:00
Gustavo Jose de Sousa c72dc9bd45 AP_InertialSensor: make single rotation on MPU9250
The previous implementation made some boards apply two rotations to suit
their default orientation. That was happening because there was an
unconditional rotation being done (commented as "rotate for bbone
default").

This commit makes that unconditional rotation as a default rotation
instead and adjusts the former additional rotations to be single
rotations.
2015-06-22 17:45:20 +10:00
Gustavo Jose de Sousa 3dad768e8b AP_InertialSensor: log failure to initialize after max attempts on MPU9250
This happens for example when you are trying to use an SPI speed that's
above the one supported by the sensor or the controller.
2015-06-22 17:45:20 +10:00
Gustavo Jose de Sousa 587471ab54 AP_InertialSensor: disable I2C on MPU9250
As the datasheet says: "To prevent switching into I2C mode when using
SPI, the I2C interface should be disabled by setting the I2C_IF_DIS
configuration bit."

We also reset the sensor like PX4Firmware does for initializing the
MPU6000.  See: ee1d8cd770/src/drivers/mpu6000/mpu6000.cpp (L695)
2015-06-22 17:45:20 +10:00
Andrew Tridgell 4eab27abe9 AP_InertialSensor: fixed logic bug in MPU6000 init
thanks to coverity
2015-06-20 14:53:04 +10:00
mirkix 588a16dec2 AP_InertialSensor: Add Linux support for VibTest example 2015-06-18 08:48:23 +10:00
Andrew Tridgell 4fe092fead AP_InertialSensor: panic on bad gyro or accel sample rates 2015-06-17 15:01:23 +10:00
Andrew Tridgell d3b85eb792 AP_InertialSensor: use driver supplied sample rate
this will work with a wider range of sensors
2015-06-17 14:44:19 +10:00
Andrew Tridgell e91bfdfc1c AP_InertialSensor: fixed VibTest example build 2015-06-17 14:15:58 +10:00
Andrew Tridgell bc0ae630a1 AP_InertialSensor: always provide delta_velocity and delta_angles
this makes the NavEKF code simpler
2015-06-17 13:10:26 +10:00
Andrew Tridgell f831c16238 AP_InertialSensor: use fixed sensor sample times
this uses fixed sample times for PX4 IMUs, rather than reported
timestamps. It avoids timing jitter caused by the over-sampling in
the PX4 drivers
2015-06-17 13:03:56 +10:00
Randy Mackay 9d81856580 InertialSensor: fix name of get_delta_velocity method 2015-06-17 12:46:54 +10:00
Andrew Tridgell 727be87d84 AP_InertialSensor: support HIL functions for delta_velocity and delta_angles 2015-06-16 09:53:55 +10:00
Randy Mackay 8ceccd778d InertialSensor: disable vibration checks on APM2
Also bug fix get_accel_clip_count's instance check
2015-06-12 21:36:56 +09:00
Randy Mackay 0db7acc628 InertialSensor: calc vibration and accel clipping 2015-06-12 21:36:22 +09:00
Andrew Tridgell 214b61bfc0 AP_InertialSensor: fixed example build 2015-06-01 17:35:15 +10:00
Andrew Tridgell 7f7113c1de AP_InertialSensor: convert example from .pde to .cpp 2015-06-01 17:07:04 +10:00
Andrew Tridgell 6a2c585632 AP_InertialSensor: fixed build warnings 2015-05-30 22:51:19 +10:00
Peter Barker 8be9e99fad AP_InertialSensor_PX4: 64-bit timestamps for ACCx and GYRx messages 2015-05-27 11:54:17 +10:00
Peter Barker f489f6b696 AP_InertialSensor: use 64-bit timestamps in dataflash logs 2015-05-27 11:54:17 +10:00
Lucas De Marchi 3aa46e3213 AP_InertialSensor: use functor macros
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:53 +10:00
Andrew Tridgell aaa35bd1ec AP_InertialSensor: using atan2f() gives more accurate euler corrections
thanks to Jon and Paul!
2015-05-16 08:19:18 +10:00
Andrew Tridgell 9e723ef907 AP_InertialSensor: added calibrate_trim() function
used for redoing trim calculation
2015-05-16 07:56:34 +10:00
Andrew Tridgell b564ba0868 AP_InertialSensor: fixed AHRS_TRIM calculation again 2015-05-16 07:56:33 +10:00
Jonathan Challinger 159599879f AP_InertialSensor: simplify and correct AHRS_TRIM computation 2015-05-15 21:03:03 +10:00
Randy Mackay 3f8b832075 InertialSensor: fix example sketch 2015-05-13 10:13:51 +09:00
Randy Mackay 1f14eec4ea InertialSensor: accel_calibrated_all_ok replaces calibrated
This checks that the current number of accelerometers matches the number
of calibrated accels in order to catch accel failures at boot
2015-05-12 16:32:16 +09:00
Andrew Tridgell 8bf2baef70 AP_InertialSensor: fixed primary accel/gyro in replay 2015-05-11 11:19:11 +10:00
Andrew Tridgell afc9812d0b AP_InertialSensor: update VibTest after moving messages info DataFlash 2015-05-07 13:25:37 +10:00
Andrew Tridgell 7d90033a36 AP_InertialSensor: support raw accel and gyro dataflash logging 2015-05-07 12:08:30 +10:00
Andrew Tridgell f5140e25b0 AP_InertialSensor: updated VibTest for latest PX4 interfaces 2015-05-07 10:51:52 +10:00
Andrew Tridgell 089e63f987 AP_InertialSensor: fixed PSTR handling
must use PSTR on code compiled for AVR
2015-05-05 13:54:00 +10:00
Andrew Tridgell 31693e332e AP_InertialSensor: use non-PSTR printf
this is not built on AVR
2015-05-05 13:48:34 +10:00
Andrew Tridgell e6a8a6da07 AP_InertialSensor: revert AP_Math class change 2015-05-05 13:27:06 +10:00
Tom Pittenger 0e076d6dc8 AP_InertialSensor: compile warnings: format not a string literal, argument types not checked
PSTR() goofs things up when using hal.console->printf_P()
2015-05-05 13:27:02 +10:00
Tom Pittenger 9e98c68099 AP_InertialSensor: compile warnings: format not a string literal, argument types not checked
PSTR() goofs things up when using hal.console->printf_P()
2015-05-05 13:27:01 +10:00
Tom Pittenger 820199635b AP_InertialSensors: compiler warnings: apply is_zero(float) or is_equal(float) 2015-05-05 13:26:51 +10:00
Tom Pittenger 3cb2221315 AP_IntertialSensor: double to float warning 2015-05-05 13:26:50 +10:00
Andrew Tridgell ef527d9daa AP_InertialSensor: fix for HAL_SITL rename 2015-05-05 09:45:55 +10:00
Randy Mackay 6773c0b232 AP_InertialSensor: default primary accel and gyro 2015-05-01 16:37:33 +09:00
Jonathan Challinger bb88a4f8fe AP_InertialSensor: healthy() checks bounds 2015-05-01 16:37:15 +09:00
Jonathan Challinger af80f20a51 AP_InertialSensor: add get_primary_gyro, fix get_primary_accel 2015-05-01 16:37:14 +09:00
Andrew Tridgell 007b01533d AP_InertialSensor: switched to 16g accel range for MPU9250
this matches the Pixhawk, and makes us less prone to vibration. We
have seen clipping at 8g
2015-04-28 15:30:29 +10:00
Tom Pittenger a4b8575432 InertialSensor: fix compile warnings re float constants 2015-04-24 14:03:49 +09:00
mirkix 13ee34c58a AP_InertialSensor: MPU9150 fix compiler warnings 2015-04-14 11:14:48 +10:00
Lucas De Marchi b292873304 AP_InertialSensor: fix starvation in L3G4200D
The main thread would always be blocked on the semaphore to read the
data from accelerometer and gyroscope. Especially if we have a slow
update of these values in _accumulate() due to the I2C transfer function
taking too much time: the timer thread would never give up the CPU,
causing starvation on the main thread.

This fixes the issue by reducing the critical region using a flip-buffer
so _accumulate() can work on its own copy of the data. Now that the
critical region is smaller, also avoid the semaphore and use a spinlock
instead.
2015-04-14 10:01:47 +10:00
Andrew Tridgell 45e016ea5b AP_InertialSensor: check for zero delta_velocity dt 2015-04-03 15:10:47 -07:00
Jonathan Challinger b306d7a356 AP_InertialSensor: accel cal sample for 400ms instead of 1s 2015-04-03 14:54:19 -07:00
Jonathan Challinger 1e1d8efa22 AP_InertialSensor: use expected update rate for accel cal sampling 2015-04-03 14:54:17 -07:00
Jonathan Challinger bd84328440 AP_InertialSensor: hack to "reset" the accel filter before taking a cal sample 2015-04-03 14:54:15 -07:00
Jonathan Challinger b2b42e081a AP_InertialSensor: use delta_velocity/dt for calibration if available 2015-04-03 14:54:10 -07:00
Jonathan Challinger 423160eaf8 AP_InertialSensor: publish delta_velocity_dt 2015-04-03 14:54:06 -07:00
Andrew Tridgell 4147825b87 AP_InertialSensor: fixed gyro calibration bug
we must not update _gyro_offset[] until we have completed calibration
of that gyro, or we will end up using the new offsets when asking for
the raw gyro vector
2015-04-03 06:57:30 -07:00
Andrew Tridgell 23272e4013 AP_InertialSensor: added get_temperature() interface
this will allow logging of individual temperature sensors
2015-03-17 13:32:54 +11:00
ahcorde 103bb2a08d AP_InertialSensor: Fix orientation MPU6000 PXF 2015-03-16 09:50:51 +11:00
Andrew Tridgell cf2445dc97 AP_InertialSensor: prevent nested accelerometer calibration 2015-03-15 15:22:59 +11:00
Andrew Tridgell 8a99cab535 AP_InertialSensor: load only HIL backend for hil_mode 2015-03-13 22:52:55 +11:00
Andrew Tridgell 520c7c1306 AP_InertialSensor: always allow for AK8963 on MPU9250 2015-03-13 18:46:17 +11:00
Andrew Tridgell 60b8736cf1 AP_InertialSensor: use right AK8963 compass defines 2015-03-13 18:46:15 +11:00
Andrew Tridgell 808c33d0a7 AP_InertialSensor: support both MPU9250 and MPU9255
seems to be just different WHOAMI register
2015-03-13 13:26:49 +11:00
Andrew Tridgell 07fd31c724 AP_InertialSensor: change copter filters to 20Hz
with the backend filters disabled 20Hz is closer to the old default of
30Hz
2015-03-12 13:11:17 +11:00
Andrew Tridgell a1d43e39e0 AP_InertialSensor: added get_gyro_filter_hz() and get_accel_filter_hz() 2015-03-12 12:50:31 +11:00
Andrew Tridgell 3d7d46b9b0 AP_InertialSensor: replaced INS_MPU6K_FILTER with INS_ACCEL_FILTER and INS_GYRO_FILTER
this allows filtering to be set separately on accels and gyros where possible
2015-03-12 12:50:31 +11:00
Andrew Tridgell f3314791f2 AP_InertialSensor: removed INS_CALSENSFRAME
it is no longer needed as we have shifted the accel cal indexes
2015-03-12 12:50:31 +11:00
Andrew Tridgell 4bc6c8e655 AP_InertialSensor: shift to new parameter indexes for accel calibration
this allows for users to switch between development trees and previous
stable versions while retaining their accel calibration values.
2015-03-12 12:50:30 +11:00
Andrew Tridgell 5d0eb49114 AP_InertialSensor: calculate queue depth based on requested sample rate
this auto-scales the queue depth for plane, rover and copter
2015-03-12 12:50:30 +11:00
Andrew Tridgell ea49d1cd39 AP_InertialSensor: removed unused variable 2015-03-12 12:50:30 +11:00
Andrew Tridgell e6a4b9f68c AP_InertialSensor: check accel health during accel cal 2015-03-12 12:50:29 +11:00
Andrew Tridgell 875339f12a AP_InertialSensor: try to avoid a compiler fault in travis 2015-03-12 12:50:29 +11:00
Andrew Tridgell 786172aa4e AP_InertialSensor: removed 1D accel calibration
it is finally time to move on from this. We want to push people
towards better calibration and removing the 1D accel cal is the first
step
2015-03-12 12:50:28 +11:00
Andrew Tridgell a975520033 AP_InertialSensor: check range of accels in 3D calibration
during 3D accel cal it is possible to get data which passes the sphere
fit but which has very poor coverage and does not provide sufficient
data for a good result. This checks that each axis covers a range of
at least 12 m/s/s in body frame
2015-03-12 12:50:28 +11:00
Andrew Tridgell a8a8628515 AP_InertialSensor: added INS_CALSENSFRAME parameter
this allows us to detect if accel calibration was done in sensor frame
or not. If it was done in sensor frame then the accel calibration is
independent of AHRS_ORIENTATION, which makes it easier to move a board
to a new airframe without having to recalibrate.
2015-03-12 12:50:28 +11:00
Jonathan Challinger bc655ff0cc AP_InertialSensor_PX4: add optional debug 2015-03-12 12:50:28 +11:00
Jonathan Challinger 074ee49cd0 AP_InertialSensor_PX4: interleave accel and gyro samples by time 2015-03-12 12:50:28 +11:00
Jonathan Challinger addf80b669 AP_InertialSensor_PX4: explicitly configure sensors, publish deltas 2015-03-12 12:50:27 +11:00
Jonathan Challinger b5131b7b64 AP_InertialSensor: add coning.py example 2015-03-12 12:50:27 +11:00
Jonathan Challinger 2a547f329b AP_InertialSensor: allow backends to publish delta velocities and angles 2015-03-12 12:50:27 +11:00
Jonathan Challinger 155c173ed1 AP_InertialSensor: rename _rotate_and_offset to _publish 2015-03-12 12:50:27 +11:00
Jonathan Challinger 502446d821 AP_InertialSensor: use LowPassFilter2pVector3f 2015-03-12 12:50:27 +11:00
Randy Mackay 5f26a36060 INS: protect against two calibrations running at the same time 2015-03-09 17:58:38 +11:00
Randy Mackay f9c6e35d19 INS: add calibrating method 2015-03-09 17:58:38 +11:00
Randy Mackay b0e7990c90 INS: set gyro_cal_ok only after completing calibration 2015-03-09 17:58:37 +11:00
Andrew Tridgell aec7907571 AP_InertialSensor: updated comment on accel check in gyro cal 2015-03-09 17:58:36 +11:00
Andrew Tridgell 494e909703 AP_InertialSensor: ensure accel cal completion messages get through 2015-03-09 07:36:50 +11:00
Andrew Tridgell 38bde56523 AP_InertialSensor: continue finding best gyro after convergence
with multiple gyros if we are still calibrating one of the gyros then
keep looking for better values for the already converged gyros.
2015-03-08 07:49:38 +11:00
Andrew Tridgell 20a4c98bac AP_InertialSensor: use accelerometers to prevent bad gyro cal
if the board is rotating at a steady rate we can end up with a bad
gyro calibration. This can happen on a steadily moving platform such
as a ship.

This uses the accelerometers to detect the steady movement and not
accept the gyro calibration
2015-03-08 07:48:16 +11:00
Andrew Tridgell 434d094993 AP_InertialSensor: allow MAVLink packets to flow during accelcal
this uses the snoop functionality of GCS_MAVLink to allow the delay
callback to be used during accel calibration
2015-03-07 21:56:39 +11:00
Randy Mackay b650d39786 InertialSensor: remove product_id set to zero 2015-02-21 09:14:33 +09:00
Andrew Tridgell 9b2d44d6ed AP_InertialSensor: use delay_microseconds_boost()
this gives much more consistent timing for PX4
2015-02-16 12:19:13 +11:00
Andrew Tridgell f54d799bff AP_InertialSensor: added TIMING_DEBUG code for finding loop timing issues 2015-02-16 10:12:10 +11:00
Andrew Tridgell 04bef5ccf3 AP_InertialSensor: don't skip delay if we are a bit early
this produces a bit more even timing
2015-02-14 12:25:44 +11:00
Andrew Tridgell 4537acb898 AP_InertialSensor: change for new PX4 device paths 2015-02-14 12:25:43 +11:00
mirkix 460b434708 AP_InertialSensor: add apm1 oilpan support 2015-02-11 18:22:44 +11:00
Grant Morphett b511410b48 AP_InertialSensor: Changes to fix the warnings in rover sitl build.
We are starting the process of resolving all the warnings in the
ardupilot builds of all vehicles and platforms.
2015-02-11 18:16:45 +11:00
Emile Castelnuovo dae32984f1 AP_InertialSensor: use PX4 library for VRBRAIN boards. 2015-02-02 08:43:59 +11:00
Emile Castelnuovo 731329fc55 AP_InertialSensor: correction to AP_InertialSensor_VRBRAIN 2015-02-02 08:43:58 +11:00
LukeMike 6a93148b92 AP_InertialSensor: added library for VRBRAIN Inertial Sensor 2015-02-02 08:43:58 +11:00
Andrew Tridgell 6e62e1ca7b AP_InertialSensor: make calibrated() const 2015-02-01 14:13:54 +11:00
Randy Mackay b43dc3bdfb INS: fix example sketch 2015-01-28 17:15:42 +09:00
Andrew Tridgell 8b59c72eb9 AP_InertialSensor: cope with 2 IMUs in SITL 2015-01-20 19:47:45 +11:00
Andrew Tridgell b3ce56d34d AP_InertialSensor: fixed 2nd IMU in Replay
this makes for much more accurate replay runs
2015-01-20 09:20:47 +11:00
mirkix fa950a735e AP_InertialSensor: add support for BBBMINI, simple ArduPilot DIY Cape for the BeagleBone Black 2015-01-12 21:36:40 +13:00
Andrew Tridgell 1b3c3c754d AP_InertialSensor: use correct ifdef for AK8963 2015-01-07 11:58:05 +11:00
Staroselskii Georgii f7f9cd2173 AP_InertialSensor: prevented MPU9250 from disabling I2C slaves 2015-01-07 08:41:13 +11:00
Andrew Tridgell 745b739ab7 AP_InertialSensor: make calibrated() function fast enough to call in flight
this will be used in plane to make AHRS SYS_STATUS unhealthy if a user
tries to fly with EKF enabled without a full 3D accel cal.

Note that it doesn't rely on using AP_Param load() to detect that a
value has been set, as some users are first doing a 3D cal then later
doing a 1D cal. In that case load() was returning true and would give
a false positive
2015-01-03 14:06:42 +11:00
Andrew Tridgell 06a72839ed AP_InertialSensor: fixed error detection on secondary IMUs
the break; was preventing error detection on lsm303d/l3gd20
2015-01-01 08:55:57 +11:00
Andrew Tridgell b9adc6e466 AP_InertialSensor: prefer sensors that have zero error counts
if a sensor has failed in flight then try not to use it if another
error-free sensor is available
2014-12-29 21:19:35 +11:00
Andrew Tridgell 7bb56e50aa AP_InertialSensor: fixed example build 2014-11-28 10:40:19 +11:00
Andrew Tridgell f84f432ecf AP_InertialSensor: allow gyro calibration to take up to 30 seconds
this gives time for the user time to get their battery hatches on and
hold the model steady. 5 seconds was just far too short
2014-11-22 18:27:51 +11:00
Andrew Tridgell 7c288e020b AP_InertialSensor: fixed detection of dead IMU
if a PX4 sensor does not give new data we need to avoid calling
_rotate_and_offset_*() to avoid marking it as healthy. Otherwise if
the MPU6k dies we won't switch to the LSM303D automatically
2014-11-16 12:30:33 +11:00
Andrew Tridgell 986b7bf894 AP_InertialSensor: fixed frequency to 16 bit in LDM303D and L3GD20 drivers 2014-11-11 17:06:22 +11:00
Andrew Tridgell 3518cf5480 AP_InertialSensor: fixed default MPU9250 orientation for NavIO 2014-11-04 16:18:35 +11:00
Andrew Tridgell ad7c612334 AP_InertialSensor: fixed SITL with new HIL code 2014-10-24 15:05:44 +11:00
Andrew Tridgell aeaa3c1e04 AP_InertialSensor: fixed build for VRBrain 2014-10-24 12:10:41 +11:00
Andrew Tridgell 40e83ceb1f AP_InertialSensor: simplify next sample time calculations
this makes the calculation much clearer
2014-10-24 12:10:40 +11:00
Andrew Tridgell 9dfbdb1e69 AP_InertialSensor: run the MPU6000 at 1kHz on fast CPUs
use a software filter and 1kHz sampling for better filtering if we
have a fast enough CPU to do it
2014-10-24 12:10:40 +11:00
Andrew Tridgell a047d1f569 AP_InertialSensor: moved default filter and sample_rate to frontend
this simplifies the backends and prevents code repitition
2014-10-24 12:10:40 +11:00
Andrew Tridgell 17b2214798 AP_InertialSensor: make it easier to add multiple backends
use _add_backend() to add new backends on startup
2014-10-24 12:10:40 +11:00
Andrew Tridgell bc5d79118d AP_InertialSensor: updated comments 2014-10-24 12:10:39 +11:00
Andrew Tridgell 3a9a5a9c18 AP_InertialSensor: implement gyro and accel health monitoring
sensor is healthy if it gave a sample on the last update()
2014-10-24 12:10:39 +11:00
Andrew Tridgell 586fa9a816 AP_InertialSensor: added product_id support
fill in parameter from first backend
2014-10-24 12:10:39 +11:00
Andrew Tridgell 520727e5bd AP_InertialSensor: fixed example build 2014-10-24 12:10:39 +11:00
Andrew Tridgell dbcd02f2be AP_InertialSensor: converted MPU9150 driver
untested conversion
2014-10-24 12:10:38 +11:00