mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-07 17:20:36 +08:00
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)
This commit is contained in:
@@ -68,13 +68,12 @@
|
||||
#define DRV_IMU_DEVTYPE_LSM303D 0x11
|
||||
#define DRV_ACC_DEVTYPE_BMA180 0x12
|
||||
#define DRV_ACC_DEVTYPE_MPU6000_LEGACY 0x13
|
||||
#define DRV_ACC_DEVTYPE_ACCELSIM 0x14
|
||||
#define DRV_IMU_DEVTYPE_SIM 0x14
|
||||
#define DRV_ACC_DEVTYPE_MPU9250_LEGACY 0x16
|
||||
#define DRV_IMU_DEVTYPE_BMI160 0x17
|
||||
|
||||
#define DRV_IMU_DEVTYPE_MPU6000 0x21
|
||||
#define DRV_GYR_DEVTYPE_L3GD20 0x22
|
||||
#define DRV_GYR_DEVTYPE_GYROSIM 0x23
|
||||
#define DRV_IMU_DEVTYPE_MPU9250 0x24
|
||||
#define DRV_IMU_DEVTYPE_ICM20649 0x25
|
||||
#define DRV_IMU_DEVTYPE_ICM42688P 0x26
|
||||
|
||||
@@ -115,9 +115,6 @@ bool ADIS16448::reset()
|
||||
return false;
|
||||
}
|
||||
|
||||
_px4_accel.set_update_rate(_sample_rate);
|
||||
_px4_gyro.set_update_rate(_sample_rate);
|
||||
|
||||
// Set gyroscope scale to default value.
|
||||
//if (!set_gyro_dyn_range(GYRO_INITIAL_SENSITIVITY)) {
|
||||
// return false;
|
||||
|
||||
@@ -69,10 +69,7 @@ ADIS16477::ADIS16477(I2CSPIBusOption bus_option, int bus, int32_t device, enum R
|
||||
#endif // GPIO_SPI1_RESET_ADIS16477
|
||||
|
||||
_px4_accel.set_scale(1.25f * CONSTANTS_ONE_G / 1000.0f); // accel 1.25 mg/LSB
|
||||
_px4_accel.set_update_rate(ADIS16477_DEFAULT_RATE);
|
||||
|
||||
_px4_gyro.set_scale(math::radians(0.025f)); // gyro 0.025 °/sec/LSB
|
||||
_px4_gyro.set_update_rate(ADIS16477_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
ADIS16477::~ADIS16477()
|
||||
|
||||
@@ -84,9 +84,6 @@ ADIS16497::ADIS16497(I2CSPIBusOption bus_option, int bus, int32_t device, enum R
|
||||
// Configure hardware reset line
|
||||
px4_arch_configgpio(GPIO_SPI1_RESET_ADIS16497);
|
||||
#endif // GPIO_SPI1_RESET_ADIS16497
|
||||
|
||||
_px4_accel.set_update_rate(ADIS16497_DEFAULT_RATE);
|
||||
_px4_gyro.set_update_rate(ADIS16497_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
ADIS16497::~ADIS16497()
|
||||
|
||||
@@ -182,7 +182,6 @@ BMA180::BMA180(I2CSPIBusOption bus_option, int bus, int32_t device, enum Rotatio
|
||||
_px4_accel(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": read"))
|
||||
{
|
||||
_px4_accel.set_update_rate(1000);
|
||||
}
|
||||
|
||||
BMA180::~BMA180()
|
||||
|
||||
@@ -56,7 +56,6 @@ BMI055_accel::BMI055_accel(I2CSPIBusOption bus_option, int bus, const char *path
|
||||
_duplicates(perf_alloc(PC_COUNT, "bmi055_accel_duplicates")),
|
||||
_got_duplicate(false)
|
||||
{
|
||||
_px4_accel.set_update_rate(BMI055_ACCEL_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
BMI055_accel::~BMI055_accel()
|
||||
|
||||
@@ -58,7 +58,6 @@ BMI055_gyro::BMI055_gyro(I2CSPIBusOption bus_option, int bus, const char *path_g
|
||||
_bad_registers(perf_alloc(PC_COUNT, "bmi055_gyro_bad_registers")),
|
||||
_duplicates(perf_alloc(PC_COUNT, "bmi055_gyro_duplicates"))
|
||||
{
|
||||
_px4_gyro.set_update_rate(BMI055_GYRO_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
BMI055_gyro::~BMI055_gyro()
|
||||
|
||||
@@ -65,7 +65,6 @@ BMI088_accel::BMI088_accel(I2CSPIBusOption bus_option, int bus, const char *path
|
||||
_duplicates(perf_alloc(PC_COUNT, "bmi088_accel_duplicates")),
|
||||
_got_duplicate(false)
|
||||
{
|
||||
_px4_accel.set_update_rate(BMI088_ACCEL_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
BMI088_accel::~BMI088_accel()
|
||||
|
||||
@@ -66,7 +66,6 @@ BMI088_gyro::BMI088_gyro(I2CSPIBusOption bus_option, int bus, const char *path_g
|
||||
_bad_registers(perf_alloc(PC_COUNT, "bmi088_gyro_bad_registers")),
|
||||
_duplicates(perf_alloc(PC_COUNT, "bmi088_gyro_duplicates"))
|
||||
{
|
||||
_px4_gyro.set_update_rate(BMI088_GYRO_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
BMI088_gyro::~BMI088_gyro()
|
||||
|
||||
@@ -64,7 +64,6 @@ BMI160::BMI160(I2CSPIBusOption bus_option, int bus, int32_t device, enum Rotatio
|
||||
_reset_retries(perf_alloc(PC_COUNT, MODULE_NAME":reset retries")),
|
||||
_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": duplicates"))
|
||||
{
|
||||
_px4_gyro.set_update_rate(BMI160_GYRO_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
BMI160::~BMI160()
|
||||
|
||||
@@ -75,7 +75,6 @@ FXAS21002C::FXAS21002C(device::Device *interface, I2CSPIBusOption bus_option, in
|
||||
_bad_registers(perf_alloc(PC_COUNT, MODULE_NAME": bad register")),
|
||||
_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": duplicate reading"))
|
||||
{
|
||||
_px4_gyro.set_update_rate(FXAS21002C_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
FXAS21002C::~FXAS21002C()
|
||||
|
||||
@@ -66,8 +66,6 @@ FXOS8701CQ::FXOS8701CQ(device::Device *interface, I2CSPIBusOption bus_option, in
|
||||
_bad_registers(perf_alloc(PC_COUNT, MODULE_NAME": bad reg")),
|
||||
_accel_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": acc dupe"))
|
||||
{
|
||||
_px4_accel.set_update_rate(FXOS8701C_ACCEL_DEFAULT_RATE);
|
||||
|
||||
#if !defined(BOARD_HAS_NOISY_FXOS8700_MAG)
|
||||
_px4_mag.set_scale(0.001f);
|
||||
#endif
|
||||
|
||||
@@ -316,9 +316,6 @@ void ICM20602::ConfigureSampleRate(int sample_rate)
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
|
||||
ConfigureFIFOWatermark(_fifo_gyro_samples);
|
||||
}
|
||||
|
||||
|
||||
@@ -328,9 +328,6 @@ void ICM20608G::ConfigureSampleRate(int sample_rate)
|
||||
_fifo_empty_interval_us = _fifo_gyro_samples * (1e6f / GYRO_RATE);
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
}
|
||||
|
||||
bool ICM20608G::Configure()
|
||||
|
||||
@@ -330,9 +330,6 @@ void ICM20649::ConfigureSampleRate(int sample_rate)
|
||||
_fifo_empty_interval_us = _fifo_gyro_samples * (1e6f / GYRO_RATE);
|
||||
|
||||
_fifo_accel_samples = roundf(math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES));
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
}
|
||||
|
||||
void ICM20649::SelectRegisterBank(enum REG_BANK_SEL_BIT bank)
|
||||
|
||||
@@ -328,9 +328,6 @@ void ICM20689::ConfigureSampleRate(int sample_rate)
|
||||
_fifo_empty_interval_us = _fifo_gyro_samples * (1e6f / GYRO_RATE);
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
}
|
||||
|
||||
bool ICM20689::Configure()
|
||||
|
||||
@@ -364,9 +364,6 @@ void ICM20948::ConfigureSampleRate(int sample_rate)
|
||||
_fifo_empty_interval_us = _fifo_gyro_samples * (1e6f / GYRO_RATE);
|
||||
|
||||
_fifo_accel_samples = roundf(math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES));
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
}
|
||||
|
||||
void ICM20948::SelectRegisterBank(enum REG_BANK_SEL_BIT bank)
|
||||
|
||||
@@ -322,9 +322,6 @@ void ICM40609D::ConfigureSampleRate(int sample_rate)
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
|
||||
ConfigureFIFOWatermark(_fifo_gyro_samples);
|
||||
}
|
||||
|
||||
|
||||
@@ -324,9 +324,6 @@ void ICM42688P::ConfigureSampleRate(int sample_rate)
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
|
||||
ConfigureFIFOWatermark(_fifo_gyro_samples);
|
||||
}
|
||||
|
||||
|
||||
@@ -323,9 +323,6 @@ void MPU6000::ConfigureSampleRate(int sample_rate)
|
||||
_fifo_empty_interval_us = _fifo_gyro_samples * (1e6f / GYRO_RATE);
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
}
|
||||
|
||||
bool MPU6000::Configure()
|
||||
|
||||
@@ -323,9 +323,6 @@ void MPU6500::ConfigureSampleRate(int sample_rate)
|
||||
_fifo_empty_interval_us = _fifo_gyro_samples * (1e6f / GYRO_RATE);
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
}
|
||||
|
||||
bool MPU6500::Configure()
|
||||
|
||||
@@ -356,9 +356,6 @@ void MPU9250::ConfigureSampleRate(int sample_rate)
|
||||
_fifo_empty_interval_us = _fifo_gyro_samples * (1e6f / GYRO_RATE);
|
||||
|
||||
_fifo_accel_samples = math::min(_fifo_empty_interval_us / (1e6f / ACCEL_RATE), (float)FIFO_MAX_SAMPLES);
|
||||
|
||||
_px4_accel.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
_px4_gyro.set_update_rate(1e6f / _fifo_empty_interval_us);
|
||||
}
|
||||
|
||||
bool MPU9250::Configure()
|
||||
|
||||
@@ -45,7 +45,6 @@ L3GD20::L3GD20(I2CSPIBusOption bus_option, int bus, uint32_t device, enum Rotati
|
||||
_bad_registers(perf_alloc(PC_COUNT, MODULE_NAME": bad_reg")),
|
||||
_duplicates(perf_alloc(PC_COUNT, MODULE_NAME": dupe"))
|
||||
{
|
||||
_px4_gyro.set_update_rate(L3GD20_DEFAULT_RATE);
|
||||
}
|
||||
|
||||
L3GD20::~L3GD20()
|
||||
|
||||
@@ -127,7 +127,6 @@ LSM303D::reset()
|
||||
|
||||
accel_set_range(LSM303D_ACCEL_DEFAULT_RANGE_G);
|
||||
accel_set_samplerate(LSM303D_ACCEL_DEFAULT_RATE);
|
||||
_px4_accel.set_update_rate(LSM303D_ACCEL_DEFAULT_RATE);
|
||||
|
||||
// we setup the anti-alias on-chip filter as 50Hz. We believe
|
||||
// this operates in the analog domain, and is critical for
|
||||
|
||||
@@ -160,8 +160,6 @@ int MPU6000::reset()
|
||||
|
||||
// SAMPLE RATE
|
||||
_set_sample_rate(1000);
|
||||
_px4_accel.set_update_rate(1000);
|
||||
_px4_gyro.set_update_rate(1000);
|
||||
px4_usleep(1000);
|
||||
|
||||
_set_dlpf_filter(MPU6000_DEFAULT_ONCHIP_FILTER_FREQ);
|
||||
|
||||
@@ -189,8 +189,6 @@ MPU9250::reset_mpu()
|
||||
|
||||
// SAMPLE RATE
|
||||
_set_sample_rate(_sample_rate);
|
||||
_px4_accel.set_update_rate(_sample_rate);
|
||||
_px4_gyro.set_update_rate(_sample_rate);
|
||||
|
||||
_set_dlpf_filter(MPU9250_DEFAULT_ONCHIP_FILTER_FREQ);
|
||||
|
||||
|
||||
@@ -47,8 +47,6 @@ ISM330DLC::ISM330DLC(I2CSPIBusOption bus_option, int bus, uint32_t device, enum
|
||||
_px4_accel(get_device_id(), ORB_PRIO_DEFAULT, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_DEFAULT, rotation)
|
||||
{
|
||||
_px4_accel.set_update_rate(1000000 / FIFO_INTERVAL);
|
||||
_px4_gyro.set_update_rate(1000000 / FIFO_INTERVAL);
|
||||
}
|
||||
|
||||
ISM330DLC::~ISM330DLC()
|
||||
|
||||
@@ -45,8 +45,6 @@ LSM9DS1::LSM9DS1(I2CSPIBusOption bus_option, int bus, uint32_t device, enum Rota
|
||||
_px4_accel(get_device_id(), ORB_PRIO_DEFAULT, rotation),
|
||||
_px4_gyro(get_device_id(), ORB_PRIO_DEFAULT, rotation)
|
||||
{
|
||||
_px4_accel.set_update_rate(1000000 / _fifo_interval);
|
||||
_px4_gyro.set_update_rate(1000000 / _fifo_interval);
|
||||
}
|
||||
|
||||
LSM9DS1::~LSM9DS1()
|
||||
|
||||
Reference in New Issue
Block a user