183 Commits

Author SHA1 Message Date
Daniel Agar
0c31f63896 sensors: add baro calibration and cleanup
- sensor_baro.msg use SI (pressure in Pascals)
 - update all barometer drivers to publish directly and remove PX4Barometer helper
 - introduce baro cal (offset) mainly as a mechanism to adjust
relative priority
 - commander: add simple baro cal that sets baro offsets to align with
GPS altitude (if available)
 - create new sensors_status.msg to generalize sensor reporting
2022-03-26 16:08:41 -04:00
Jukka Laitinen
9e999a39be Revert erroneous linking of drivers__device to px4_work_queue
This was a mistake in commit 91b812fc4265e6e7d342c0d878de3a4dcaf5137d

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-01-28 17:30:13 -05:00
Jukka Laitinen
91b812fc42 link drivers__device to nuttx_karch instead of nuttx_arch in protected build
On protected/kernel build the library would be karch.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-01-27 12:42:40 -05:00
Daniel Agar
e731fcdbc0
sensors (accel/gyro/mag) determine if external with device id 2022-01-10 10:31:07 -05:00
Daniel Agar
d59d16a6cd drivers/accelerometer: adjust int16_t clipping threshold slightly
- consider data clipped/saturated if it's INT16_MIN/INT16_MAX or within 1
 - this accommodates rotated data (|INT16_MIN| = INT16_MAX + 1) and sensors that may re-use the lowest bit for other purposes (sync indicator, etc)
