PX4 Firmware
PX4 Autopilot Software http://px4.io
VehicleAngularVelocity Class Reference

#include <VehicleAngularVelocity.hpp>

Inheritance diagram for VehicleAngularVelocity:
Collaboration diagram for VehicleAngularVelocity:

Public Member Functions

 VehicleAngularVelocity ()
 
virtual ~VehicleAngularVelocity ()
 
void Run () override
 
bool Start ()
 
void Stop ()
 
void PrintStatus ()
 

Private Member Functions

void ParametersUpdate (bool force=false)
 
void SensorBiasUpdate (bool force=false)
 
bool SensorCorrectionsUpdate (bool force=false)
 

Private Attributes

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 {ORB_ID(parameter_update)}
 parameter updates subscription More...
 
uORB::Subscription _sensor_bias_sub {ORB_ID(sensor_bias)}
 sensor in-run bias correction subscription More...
 
uORB::Subscription _sensor_correction_sub {ORB_ID(sensor_correction)}
 sensor thermal correction subscription More...
 
uORB::SubscriptionCallbackWorkItem _sensor_selection_sub {this, ORB_ID(sensor_selection)}
 selected primary sensor subscription More...
 
uORB::SubscriptionCallbackWorkItem _sensor_sub [MAX_SENSOR_COUNT]
 sensor data subscription More...
 
uORB::SubscriptionCallbackWorkItem _sensor_control_sub [MAX_SENSOR_COUNT]
 sensor control data subscription More...
 
matrix::Dcmf _board_rotation
 rotation matrix for the orientation that the board is mounted More...
 
matrix::Vector3f _offset
 
matrix::Vector3f _scale
 
matrix::Vector3f _bias
 
uint32_t _selected_sensor_device_id {0}
 
uint8_t _selected_sensor {0}
 
uint8_t _selected_sensor_control {0}
 
bool _sensor_control_available {false}
 

Static Private Attributes

static constexpr int MAX_SENSOR_COUNT = 3
 

Detailed Description

Definition at line 55 of file VehicleAngularVelocity.hpp.

Constructor & Destructor Documentation

◆ VehicleAngularVelocity()

VehicleAngularVelocity::VehicleAngularVelocity ( )

Definition at line 41 of file VehicleAngularVelocity.cpp.

◆ ~VehicleAngularVelocity()

VehicleAngularVelocity::~VehicleAngularVelocity ( )
virtual

Definition at line 47 of file VehicleAngularVelocity.cpp.

References Stop().

Here is the call graph for this function:

Member Function Documentation

◆ ParametersUpdate()

void VehicleAngularVelocity::ParametersUpdate ( bool  force = false)
private

Definition at line 186 of file VehicleAngularVelocity.cpp.

References _board_rotation, _params_sub, uORB::Subscription::copy(), get_rot_matrix(), math::radians(), and uORB::Subscription::updated().

Referenced by Run(), and Start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintStatus()

void VehicleAngularVelocity::PrintStatus ( )

Definition at line 273 of file VehicleAngularVelocity.cpp.

References _selected_sensor, _selected_sensor_control, and _selected_sensor_device_id.

Referenced by Sensors::print_status().

Here is the caller graph for this function:

◆ Run()

◆ SensorBiasUpdate()

void VehicleAngularVelocity::SensorBiasUpdate ( bool  force = false)
private

Definition at line 84 of file VehicleAngularVelocity.cpp.

References _bias, _sensor_bias_sub, uORB::Subscription::copy(), sensor_bias_s::gyro_bias, and uORB::Subscription::updated().

Referenced by Run(), and Start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SensorCorrectionsUpdate()

bool VehicleAngularVelocity::SensorCorrectionsUpdate ( bool  force = false)
private

Definition at line 97 of file VehicleAngularVelocity.cpp.

References _offset, _scale, _selected_sensor, _selected_sensor_control, _selected_sensor_device_id, _sensor_control_available, _sensor_control_sub, _sensor_correction_sub, _sensor_selection_sub, _sensor_sub, uORB::SubscriptionInterval::copy(), uORB::Subscription::copy(), sensor_selection_s::gyro_device_id, MAX_SENSOR_COUNT, uORB::SubscriptionInterval::updated(), and uORB::Subscription::updated().

Referenced by Run(), and Start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Start()

bool VehicleAngularVelocity::Start ( )

Definition at line 53 of file VehicleAngularVelocity.cpp.

References _bias, _offset, _scale, _sensor_selection_sub, ParametersUpdate(), uORB::SubscriptionCallback::registerCallback(), SensorBiasUpdate(), SensorCorrectionsUpdate(), and matrix::Matrix< Type, M, N >::zero().

Referenced by Sensors::Sensors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stop()

void VehicleAngularVelocity::Stop ( )

