bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
ekf_sensor_fusion::IMUSensor Class Referencefinal

An inertial measurement unit: a three axis accelerometer and a three axis gyroscope, along the axes of the body it is on. More...

#include <imu_sensor.h>

Inheritance diagram for ekf_sensor_fusion::IMUSensor:
Collaboration diagram for ekf_sensor_fusion::IMUSensor:

Public Member Functions

 IMUSensor (std::shared_ptr< backends::IMUBackendBase > backend, const std::string &name=consts::INVALID_STR)
void init () override
 Enable the sensor, reading zeros until the first read.
const std::vector< real_t > & read_values () override
 Read the backend, if the sensor is enabled.
std::string backend_type_str () const override
std::string sensor_units () const override
std::shared_ptr< backends::SensorBackendBase > backend_ptr () const override
std::shared_ptr< backends::IMUBackendBase > imu_backend () const noexcept
std::array< real_t, 3 > acceleration () const
std::array< real_t, 3 > angular_velocity () const
Public Member Functions inherited from bitsim::sensors::SensorBase
virtual ~SensorBase ()=default
 Destructor.
bool is_enabled () const noexcept
 Returns true if the sensor is enabled.
void enable () noexcept
 Set the is_enabled_ flag to true.
void disable () noexcept
 Disable the sensor.
const std::vector< real_t > & last_read_values () const noexcept
std::string sensor_name () const noexcept
void set_sensor_name (const std::string &sensor_name) noexcept
 Set the sensor name.
std::string sensor_type () const noexcept

Static Public Member Functions

static std::shared_ptr< IMUSensor > create (const std::string &backend_type, const std::string &name)
 A sensor with a new backend of the given type, see backends::IMUBackendBase::create.

Static Public Attributes

static const std::string SENSOR_TYPE = "IMUSensor"

Additional Inherited Members

Protected Member Functions inherited from bitsim::sensors::SensorBase
 SensorBase (const std::string &sensor_type, const std::string &sensor_name=bitsim::consts::INVALID_STR)
Protected Attributes inherited from bitsim::sensors::SensorBase
std::vector< real_t > values_
 The values last read by the sensor.
std::shared_ptr< backends::SensorBackendBase > backend_ptr_
 Pointer to backend tha actually handles the sensor.

Detailed Description

An inertial measurement unit: a three axis accelerometer and a three axis gyroscope, along the axes of the body it is on.

read_values() gives six values: the specific force [m/s^2], then the angular velocity [rad/s]; see backends::IMUBackendBase. acceleration() and angular_velocity() pick them out of the last read. backends::CHRONO_IMUBackend simulates the IMU, and backends::MQTT_IMUBackend reads a real one on a board.

Constructor & Destructor Documentation

◆ IMUSensor()

bitsim::sensors::IMUSensor::IMUSensor ( std::shared_ptr< backends::IMUBackendBase > backend,
const std::string & name = consts::INVALID_STR )
explicit

Member Function Documentation

◆ acceleration()

Returns
The specific force at the last read [m/s^2]

◆ angular_velocity()

Returns
The angular velocity at the last read [rad/s]

◆ backend_ptr()

std::shared_ptr< backends::SensorBackendBase > bitsim::sensors::IMUSensor::backend_ptr ( ) const
inlineoverridevirtual

Reimplemented from bitsim::sensors::SensorBase.

◆ backend_type_str()

std::string bitsim::sensors::IMUSensor::backend_type_str ( ) const
inlineoverridevirtual
Returns
An instance of std::string of the backend type. If the implementation does not use a specific backend returns bitsim::consts::INVALID_STR

Implements bitsim::sensors::SensorBase.

◆ create()

std::shared_ptr< IMUSensor > bitsim::sensors::IMUSensor::create ( const std::string & backend_type,
const std::string & name )
static

A sensor with a new backend of the given type, see backends::IMUBackendBase::create.

◆ imu_backend()

std::shared_ptr< backends::IMUBackendBase > bitsim::sensors::IMUSensor::imu_backend ( ) const
inlinenoexcept

◆ init()

void bitsim::sensors::IMUSensor::init ( )
overridevirtual

Enable the sensor, reading zeros until the first read.

Implements bitsim::sensors::SensorBase.

◆ read_values()

const std::vector< real_t > & bitsim::sensors::IMUSensor::read_values ( )
overridevirtual

Read the backend, if the sensor is enabled.

Implements bitsim::sensors::SensorBase.

◆ sensor_units()

std::string bitsim::sensors::IMUSensor::sensor_units ( ) const
inlineoverridevirtual
Returns
An instance of std::string indicating the units the sensor is using. If units have not been established this returns bitsim::consts::INVALID_STR

Implements bitsim::sensors::SensorBase.

Member Data Documentation

◆ SENSOR_TYPE

const std::string bitsim::sensors::IMUSensor::SENSOR_TYPE = "IMUSensor"
static

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