2021-12-15 12:45:58 -05:00
Daniel Agar
7b7b7acd36 i2c_spi_buses: respect CONFIG_I2C and CONFIG_SPI
- bmp280, dps310, and ms5611 barometers support boards without I2C
2021-11-15 15:57:33 -05:00
Jukka Laitinen
be1023f5e9 smbus_sbs: Define linker language for a header-only library
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-10 09:27:21 -05:00
Jukka Laitinen
d02a10b20f Remove src/lib/drivers/accelerometer and gyroscope linking to drivers__device
These are pure uORB publishers, they don't link to drivers__device.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-10 09:26:36 -05:00
Vatsal Asitkumar Joshi
ea1ae73526
Support for Raspberry PI RP2040 MCU (#18083) 2021-11-03 12:14:30 -04:00
Daniel Agar
089f96f800 lib/drivers/{accelerometer,gyroscope} skip obselete Vector3f construction
- FIFO clip count only check if value is INT16_MIN/MAX rather than abs() call
2021-10-08 17:33:27 -04:00
Daniel Agar
cb610caf1e drivers: minimize additional I2C retries 2021-08-17 09:54:50 -04:00
Daniel Agar
65745a3676 purge broken qurt support and atlflight boards 2021-07-16 08:53:36 -04:00
Daniel Agar
883624d915 lib/geo: move from ecl 2021-07-15 10:38:24 -04:00
Beat Küng
e644036325 drivers: use updated I2C SPI driver interface 2021-07-08 12:59:35 -04:00
Beat Küng
c5aef9d512 i2c_spi_buses: add support for multiple instances of the same device on a bus
This also simplifies the API a bit, since we anyway have to change the
drivers to pass additional information (the bus device index).

The orientation flag is merged with the rotation.
2021-07-08 12:59:35 -04:00
David Sidrane
b4ebc68a40 lib/drivers/nuttx/ I2C SPI:Use inttypes 2021-06-16 17:07:47 +02:00
David Sidrane
ff2748ba53 PX4Gyroscope:Fix types 2021-06-16 17:07:47 +02:00
David Sidrane
42e51b0215 PX4Accelerometer:Fix types 2021-06-16 17:07:47 +02:00
AlexKlimaj
dddd2c3297
drivers/distance_sensor: New Broadcom AFBR-S50LV85D distance sensor driver
* Basic Broadcom AFBR-S50 driver using vendor API and binary blob https://github.com/Broadcom/AFBR-S50-API
* fix ARK Flow paw3902 rotation
2021-06-15 12:12:24 -04:00
echoG
6bc09138c1
Adding BatMon smart battery as a module and refactoring SMBUS based SBS 1.1 spec to a library 2021-06-09 12:17:45 -04:00
Daniel Agar
8478d1ea37
sensors/vehicle_angular_velocity: properly handle filter reset on FIFO data scale changes
For the sake of efficiency (at 8 kHz) all filtering is performed on the raw data before the calibration and rotation is applied to only the final output. As a result we have to be a bit more careful when switching between sensors or in cases where the gyro scale factor changes (eg icm42688p 20 bit data rescaled to fit in int16 output).
2021-04-25 14:20:32 -04:00
Daniel Agar
047fb13922 IMU_GYRO_RATEMAX: enforce reasonable constraint and update metadata 2021-04-13 20:26:57 -04:00
Daniel Agar
e57aaaaa5e
rotate accel/gyro FIFO before publish and fix angular velocity filter resets
- rotates accel & gyro FIFO data before publication both to simplify downstream usage (including log review) and fix other issues
     - to best handle int16_t data rotations are now either performed with swaps if possible, otherwise promoted to float, rotated using the full rotation matrix, then rounded back to int16_t
 - fix sensors/vehicle_angular_velocity filter reset both with proper rotation and new calibration uncorrect helper
      - in FIFO case filtering is done before calibration is applied, but we need to handle a possible reset from a completely different sensor (vehicle body angular velocity -> sensor frame uncorrected data)
2021-03-22 12:01:12 -04:00
Dima Ponomarev
e660b50021
uavcan: add IMU sensor support 2021-03-17 18:04:12 -04:00
Daniel Agar
5f3e883f2c
sensors/vehicle_imu: vehicle_imu_status include accel/gyro full raw FIFO sample rate 2021-02-24 08:13:53 -05:00
Alex Mikhalev
6bd4dff51f drivers/smbus: Increase max block size to 34
batt_smbus for BQ40Z80 transfers up to 34 bytes (32 byte block + 2 byte
address), but this was overflowing and failing the PEC check.
So increase the buffer size

Signed-off-by: Alex Mikhalev <alex@corvus-robotics.com>
2021-02-18 07:52:26 -05:00
Daniel Agar
b30bd7f589 drivers: no longer any need to advertise immediately (baro, mag, rangefinder) 2021-01-31 11:35:46 +01:00
JacobCrabill
bf4ae81995 Device: Add MAVLINK bus type 2021-01-28 09:09:11 +01:00
JacobCrabill
01462ce627 Device: Add missing SERIAL enum to bus_string function 2021-01-27 17:02:20 -05:00
JacobCrabill
85796fbd84 Drivers: Distance Sensors: Add proper device IDs
Add new DeviceBusType_SERIAL to Device::DeviceId union
Add DRV_DIST_DEVTYPE's for all distance sensors
Change distance_sensor_s.id to distance_sensor_s.device_id
Modify all distance_sensor drivers to apply 'proper' device_id
2021-01-27 17:02:20 -05:00
Daniel Agar
a57b9f9381 delete drv_baro.h, drv_mag.h, drv_range_finder.h, drv_device.h and purge UAVCAN CDev usage 2021-01-12 22:04:52 -05:00
Daniel Agar
3f9e5a6934 drivers/device/ringbuffer: move into crazyflie syslink (only remaining user) 2020-11-17 19:47:06 -05:00
FengShun
eac9a6b68b Replace PublicationQueued with Publication to automatically configure ORB_QUEUE_LENGTH 2020-10-26 13:01:13 +01:00
Daniel Agar
378cb155d6
simulator: support accel/gyro instances and stuck failure
- expand simulator to 3 accels and gyros
 - PX4Accelerometer/PX4Gyroscope switch to old param usage due to copy constructor issues with ModuleParams
2020-10-07 13:20:13 -04:00
flochir
ec7108892b
batt_smbus: fix potential hardfault by checking buffer sizes (#15789)
* Added buffer length check to SMBus::block_read (triggered hardfault in batt_smbus module by writing beyond buffer end due to device returning longer byte_count than requested/expected)

Co-authored-by: Florian Olbrich <florian.olbrich@scarabot.de>
Co-authored-by: Daniel Agar <daniel@agar.ca>
Co-authored-by: BazookaJoe1900 <BazookaJoe1900@gmail.com>
Co-authored-by: Beat Küng <beat-kueng@gmx.net>
2020-09-28 09:41:40 +02:00
Daniel Agar
0a607bdc67
boards: CUAV CAN_GPS v1.2 cannode (stm32f412) with UAVCAN bootloader 2020-09-23 14:30:54 -04:00
David Sidrane
b32aab2d0f platform Updates for NuttX 9.1.0- 2020-09-16 21:32:04 -04:00
avionicsanonymous
df38e3798c
UAVCAN Rangefinder Support (#15097) 2020-09-07 19:22:08 -04:00
Daniel Agar
f2c9865c9b sensor mag add minimal queue and calibration check all
- mag calibration acceptance check sphere/ellipsoid fit status
2020-08-21 10:12:13 -04:00
Daniel Agar
44c877c603 sensors: size sensor error_count consistently (uint32_t) 2020-08-21 10:12:13 -04:00
Daniel Agar
27f23ac290 move initial sensor priority to parameters and purge ORB_PRIORITY
- CAL_ACCx_EN -> CAL_ACCx_PRIO
 - CAL_GYROx_EN -> CAL_GYROx_PRIO
 - CAL_MAGx_EN -> CAL_MAGx_PRIO
2020-08-21 10:12:13 -04:00
Daniel Agar
971b1e4b4d sensors: move mag aggregation to new VehicleMagnetometer WorkItem
- purge all reminaing magnetometer IOCTL usage
 - mag calibration add off diagonal (soft iron) scale factors
2020-08-21 10:12:13 -04:00
bazooka joe
190b96a46c SMbus battery driver - a lot of updates and optimizations
- added support for BQ40Z80 based battery
- added performance counter for interface errors
- added SMART_BATTERY_INFO mavlink message
- general code cleanups and optimization
- fixed: void flooding the log in case of interface error
- fixed: using _batt_startup_capacity instead of _batt_capacity for discharged_mah
- update: read manufacture_date
- update: get _cell_count from parameter and not const 4
- update: avoid re-reading data that has already been read and stored on class already
- currently the battery type defined by BAT_SMBUS_MODEL parameter and not by auto detection
2020-08-18 21:41:19 -04:00
Daniel Agar
1394b5d7bc sensor_baro add separate timestamp_sample field
- the timestamp is uORB message publication metadata
2020-07-17 09:42:19 -04:00
Daniel Agar
22daa26955 msgs/sensor_mag: remove unused raw, add timestamp_asmple, shrink error count
- move mpu9250 sensitivity handling back to driver (this isn't common)
2020-06-22 10:11:22 -04:00
Daniel Agar
56c86e77bd replace FIFOSample -> sensor_accel_fifo/sensor_gyro_fifo 2020-06-18 20:49:15 -04:00
Daniel Agar
f55ed0992c
accel and gyro calibration refactor and cleanup
- remove all remaining IOCTLs for accel and gyro and handle all calibration entirely in sensors module with parameters
 - sensor_accel and sensor_gyro are now always raw sensor data
 - calibration procedures no longer need to first clear existing values before starting
 - temperature calibration (TC) remove all scale (SCL) parameters
    - gyro and baro scale are completely unused
    - regular accel calibration scale can be used (CAL_ACC*_xSCALE) instead of TC scale
2020-06-17 22:50:09 -04:00
Daniel Agar
e819f99064 new Bosch BMI055 IMU driver using FIFOs and DRDY
- accel & gyro FIFOs enabled
 - FIFO watermark on data ready interrupt
 - sensor side filtering completely disabled
 - gyro now respects `IMU_GYRO_RATEMAX` (up to 2 kHz)
 - saves a few % cpu (at default rate)
2020-06-15 10:19:14 -04:00
Daniel Agar
13e34b32e6 new Bosch BMI088 IMU driver using FIFOs and DRDY 2020-06-11 12:25:13 -04:00
Daniel Agar
31fe7af454 selectively increase optimization -Os -> -O2
- targetted at modules/libraries that benefit without drastically
increasing flash usage
 - ignored on boards with CONSTRAINED_FLASH set
2020-06-04 20:59:52 -04:00