Definition at line 71 of file VehicleAngularVelocity.cpp.

References _sensor_selection_sub, _sensor_sub, and uORB::SubscriptionCallback::unregisterCallback().

Referenced by Sensors::~Sensors(), and ~VehicleAngularVelocity().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _bias

matrix::Vector3f VehicleAngularVelocity::_bias
private

Definition at line 109 of file VehicleAngularVelocity.hpp.

Referenced by Run(), SensorBiasUpdate(), and Start().

◆ _board_rotation

matrix::Dcmf VehicleAngularVelocity::_board_rotation
private

rotation matrix for the orientation that the board is mounted

Definition at line 105 of file VehicleAngularVelocity.hpp.

Referenced by ParametersUpdate(), and Run().

◆ _offset

matrix::Vector3f VehicleAngularVelocity::_offset
private

Definition at line 107 of file VehicleAngularVelocity.hpp.

Referenced by Run(), SensorCorrectionsUpdate(), and Start().

◆ _params_sub

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 VehicleAngularVelocity::_params_sub {ORB_ID(parameter_update)}
private

parameter updates subscription

Definition at line 87 of file VehicleAngularVelocity.hpp.

Referenced by ParametersUpdate().

◆ _scale

matrix::Vector3f VehicleAngularVelocity::_scale
private

Definition at line 108 of file VehicleAngularVelocity.hpp.

Referenced by Run(), SensorCorrectionsUpdate(), and Start().

◆ _selected_sensor

uint8_t VehicleAngularVelocity::_selected_sensor {0}
private

Definition at line 112 of file VehicleAngularVelocity.hpp.

Referenced by PrintStatus(), Run(), and SensorCorrectionsUpdate().

◆ _selected_sensor_control

uint8_t VehicleAngularVelocity::_selected_sensor_control {0}
private

Definition at line 113 of file VehicleAngularVelocity.hpp.

Referenced by PrintStatus(), and SensorCorrectionsUpdate().

◆ _selected_sensor_device_id

uint32_t VehicleAngularVelocity::_selected_sensor_device_id {0}
private

Definition at line 111 of file VehicleAngularVelocity.hpp.

Referenced by PrintStatus(), and SensorCorrectionsUpdate().

◆ _sensor_bias_sub

uORB::Subscription VehicleAngularVelocity::_sensor_bias_sub {ORB_ID(sensor_bias)}
private

sensor in-run bias correction subscription

Definition at line 88 of file VehicleAngularVelocity.hpp.

Referenced by SensorBiasUpdate().

◆ _sensor_control_available

bool VehicleAngularVelocity::_sensor_control_available {false}
private

Definition at line 114 of file VehicleAngularVelocity.hpp.

Referenced by Run(), and SensorCorrectionsUpdate().

◆ _sensor_control_sub

uORB::SubscriptionCallbackWorkItem VehicleAngularVelocity::_sensor_control_sub[MAX_SENSOR_COUNT]
private
Initial value:
{
{this, ORB_ID(sensor_gyro_control), 0},
{this, ORB_ID(sensor_gyro_control), 1},
{this, ORB_ID(sensor_gyro_control), 2}
}

sensor control data subscription

Definition at line 99 of file VehicleAngularVelocity.hpp.

Referenced by Run(), and SensorCorrectionsUpdate().

◆ _sensor_correction_sub

uORB::Subscription VehicleAngularVelocity::_sensor_correction_sub {ORB_ID(sensor_correction)}
private

sensor thermal correction subscription

Definition at line 89 of file VehicleAngularVelocity.hpp.

Referenced by SensorCorrectionsUpdate().

◆ _sensor_selection_sub

uORB::SubscriptionCallbackWorkItem VehicleAngularVelocity::_sensor_selection_sub {this, ORB_ID(sensor_selection)}
private

selected primary sensor subscription

Definition at line 91 of file VehicleAngularVelocity.hpp.

Referenced by SensorCorrectionsUpdate(), Start(), and Stop().

◆ _sensor_sub

uORB::SubscriptionCallbackWorkItem VehicleAngularVelocity::_sensor_sub[MAX_SENSOR_COUNT]
private
Initial value:
{
{this, ORB_ID(sensor_gyro), 0},
{this, ORB_ID(sensor_gyro), 1},
{this, ORB_ID(sensor_gyro), 2}
}

sensor data subscription

Definition at line 93 of file VehicleAngularVelocity.hpp.

Referenced by Run(), SensorCorrectionsUpdate(), and Stop().

◆ MAX_SENSOR_COUNT

constexpr int VehicleAngularVelocity::MAX_SENSOR_COUNT = 3
staticprivate

Definition at line 75 of file VehicleAngularVelocity.hpp.

Referenced by SensorCorrectionsUpdate().


The documentation for this class was generated from the following files: