|
bitsim
Model, simulate, estimate and control robots in C++
|
Base class for inertial measurement units with a three axis accelerometer and a three axis gyroscope, such as an MPU-6050. More...
#include <imu_backend_base.h>


Public Types | |
| using | Position = std::array<real_t, 3> |
Public Member Functions | |
| const Position & | position () const noexcept |
| void | set_position (const Position &position) noexcept |
| std::string | sensor_units () const override |
| virtual void | load (const nlohmann::json &j) |
| Read the settings of the IMU from its section of a robot or sensor file, all optional: | |
| void | load_from_json (const std::string &filename) override |
| Read the settings from a JSON file, see load(). | |
| void | add_visual_shape (const std::unordered_map< std::string, std::any > &shape_properties) override |
| Draw the IMU as a small box on the body. The properties are x_length, y_length, z_length (float_t) and chrono::ChColor. | |
| Public Member Functions inherited from bitsim::sensors::backends::SensorBackendBase | |
| virtual | ~SensorBackendBase ()=default |
| Destructor. | |
| real_t | sampling_period () const noexcept |
| Returns the sampling period of the sensor. | |
| void | set_sampling_period (real_t period) |
| Set the sampling period of the backend. | |
| virtual std::vector< real_t > | read_values ()=0 |
| Read the sensor value. | |
| uint_t | n_read_values () const noexcept |
| std::string | backend_type_str () const noexcept |
| Return a string that specifies the type of the backend. | |
| void | set_chrono_body (std::shared_ptr< chrono::ChBody > body) |
| Set the pointer to the body that this sensor is attached. | |
Static Public Member Functions | |
| static std::shared_ptr< IMUBackendBase > | create (const std::string &backend_type) |
| Create a backend by the name a robot file gives it. | |
Protected Member Functions | |
| IMUBackendBase (const std::string &backend_type) | |
| Protected Member Functions inherited from bitsim::sensors::backends::SensorBackendBase | |
| SensorBackendBase (const std::string &backend_type) | |
| Constructor. | |
| void | set_n_read_values (uint_t n) noexcept |
| Set how many values the implementation returns. | |
Additional Inherited Members | |
| Protected Attributes inherited from bitsim::sensors::backends::SensorBackendBase | |
| std::shared_ptr< chrono::ChBody > | body_ {nullptr} |
| The body on which the sensor sits. | |
Base class for inertial measurement units with a three axis accelerometer and a three axis gyroscope, such as an MPU-6050.
A backend reads six values, along the axes of the body the IMU is on:
| using bitsim::sensors::backends::IMUBackendBase::Position = std::array<real_t, 3> |
|
inlineexplicitprotected |
|
overridevirtual |
Draw the IMU as a small box on the body. The properties are x_length, y_length, z_length (float_t) and chrono::ChColor.
Implements bitsim::sensors::backends::SensorBackendBase.
|
static |
Create a backend by the name a robot file gives it.
| backend_type | SIMULATION (or CHRONO) for an IMU simulated with Chrono, MQTT for a real one on a board |
| std::runtime_error | If the type is unknown, or bitsim was built without what the backend needs |
|
virtual |
Read the settings of the IMU from its section of a robot or sensor file, all optional:
Backends read their own keys as well
Reimplemented in bitsim::sensors::backends::CHRONO_IMUBackend, and bitsim::sensors::backends::MQTT_IMUBackend.
|
overridevirtual |
Read the settings from a JSON file, see load().
Implements bitsim::sensors::backends::SensorBackendBase.
|
inlinenoexcept |
|
inlineoverridevirtual |
Reimplemented from bitsim::sensors::backends::SensorBackendBase.
|
inlinenoexcept |