mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
vehicle_angular_velocity: sensor_selection callback
- needed to update the main sensor_gyro subscription if the primary stops responding
This commit is contained in:
@@ -68,7 +68,8 @@ VehicleAngularVelocity::Start()
|
|||||||
ParametersUpdate(true);
|
ParametersUpdate(true);
|
||||||
SensorBiasUpdate(true);
|
SensorBiasUpdate(true);
|
||||||
|
|
||||||
_sensor_correction_sub.register_callback();
|
// needed to change the active sensor if the primary stops updating
|
||||||
|
_sensor_selection_sub.register_callback();
|
||||||
|
|
||||||
return SensorCorrectionsUpdate(true);
|
return SensorCorrectionsUpdate(true);
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ VehicleAngularVelocity::Stop()
|
|||||||
sub.unregister_callback();
|
sub.unregister_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
_sensor_correction_sub.unregister_callback();
|
_sensor_selection_sub.unregister_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include <uORB/topics/sensor_bias.h>
|
#include <uORB/topics/sensor_bias.h>
|
||||||
#include <uORB/topics/sensor_correction.h>
|
#include <uORB/topics/sensor_correction.h>
|
||||||
#include <uORB/topics/sensor_gyro.h>
|
#include <uORB/topics/sensor_gyro.h>
|
||||||
|
#include <uORB/topics/sensor_selection.h>
|
||||||
#include <uORB/topics/vehicle_angular_velocity.h>
|
#include <uORB/topics/vehicle_angular_velocity.h>
|
||||||
|
|
||||||
#define MAX_GYRO_COUNT 3
|
#define MAX_GYRO_COUNT 3
|
||||||
@@ -87,8 +88,9 @@ private:
|
|||||||
|
|
||||||
uORB::Subscription _params_sub{ORB_ID(parameter_update)}; /**< parameter updates subscription */
|
uORB::Subscription _params_sub{ORB_ID(parameter_update)}; /**< parameter updates subscription */
|
||||||
uORB::Subscription _sensor_bias_sub{ORB_ID(sensor_bias)}; /**< sensor in-run bias correction subscription */
|
uORB::Subscription _sensor_bias_sub{ORB_ID(sensor_bias)}; /**< sensor in-run bias correction subscription */
|
||||||
|
uORB::Subscription _sensor_correction_sub{ORB_ID(sensor_correction)}; /**< sensor thermal correction subscription */
|
||||||
|
|
||||||
uORB::SubscriptionCallbackWorkItem _sensor_correction_sub{this, ORB_ID(sensor_correction)}; /**< sensor thermal correction subscription */
|
uORB::SubscriptionCallbackWorkItem _sensor_selection_sub{this, ORB_ID(sensor_selection)}; /**< selected primary sensor subscription */
|
||||||
uORB::SubscriptionCallbackWorkItem _sensor_gyro_sub[MAX_GYRO_COUNT] { /**< gyro data subscription */
|
uORB::SubscriptionCallbackWorkItem _sensor_gyro_sub[MAX_GYRO_COUNT] { /**< gyro data subscription */
|
||||||
{this, ORB_ID(sensor_gyro), 0},
|
{this, ORB_ID(sensor_gyro), 0},
|
||||||
{this, ORB_ID(sensor_gyro), 1},
|
{this, ORB_ID(sensor_gyro), 1},
|
||||||
|
|||||||
Reference in New Issue
Block a user