|
bitsim
Model, simulate, estimate and control robots in C++
|
A simulated IMU on a Chrono body. More...
#include <chrono_imu_backend.h>


Classes | |
| struct | Errors |
| How the IMU errs. More... | |
Public Member Functions | |
| CHRONO_IMUBackend () | |
| Constructor. Attach a body with set_chrono_body() before reading. | |
| CHRONO_IMUBackend (std::shared_ptr< chrono::ChBody > body) | |
| const Errors & | errors () const noexcept |
| void | set_errors (const Errors &errors) |
| void | load (const nlohmann::json &j) override |
| Read the settings, see IMUBackendBase::load(), and the errors, see Errors::read(). | |
| std::vector< real_t > | read_values () override |
| Read the accelerometer and the gyroscope. | |
| Public Member Functions inherited from bitsim::sensors::backends::IMUBackendBase | |
| const Position & | position () const noexcept |
| void | set_position (const Position &position) noexcept |
| std::string | sensor_units () const override |
| 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. | |
| 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 Attributes | |
| static const std::string | BACKEND_TYPE = "SIMULATION" |
Additional Inherited Members | |
| Public Types inherited from bitsim::sensors::backends::IMUBackendBase | |
| using | Position = std::array<real_t, 3> |
| Static Public Member Functions inherited from bitsim::sensors::backends::IMUBackendBase | |
| 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 inherited from bitsim::sensors::backends::IMUBackendBase | |
| 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. | |
| Protected Attributes inherited from bitsim::sensors::backends::SensorBackendBase | |
| std::shared_ptr< chrono::ChBody > | body_ {nullptr} |
| The body on which the sensor sits. | |
A simulated IMU on a Chrono body.
The accelerometer reads the acceleration of the point where the IMU sits, minus the gravity of the system, and the gyroscope the angular velocity of the body, both along the body's axes.
A real gyroscope has a bias, a small rate it reads when it is still, and noise. Integrated over time, the bias makes a heading drift by bias x time. The backend adds both, if they are set: a fixed gyro_bias and normal noise of standard deviation gyro_noise and accel_noise on every reading. The noise comes from a generator with a fixed seed, so a simulation repeats.
| bitsim::sensors::backends::CHRONO_IMUBackend::CHRONO_IMUBackend | ( | ) |
Constructor. Attach a body with set_chrono_body() before reading.
|
explicit |
|
inlinenoexcept |
|
overridevirtual |
Read the settings, see IMUBackendBase::load(), and the errors, see Errors::read().
Reimplemented from bitsim::sensors::backends::IMUBackendBase.
|
overridevirtual |
Read the accelerometer and the gyroscope.
| std::logic_error | If there is no body, or the body is in no system |
Implements bitsim::sensors::backends::SensorBackendBase.
| void bitsim::sensors::backends::CHRONO_IMUBackend::set_errors | ( | const Errors & | errors | ) |
|
static |