mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 10:03:35 +08:00
Use accel of the same instance or primary baro for gyro instances that do not have valid temperature readings in temperature calibration data, use primary baro for magnetometers without valid temperature.
This commit is contained in:
@@ -215,10 +215,12 @@ void VehicleAcceleration::Run()
|
||||
// update corrections first to set _selected_sensor
|
||||
bool selection_updated = SensorSelectionUpdate();
|
||||
|
||||
_calibration.SensorCorrectionsUpdate(selection_updated);
|
||||
SensorBiasUpdate(selection_updated);
|
||||
ParametersUpdate();
|
||||
|
||||
_calibration.SensorCorrectionsUpdate(selection_updated);
|
||||
|
||||
SensorBiasUpdate(selection_updated);
|
||||
|
||||
// require valid sensor sample rate to run
|
||||
if (!PX4_ISFINITE(_filter_sample_rate)) {
|
||||
CheckAndUpdateFilters();
|
||||
|
||||
@@ -790,6 +790,8 @@ void VehicleAngularVelocity::Run()
|
||||
|
||||
const hrt_abstime time_now_us = hrt_absolute_time();
|
||||
|
||||
ParametersUpdate();
|
||||
|
||||
// update corrections first to set _selected_sensor
|
||||
const bool selection_updated = SensorSelectionUpdate(time_now_us);
|
||||
|
||||
@@ -801,9 +803,8 @@ void VehicleAngularVelocity::Run()
|
||||
}
|
||||
}
|
||||
|
||||
ParametersUpdate();
|
||||
|
||||
_calibration.SensorCorrectionsUpdate(selection_updated);
|
||||
|
||||
SensorBiasUpdate(selection_updated);
|
||||
|
||||
if (_reset_filters) {
|
||||
|
||||
@@ -369,8 +369,8 @@ void VehicleMagnetometer::UpdatePowerCompensation()
|
||||
if (_vehicle_thrust_setpoint_0_sub.update(&vehicle_thrust_setpoint)) {
|
||||
const matrix::Vector3f thrust_setpoint = matrix::Vector3f(vehicle_thrust_setpoint.xyz);
|
||||
|
||||
for (auto &cal : _calibration) {
|
||||
cal.UpdatePower(thrust_setpoint.length());
|
||||
for (int i = 0; i < MAX_SENSOR_COUNT; i++) {
|
||||
_calibration[i].UpdatePower(thrust_setpoint.length());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,14 +382,14 @@ void VehicleMagnetometer::UpdatePowerCompensation()
|
||||
if (_battery_status_sub.update(&bat_stat)) {
|
||||
float power = bat_stat.current_a * 0.001f; // current in [kA]
|
||||
|
||||
for (auto &cal : _calibration) {
|
||||
cal.UpdatePower(power);
|
||||
for (int i = 0; i < MAX_SENSOR_COUNT; i++) {
|
||||
_calibration[i].UpdatePower(power);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (auto &cal : _calibration) {
|
||||
cal.UpdatePower(0.f);
|
||||
for (int i = 0; i < MAX_SENSOR_COUNT; i++) {
|
||||
_calibration[i].UpdatePower(0.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,6 +412,10 @@ void VehicleMagnetometer::Run()
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_SENSOR_COUNT; i++) {
|
||||
_calibration[i].SensorCorrectionsUpdate();
|
||||
}
|
||||
|
||||
UpdatePowerCompensation();
|
||||
|
||||
UpdateMagBiasEstimate();
|
||||
|
||||
@@ -146,6 +146,7 @@ private:
|
||||
Current_inst0,
|
||||
Current_inst1
|
||||
};
|
||||
|
||||
MagCompensationType _mag_comp_type{MagCompensationType::Disabled};
|
||||
|
||||
perf_counter_t _cycle_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")};
|
||||
@@ -158,6 +159,7 @@ private:
|
||||
|
||||
uint64_t _timestamp_sample_sum[MAX_SENSOR_COUNT] {};
|
||||
matrix::Vector3f _data_sum[MAX_SENSOR_COUNT] {};
|
||||
|
||||
int _data_sum_count[MAX_SENSOR_COUNT] {};
|
||||
hrt_abstime _last_publication_timestamp[MAX_SENSOR_COUNT] {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user