Skip to content

Commit

Permalink
icm45686: fix dt (and usage command)
Browse files Browse the repository at this point in the history
With the wrong dt, the flight behaviour was really poor and noisy, so
this fix is absolutely required.

Signed-off-by: Julian Oes <julian@oes.ch>
  • Loading branch information
julianoes committed Nov 20, 2023
1 parent 9ab8970 commit b15e57d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/drivers/imu/invensense/icm45686/ICM45686.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void ICM45686::ProcessAccel(const hrt_abstime &timestamp_sample, const FIFO::DAT
accel.dt = (float)timestamp_fifo * ((1.f / _input_clock_freq) * 1e6f);

} else {
accel.dt = FIFO_TIMESTAMP_SCALING;
accel.dt = FIFO_SAMPLE_DT;
}

// 20 bit hires mode
Expand Down Expand Up @@ -634,7 +634,7 @@ void ICM45686::ProcessGyro(const hrt_abstime &timestamp_sample, const FIFO::DATA
gyro.dt = (float)timestamp_fifo * ((1.f / _input_clock_freq) * 1e6f);

} else {
gyro.dt = FIFO_TIMESTAMP_SCALING;
gyro.dt = FIFO_SAMPLE_DT;
}

// 20 bit hires mode
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/imu/invensense/icm45686/ICM45686.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ICM45686 : public device::SPI, public I2CSPIDriver<ICM45686>
void exit_and_cleanup() override;

// Sensor Configuration
static constexpr float FIFO_SAMPLE_DT{1e6f / 8000.f}; // 8000 Hz accel & gyro ODR configured
static constexpr float FIFO_SAMPLE_DT{1e6f / 6400.f}; // 6400 Hz accel & gyro ODR configured
static constexpr float GYRO_RATE{1e6f / FIFO_SAMPLE_DT};
static constexpr float ACCEL_RATE{1e6f / FIFO_SAMPLE_DT};

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/imu/invensense/icm45686/icm45686_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

void ICM45686::print_usage()
{
PRINT_MODULE_USAGE_NAME("icm42688p", "driver");
PRINT_MODULE_USAGE_NAME("icm45686", "driver");
PRINT_MODULE_USAGE_SUBCATEGORY("imu");
PRINT_MODULE_USAGE_COMMAND("start");
PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(false, true);
Expand Down

0 comments on commit b15e57d

Please sign in to comment.