sensor accel/gyro message cleanup

- split out integrated data into new standalone messages (sensor_accel_integrated and sensor_gyro_integrated)
 - publish sensor_gyro at full rate and remove sensor_gyro_control
 - limit sensor status publications to 10 Hz
 - remove unused accel/gyro raw ADC fields
 - add device IDs to sensor_bias and sensor_correction
    - vehicle_angular_velocity/vehicle_acceleration: check device ids before using bias and corrections
This commit is contained in:
Daniel Agar
2020-01-18 01:15:00 -05:00
committed by GitHub
parent 1d932f6ec9
commit bb465ca5b7
34 changed files with 696 additions and 756 deletions
@@ -54,8 +54,7 @@ PX4Magnetometer::~PX4Magnetometer()
}
}
int
PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
int PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
{
switch (cmd) {
case MAGIOCSSCALE: {
@@ -91,8 +90,7 @@ PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
}
}
void
PX4Magnetometer::set_device_type(uint8_t devtype)
void PX4Magnetometer::set_device_type(uint8_t devtype)
{
// current DeviceStructure
union device::Device::DeviceId device_id;
@@ -105,19 +103,15 @@ PX4Magnetometer::set_device_type(uint8_t devtype)
_sensor_mag_pub.get().device_id = device_id.devid;
}
void
PX4Magnetometer::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z)
void PX4Magnetometer::update(hrt_abstime timestamp_sample, float x, float y, float z)
{
sensor_mag_s &report = _sensor_mag_pub.get();
report.timestamp = timestamp;
report.timestamp = timestamp_sample;
// 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_f{xraw_f, yraw_f, zraw_f};
const matrix::Vector3f raw_f{x, y, z};
// Apply range scale and the calibrating offset/scale
const matrix::Vector3f val_calibrated{(((raw_f.emult(_sensitivity) * report.scaling) - _calibration_offset).emult(_calibration_scale))};
@@ -134,8 +128,7 @@ PX4Magnetometer::update(hrt_abstime timestamp, int16_t x, int16_t y, int16_t z)
_sensor_mag_pub.update();
}
void
PX4Magnetometer::print_status()
void PX4Magnetometer::print_status()
{
PX4_INFO(MAG_BASE_DEVICE_PATH " device instance: %d", _class_device_instance);
@@ -143,6 +136,4 @@ PX4Magnetometer::print_status()
(double)_calibration_scale(2));
PX4_INFO("calibration offset: %.5f %.5f %.5f", (double)_calibration_offset(0), (double)_calibration_offset(1),
(double)_calibration_offset(2));
print_message(_sensor_mag_pub.get());
}