mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 19:23:35 +08:00
Analog Devices ADIS16497 move to PX4Accelerometer/PX4Gyroscope and cleanup
This commit is contained in:
@@ -104,19 +104,18 @@ void PX4Accelerometer::set_sample_rate(unsigned rate)
|
||||
_filter.set_cutoff_frequency(_sample_rate, _filter.get_cutoff_freq());
|
||||
}
|
||||
|
||||
void PX4Accelerometer::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z)
|
||||
void PX4Accelerometer::update(hrt_abstime timestamp, float x, float y, float z)
|
||||
{
|
||||
sensor_accel_s &report = _sensor_accel_pub.get();
|
||||
report.timestamp = timestamp;
|
||||
|
||||
// Apply rotation (before scaling)
|
||||
float xraw_f = x;
|
||||
float yraw_f = y;
|
||||
float zraw_f = z;
|
||||
rotate_3f(_rotation, xraw_f, yraw_f, zraw_f);
|
||||
rotate_3f(_rotation, x, y, z);
|
||||
|
||||
const matrix::Vector3f raw{x, y, z};
|
||||
|
||||
// Apply range scale and the calibrating offset/scale
|
||||
const matrix::Vector3f val_calibrated{(((matrix::Vector3f{xraw_f, yraw_f, zraw_f} * report.scaling) - _calibration_offset).emult(_calibration_scale))};
|
||||
const matrix::Vector3f val_calibrated{(((raw * report.scaling) - _calibration_offset).emult(_calibration_scale))};
|
||||
|
||||
// Filtered values
|
||||
const matrix::Vector3f val_filtered{_filter.apply(val_calibrated)};
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
void set_sample_rate(unsigned rate);
|
||||
|
||||
void update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z);
|
||||
void update(hrt_abstime timestamp, float x, float y, float z);
|
||||
|
||||
void print_status();
|
||||
|
||||
|
||||
@@ -104,19 +104,18 @@ void PX4Gyroscope::set_sample_rate(unsigned rate)
|
||||
_filter.set_cutoff_frequency(_sample_rate, _filter.get_cutoff_freq());
|
||||
}
|
||||
|
||||
void PX4Gyroscope::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z)
|
||||
void PX4Gyroscope::update(hrt_abstime timestamp, float x, float y, float z)
|
||||
{
|
||||
sensor_gyro_s &report = _sensor_gyro_pub.get();
|
||||
report.timestamp = timestamp;
|
||||
|
||||
// Apply rotation (before scaling)
|
||||
float xraw_f = x;
|
||||
float yraw_f = y;
|
||||
float zraw_f = z;
|
||||
rotate_3f(_rotation, xraw_f, yraw_f, zraw_f);
|
||||
rotate_3f(_rotation, x, y, z);
|
||||
|
||||
const matrix::Vector3f raw{x, y, z};
|
||||
|
||||
// Apply range scale and the calibrating offset/scale
|
||||
const matrix::Vector3f val_calibrated{(((matrix::Vector3f{xraw_f, yraw_f, zraw_f} * report.scaling) - _calibration_offset).emult(_calibration_scale))};
|
||||
const matrix::Vector3f val_calibrated{(((raw * report.scaling) - _calibration_offset).emult(_calibration_scale))};
|
||||
|
||||
// Filtered values
|
||||
const matrix::Vector3f val_filtered{_filter.apply(val_calibrated)};
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
void set_sample_rate(unsigned rate);
|
||||
|
||||
void update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z);
|
||||
void update(hrt_abstime timestamp, float x, float y, float z);
|
||||
|
||||
void print_status();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user