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

#include <VehicleAcceleration.hpp>

Inheritance diagram for VehicleAcceleration:
Collaboration diagram for VehicleAcceleration:

Public Member Functions

 VehicleAcceleration ()
 
virtual ~VehicleAcceleration ()
 
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...
 
matrix::Dcmf _board_rotation
 rotation matrix for the orientation that the board is mounted More...
 
matrix::Vector3f _offset
 
matrix::Vector3f _scale
 
matrix::Vector3f _bias
 
uint8_t _selected_sensor {0}
 

Static Private Attributes

static constexpr int MAX_SENSOR_COUNT = 3
 

Detailed Description

Definition at line 54 of file VehicleAcceleration.hpp.

Constructor & Destructor Documentation

◆ VehicleAcceleration()

VehicleAcceleration::VehicleAcceleration ( )

Definition at line 41 of file VehicleAcceleration.cpp.

◆ ~VehicleAcceleration()

VehicleAcceleration::~VehicleAcceleration ( )
virtual

Definition at line 47 of file VehicleAcceleration.cpp.

References Stop().

Here is the call graph for this function:

Member Function Documentation

◆ ParametersUpdate()

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

Definition at line 147 of file VehicleAcceleration.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 VehicleAcceleration::PrintStatus ( )

Definition at line 205 of file VehicleAcceleration.cpp.

References _selected_sensor.

Referenced by Sensors::print_status().

Here is the caller graph for this function:

◆ Run()

void VehicleAcceleration::Run ( )
override

Definition at line 171 of file VehicleAcceleration.cpp.

References _bias, _board_rotation, _offset, _scale, _selected_sensor, _sensor_sub, uORB::SubscriptionInterval::copy(), hrt_absolute_time(), ParametersUpdate(), SensorBiasUpdate(), SensorCorrectionsUpdate(), sensor_accel_s::timestamp, vehicle_acceleration_s::timestamp_sample, sensor_accel_s::x, sensor_accel_s::y, and sensor_accel_s::z.

Here is the call graph for this function:

◆ SensorBiasUpdate()

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

Definition at line 84 of file VehicleAcceleration.cpp.

References _bias, _sensor_bias_sub, sensor_bias_s::accel_bias, uORB::Subscription::copy(), 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 VehicleAcceleration::SensorCorrectionsUpdate ( bool  force = false)
private

Definition at line 97 of file VehicleAcceleration.cpp.

References _offset, _scale, _selected_sensor, _sensor_correction_sub, _sensor_sub, uORB::Subscription::copy(), MAX_SENSOR_COUNT, 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 VehicleAcceleration::Start ( )

Definition at line 53 of file VehicleAcceleration.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 VehicleAcceleration::Stop ( )

Definition at line 71 of file VehicleAcceleration.cpp.

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

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

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

Member Data Documentation

◆ _bias

matrix::Vector3f VehicleAcceleration::_bias
private

Definition at line 101 of file VehicleAcceleration.hpp.

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

◆ _board_rotation

matrix::Dcmf VehicleAcceleration::_board_rotation
private

rotation matrix for the orientation that the board is mounted

Definition at line 97 of file VehicleAcceleration.hpp.

Referenced by ParametersUpdate(), and Run().

◆ _offset

matrix::Vector3f VehicleAcceleration::_offset
private

Definition at line 99 of file VehicleAcceleration.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 VehicleAcceleration::_params_sub {ORB_ID(parameter_update)}
private

parameter updates subscription

Definition at line 86 of file VehicleAcceleration.hpp.

Referenced by ParametersUpdate().

◆ _scale

matrix::Vector3f VehicleAcceleration::_scale
private

Definition at line 100 of file VehicleAcceleration.hpp.

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

◆ _selected_sensor

uint8_t VehicleAcceleration::_selected_sensor {0}
private

Definition at line 103 of file VehicleAcceleration.hpp.

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

◆ _sensor_bias_sub

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

sensor in-run bias correction subscription

Definition at line 87 of file VehicleAcceleration.hpp.

Referenced by SensorBiasUpdate().

◆ _sensor_correction_sub

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

sensor thermal correction subscription

Definition at line 88 of file VehicleAcceleration.hpp.

Referenced by SensorCorrectionsUpdate().

◆ _sensor_selection_sub

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

selected primary sensor subscription

Definition at line 90 of file VehicleAcceleration.hpp.

Referenced by Start(), and Stop().

◆ _sensor_sub

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

sensor data subscription

Definition at line 91 of file VehicleAcceleration.hpp.

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

◆ MAX_SENSOR_COUNT

constexpr int VehicleAcceleration::MAX_SENSOR_COUNT = 3
staticprivate

Definition at line 74 of file VehicleAcceleration.hpp.

Referenced by SensorCorrectionsUpdate().


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