Commit Graph

50 Commits

Author SHA1 Message Date
Andrew Tridgell 3289e90134 AP_InertialSensor: added error count increments in drivers 2016-11-11 08:08:55 +11:00
Lucas De Marchi ace61087a1 AP_InertialSensor: remove product_id
We only leave the parameter there for backward-compatibility. However
product id on the inertial sensor is not much useful since it's only
kept for the first instance.

A better implementation per-gyro and per-accel is needed in order to
avoid problems with sensors taking the offsets configured for another
sensor.
2016-11-09 17:08:05 +11:00
Andrew Tridgell a5c5e033d2 AP_InertialSensor: fixed threading and locking in remaining backends
use a backend semaphore for shared data and use thread per bus where
available
2016-11-09 17:08:01 +11:00
Andrew Tridgell 2df6ed08c2 AP_InertialSensor: added optional per-instance orientation
this is needed for multi-sensor boards to get orientation right for
each sensor
2016-11-09 17:08:00 +11:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Andrew Tridgell 6f9530ebaa AP_InertialSensor: added optional FSYNC external sync bit
used to synchronise with image sensor on Disco
2016-09-05 12:55:32 +10:00
Andrew Tridgell eee9fc88a1 AP_InertialSensor: avoid ifdef for AP_MODULE_SUPPORTED 2016-07-14 13:39:47 +10:00
Andrew Tridgell 33ce1213a2 AP_InertialSensor: call gyro_sample and accel_sample AP_Module hooks 2016-07-14 13:39:47 +10:00
Andrew Tridgell 834acaffee AP_InertialSensor: provide IMU temperature to HAL for all boards 2016-07-01 15:29:52 +10:00
Andrew Tridgell ee453783eb AP_InertialSensor: added get_delta_angle_dt() API 2016-01-19 09:50:21 +11:00
Tom Pittenger 3aaf2b1d2b AP_InertialSensor: add pos/neg peak detector
new functions that get a filtered min/max accel peaks on each axis with fixed 500ms timeout:
    Vector3f get_accel_peak_hold_pos()
    Vector3f get_accel_peak_hold_neg()

This allows slower mechanisms, such as is_flying, to detect accel spikes which would indicate ground or object impacts. Vibe is too filtered. Independent positive and negative peaks are available
2016-01-02 09:58:31 +11:00
Jonathan Challinger bae16a61e2 AP_InertialSensor: fix segfault 2015-12-29 23:10:56 -08:00
Jonathan Challinger 492223cb84 AP_InertialSensor: support AP_AccelCal 2015-12-29 10:46:34 -08:00
Andrew Tridgell 9cdd5f3944 AP_InertialSensor: catch NAN errors in accel and gyro filters 2015-11-22 17:30:29 +11:00
Caio Marcelo de Oliveira Filho d7601095fa AP_InertialSensor: use millis/micros/panic functions 2015-11-20 12:31:41 +09:00
Andrew Tridgell 32ed0d58f3 AP_InertialSensor: fixed filter setup on 2nd accel/gyro 2015-11-16 17:57:36 +11:00
Andrew Tridgell ccd915eb67 AP_InertialSensor: moved raw gyro and accel logging to common code
this brings raw logging to non-PX4 ports
2015-11-16 17:57:35 +11:00
Andrew Tridgell 0e4bab74ba AP_InertialSensor: simplify sensor backends
use common code for filtering and update, allowing each sensor driver
to be simpler and more consistent
2015-11-16 17:57:35 +11:00
Andrew Tridgell 142aa59bce AP_InertialSensor: fixed vibration logging after recent changes 2015-10-26 07:26:17 +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 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
Jonathan Challinger 3b480bd6ec AP_InertialSensor: fix order of accelerometer corrections 2015-10-21 08:22:36 +11: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 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
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 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
Jonathan Challinger 423160eaf8 AP_InertialSensor: publish delta_velocity_dt 2015-04-03 14:54:06 -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
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 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 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 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
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 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 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 d48beb0c0f AP_InertialSensor: converted PX4 driver to new API 2014-10-24 12:10:37 +11:00
Andrew Tridgell 448efc70a3 AP_InertialSensor: first steps in frontend/backend split
This converts the MPU6000 driver to a frontend/backend structure, and
disables all other drivers. They will be progressively re-enabled as
each is converted
2014-10-24 12:10:36 +11:00