sensor calibration: save temperature at calibration time for monitoring

This commit is contained in:
Daniel Agar
2021-08-15 11:19:24 -04:00
parent a76bcd3e01
commit ff39e27e2d
29 changed files with 295 additions and 41 deletions
+13 -5
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
* Copyright (c) 2020-2021 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -154,7 +154,7 @@ void Gyroscope::ParametersUpdate()
if (_calibration_index >= 0) {
// CAL_GYROx_ROT
int32_t rotation_value = GetCalibrationParam(SensorString(), "ROT", _calibration_index);
int32_t rotation_value = GetCalibrationParamInt32(SensorString(), "ROT", _calibration_index);
if (_external) {
if ((rotation_value >= ROTATION_MAX) || (rotation_value < 0)) {
@@ -179,7 +179,7 @@ void Gyroscope::ParametersUpdate()
}
// CAL_GYROx_PRIO
_priority = GetCalibrationParam(SensorString(), "PRIO", _calibration_index);
_priority = GetCalibrationParamInt32(SensorString(), "PRIO", _calibration_index);
if ((_priority < 0) || (_priority > 100)) {
// reset to default, -1 is the uninitialized parameter value
@@ -194,6 +194,9 @@ void Gyroscope::ParametersUpdate()
_priority = new_priority;
}
// CAL_GYROx_TEMP
set_temperature(GetCalibrationParamFloat(SensorString(), "TEMP", _calibration_index));
// CAL_GYROx_OFF{X,Y,Z}
set_offset(GetCalibrationParamsVector3f(SensorString(), "OFF", _calibration_index));
@@ -215,6 +218,7 @@ void Gyroscope::Reset()
_offset.zero();
_thermal_offset.zero();
_temperature = NAN;
_priority = _external ? DEFAULT_EXTERNAL_PRIORITY : DEFAULT_PRIORITY;
@@ -239,6 +243,8 @@ bool Gyroscope::ParametersSave()
success &= SetCalibrationParam(SensorString(), "ROT", _calibration_index, -1);
}
success &= SetCalibrationParam(SensorString(), "TEMP", _calibration_index, _temperature);
return success;
}
@@ -247,8 +253,10 @@ bool Gyroscope::ParametersSave()
void Gyroscope::PrintStatus()
{
PX4_INFO("%s %" PRIu32 " EN: %d, offset: [%.4f %.4f %.4f]", SensorString(), device_id(), enabled(),
(double)_offset(0), (double)_offset(1), (double)_offset(2));
PX4_INFO("%s %" PRIu32 " EN: %d, offset: [%.4f %.4f %.4f], %.1f degC",
SensorString(), device_id(), enabled(),
(double)_offset(0), (double)_offset(1), (double)_offset(2),
(double)_temperature);
if (_thermal_offset.norm() > 0.f) {
PX4_INFO("%s %" PRIu32 " temperature offset: [%.4f %.4f %.4f]", SensorString(), _device_id,