sensors angular velocity and acceleration publishers fix auto usage

- if the primary gyro or accel change this will cause the callback to be registered multiple times
This commit is contained in:
Daniel Agar 2019-08-08 11:36:27 -04:00 committed by GitHub
parent c66fc85630
commit c6aaa606da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ VehicleAcceleration::Stop()
Deinit();
// clear all registered callbacks
for (auto sub : _sensor_sub) {
for (auto &sub : _sensor_sub) {
sub.unregister_callback();
}
@ -131,7 +131,7 @@ VehicleAcceleration::SensorCorrectionsUpdate(bool force)
if ((_selected_sensor != corrections.selected_accel_instance) || force) {
if (corrections.selected_accel_instance < MAX_SENSOR_COUNT) {
// clear all registered callbacks
for (auto sub : _sensor_sub) {
for (auto &sub : _sensor_sub) {
sub.unregister_callback();
}

View File

@ -80,7 +80,7 @@ VehicleAngularVelocity::Stop()
Deinit();
// clear all registered callbacks
for (auto sub : _sensor_sub) {
for (auto &sub : _sensor_sub) {
sub.unregister_callback();
}
@ -131,7 +131,7 @@ VehicleAngularVelocity::SensorCorrectionsUpdate(bool force)
if ((_selected_sensor != corrections.selected_gyro_instance) || force) {
if (corrections.selected_gyro_instance < MAX_SENSOR_COUNT) {
// clear all registered callbacks
for (auto sub : _sensor_sub) {
for (auto &sub : _sensor_sub) {
sub.unregister_callback();
}