36 #include <px4_platform_common/log.h> 42 ModuleParams(nullptr),
43 WorkItem(MODULE_NAME,
px4::wq_configurations::rate_ctrl)
77 sub.unregisterCallback();
139 sub.unregisterCallback();
143 sub.unregisterCallback();
146 const int sensor_new = corrections.selected_gyro_instance;
152 _sensor_control_sub[i].copy(&report);
155 if (_sensor_control_sub[i].registerCallback()) {
156 PX4_DEBUG(
"selected sensor (control) changed %d -> %d",
_selected_sensor, i);
172 if (_sensor_sub[sensor_new].registerCallback()) {
173 PX4_DEBUG(
"selected sensor changed %d -> %d",
_selected_sensor, sensor_new);
235 rates.copyTo(angular_velocity.
xyz);
238 _vehicle_angular_velocity_pub.publish(angular_velocity);
251 const Vector3f val{sensor_data.
x, sensor_data.
y, sensor_data.
z};
264 rates.copyTo(angular_velocity.
xyz);
267 _vehicle_angular_velocity_pub.publish(angular_velocity);
virtual ~VehicleAngularVelocity()
bool copy(void *dst)
Copy the struct.
uORB::SubscriptionCallbackWorkItem _sensor_selection_sub
selected primary sensor subscription
void SensorBiasUpdate(bool force=false)
uORB::SubscriptionCallbackWorkItem _sensor_control_sub[MAX_SENSOR_COUNT]
sensor control data subscription
bool updated()
Check if there is a new update.
uint64_t timestamp_sample
matrix::Dcmf _board_rotation
rotation matrix for the orientation that the board is mounted
void ParametersUpdate(bool force=false)
uORB::Subscription _sensor_bias_sub
sensor in-run bias correction subscription
uint32_t _selected_sensor_device_id
Rotation
Enum for board and external compass rotations.
static constexpr int MAX_SENSOR_COUNT
constexpr T radians(T degrees)
bool _sensor_control_available
bool updated()
Check if there is a new update.
bool SensorCorrectionsUpdate(bool force=false)
DEFINE_PARAMETERS((ParamInt< px4::params::SENS_BOARD_ROT >) _param_sens_board_rot,(ParamFloat< px4::params::SENS_BOARD_X_OFF >) _param_sens_board_x_off,(ParamFloat< px4::params::SENS_BOARD_Y_OFF >) _param_sens_board_y_off,(ParamFloat< px4::params::SENS_BOARD_Z_OFF >) _param_sens_board_z_off) uORB uORB::Subscription _params_sub
parameter updates subscription
uORB::SubscriptionCallbackWorkItem _sensor_sub[MAX_SENSOR_COUNT]
sensor data subscription
uint64_t timestamp_sample
uORB::Subscription _sensor_correction_sub
sensor thermal correction subscription
void unregisterCallback()
__EXPORT matrix::Dcmf get_rot_matrix(enum Rotation rot)
Get the rotation matrix.
bool copy(void *dst)
Copy the struct.
uint8_t _selected_sensor_control
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).