Browse Source

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
sbg
Daniel Agar 6 years ago committed by GitHub
parent
commit
c6aaa606da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/modules/sensors/vehicle_acceleration/VehicleAcceleration.cpp
  2. 4
      src/modules/sensors/vehicle_angular_velocity/VehicleAngularVelocity.cpp

4
src/modules/sensors/vehicle_acceleration/VehicleAcceleration.cpp

@ -80,7 +80,7 @@ VehicleAcceleration::Stop() @@ -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) @@ -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();
}

4
src/modules/sensors/vehicle_angular_velocity/VehicleAngularVelocity.cpp

@ -80,7 +80,7 @@ VehicleAngularVelocity::Stop() @@ -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) @@ -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();
}

Loading…
Cancel
Save