158 Commits

Author SHA1 Message Date
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
Daniel Agar
e34bdb4be9
move IMU integration out of drivers to sensors hub to handle accel/gyro sync
- IMU integration move from drivers (PX4Accelerometer/PX4Gyroscope) to sensors/vehicle_imu 
 - sensors: voted_sensors_update now consumes vehicle_imu
 - delete sensor_accel_integrated, sensor_gyro_integrated
 - merge sensor_accel_status/sensor_gyro_status into vehicle_imu_status
 - sensors status output minor improvements (ordering, whitespace, show selected sensor device id and instance)
2020-05-30 11:07:54 -04:00
Daniel Agar
ca998c1822
IMU: parameterize IMU integration time (IMU_INTEG_RATE)
- default integration rate now 200 Hz (5000 us interval)
 - set update rate for all drivers and simulators using PX4Accelerometer/PX4Gyroscope
2020-05-05 20:34:09 -04:00
Daniel Agar
466b5db36f
uORB::Publication improvements and cleanup (#14784)
- create common uORB::PublicationBase
 - uORB::PublicationQueued types are now type aliases
 - ORB_PRIO use enum type everywhere to avoid accidental misuse
 - PX4Accelerometer/PX4Gyroscope/etc driver libs explicitly advertise on construction, unadvertise on destruction. This is a workaround for any potential issues that might appear when accel/gyro cdev and uORB indexing doesn't align.
2020-05-04 11:09:30 -04:00
rfu
90c3819df5 fxos8701cq + fxas21002c: add support for I2C 2020-05-04 09:49:23 +02:00
Daniel Agar
6dfe12d122
Revert "drivers/pwm_out: cleanup for multi-platform use" (#14812)
This reverts commit 0c8dcf94bc256801a45475cdd7bc6490e9fb8af7.
2020-05-02 23:42:51 -04:00
Daniel Agar
0c8dcf94bc drivers/pwm_out: cleanup for multi-platform use 2020-05-01 20:53:35 -04:00
Daniel Agar
cc62a52553 PX4Rangerfinder: delete unused CDev 2020-04-26 22:36:46 -04:00
Daniel Agar
3832214145
PX4Accelerometer/PX4Gyroscope: fix calibration offset for integrated FIFO case
This is a quick follow up fix to to a bug introduced by #14752. In the case of FIFO data (new IMU drivers) the calibration offset wasn't being applied correctly to the result of integrating the FIFO samples.

This slipped through basic sanity testing (simple bench testing, the test rack, and SITL CI) due to the calibration offsets being zeroed.
2020-04-26 13:24:51 -04:00
Daniel Agar
37d5d1b4d2 PX4Accelerometer/PX4Gyroscope: integrated data avoid loss of numerical precision 2020-04-26 14:28:50 +02:00
Daniel Agar
31f3a21849
update ecl/EKF with improved covariance prediction stability and change default IMU integration period 4000 us -> 2500 us
- bring in PX4/ecl#795 "EKF: Improve covariance prediction stability"
    - the ecl/EKF filter update period has changed from 8 ms to 10 ms
 - change default integration period 4000 us -> 2500 us (aligns with new EKF filter update period)
2020-04-23 13:55:34 -04:00
mcsauder
6548fde024 Whitespace cleanup to quiet new blank line at EOF git hook. 2020-04-15 23:00:39 -04:00
Daniel Agar
cf37be8c44
ekf2 handle accelerometer clipping
- track clipping per IMU axis and pass through to ecl/EKF
 - update ecl/EKF to include delta velocity clipping changes (PX4/ecl#663)
2020-04-07 20:11:08 -04:00
Daniel Agar
02f4ad61ec
I2C/SPI require device type in constructor 2020-04-01 12:24:22 -04:00
Daniel Agar
04bf9afd1b CDev delete unused pub_blocked 2020-04-01 11:23:26 -04:00
Daniel Agar
09ba9d62eb PX4Magnetometer: add external() getter and default temperature to NAN 2020-04-01 10:07:08 -04:00
Daniel Agar
2b82b471c1 sensor_accel_fifo increase to 32 samples 2020-03-31 13:26:50 -04:00
Beat Küng
6ad5357d1a SPI+I2C: remove unused defines and printf's 2020-03-24 09:46:20 -04:00
JacobCrabill
1e5784609f UAVCAN Sensors: Improve error handling
Also add new 'generic' device types for UAVCAN sensors

Other misc. cleanup and style changes.
2020-03-21 12:39:29 -04:00
JacobCrabill
4c8cfa140a UAVCAN: Overhaul SensorBridge drivers
Supposedly multiple sensor callbacks were supported; in reality, this
was not the case, as the mag SensorBridge in particular can only
calibrate one compass, leading to a race condition on which compass
appears first on the bus to get published and calibrated (with no
warning to the user that the 'wrong' compass is being used).

For sensors with existing generic driver classes (baro and mag) the
sensor bridges use these classes for the driver registration, and uORB
publication, and calibration interface (ioctl) handling.
2020-03-21 12:39:29 -04:00
bazooka joe
53bc5fddad smbus return with error if failed transfer 2020-03-19 09:34:02 +01:00
Beat Küng
68ef14002a differential_pressure drivers: allow multiple instances of each driver
- the device path needs to be removed, as startup fails if it already
  exists
- sdp3x broadcasts a reset on startup, so do it only for the first I2C
  address
2020-03-17 23:31:17 -04:00
Beat Küng
3b7b2dc871 differential_pressure sensors: use driver base class 2020-03-17 23:31:17 -04:00
Beat Küng
134413233a i2c spi: extend BusCLIArguments to handle common driver arguments 2020-03-17 23:31:17 -04:00
Daniel Agar
422e89b1c0 iSentek IST8308 magnetometer driver 2020-03-15 12:27:01 -04:00
Beat Küng
b54e5a1c23 param: automatically update calibration ID params on import
This avoids the need for recalibration, and also cleans up other driver
ID's (merge separate accel/gyro).

The SPI address was previously set to a board-specific (arbitrary) value,
and is now set to 0. This will allow extending for multiple sensors of the
same type on the same bus.
2020-03-10 10:11:43 -04:00