Skip to content

raisim::InertialMeasurementUnit ​

final class · #include <raisim/sensors/InertialMeasurementUnit.hpp>

Inherits: raisim::Sensor

An ideal or stochastic six-axis IMU. Measurements use the completed physics state. Orientation is ground truth, not an attitude estimate. No inverse-dynamics setting is required. Sampling is limited to one acquisition per physics step, with a phase-preserving clock.

Nested classes ​

  • struct ChannelProperties — Sensor-frame bias, bandwidth, stochastic errors and quantization for one channel.
  • struct ImuProperties — Complete IMU measurement model. All model effects are disabled by default.

Constructors & destructor ​

InertialMeasurementUnit ​

cpp
explicit InertialMeasurementUnit(
    const ImuProperties &prop,
    ArticulatedSystem *as,
    const Vec<3> &pos,
    const Mat<3, 3> &rot)

Create a physics-backed IMU mounted at pos/rot on the owning articulated system.

Parameters

ParameterDescription
propMeasurement settings and immutable sensor identity.
asOwning system; may be null until attachment.
posMount position relative to its body.
rotSensor-to-body rotation.

~InertialMeasurementUnit ​

cpp
~InertialMeasurementUnit() final = default

Release model state and pending delayed samples.

Public member functions ​

serializeProp ​

cpp
server::BoundedWriter serializeProp(server::BoundedWriter data) const final

Write sensor metadata using the existing server wire format.

serializeMeasurements ​

cpp
server::BoundedWriter serializeMeasurements(server::BoundedWriter data) const final

Write delivered accelerometer and gyro samples as floats.

getLinearAcceleration ​

cpp
const Eigen::Vector3d &getLinearAcceleration() const

Specific force (acceleration minus gravity) in the IMU frame [m/s^2].

getAngularVelocity ​

cpp
const Eigen::Vector3d &getAngularVelocity() const

Angular velocity in the IMU frame [rad/s].

getOrientation ​

cpp
const Vec<4> &getOrientation() const

Ground-truth sensor-to-world quaternion (w, x, y, z) at the delivered acquisition time.

getGroundTruthOrientation ​

cpp
const Vec<4> &getGroundTruthOrientation() const

Ground-truth orientation at acquisition; identical to getOrientation().

getDeliveryTimeStamp ​

cpp
double getDeliveryTimeStamp() const

World time when the most recent sample became available; negative before first delivery.

getAccelerometerBias ​

cpp
const Eigen::Vector3d &getAccelerometerBias() const

Current accelerometer bias, including its random walk, in m/s^2.

getGyroscopeBias ​

cpp
const Eigen::Vector3d &getGyroscopeBias() const

Current gyro bias, including its random walk, in rad/s.

setLinearAcceleration ​

cpp
void setLinearAcceleration(const Eigen::Vector3d &acc)

Write hardware measurements when using MeasurementSource::MANUAL.

setAngularVelocity ​

cpp
void setAngularVelocity(const Eigen::Vector3d &vel)

Write a hardware gyro measurement in the sensor frame [rad/s].

setOrientation ​

cpp
void setOrientation(const Vec<4> &orientation)

Write a hardware sensor-to-world orientation (w, x, y, z).

getProperties ​

cpp
ImuProperties &getProperties()

Legacy mutable access; permanently enables model comparisons on each update. Valid edits reset the model on the next update; invalid edits are restored with a warning. Prefer const access and setProperties(), which rejects invalid edits immediately.

cpp
const ImuProperties &getProperties() const

Read settings without enabling legacy mutation tracking.

setProperties ​

cpp
void setProperties(const ImuProperties &prop)

Validate transactionally, then reset filters, bias, clock, pending samples and random stream. Sensor name and full_name must match the identity chosen at construction.

reset ​

cpp
void reset()

Reset measurements and stochastic history using the configured seed and initial biases.

resetNoise ​

cpp
void resetNoise() noexcept

Restart only the random stream from the active seed, sensor identity, owner id and World seed. Preserve bias, filters, acquisition clock, queued samples and measurements.

getDroppedMeasurementCount ​

cpp
uint64_t getDroppedMeasurementCount() const

Samples dropped because the latency queue was full or allocation failed, since reset().

update ​

cpp
void update(World &world) final

Acquire/filter/deliver once for the current physics step; manual sources are untouched.

Static member functions ​

getType static ​

cpp
static Type getType()

Concrete sensor type: IMU.

Public attributes ​

kMaxPendingMeasurements ​

cpp
static constexpr size_t kMaxPendingMeasurements

Maximum delayed samples retained per IMU (about 6 MiB). Excess new samples are dropped.

Inherited members ​

From raisim::Sensor: getArticulatedSystem, getFrameId, getFrameOrientation, getFramePosition, getFullName, getMeasurementSource, getName, getOriInSensorFrame, getPosInSensorFrame, getPosition, getSensorSetModel, getSerialNumber, getUpdateRate, getUpdateTimeStamp, isUpdateDue, lock, lockMutex, MeasurementSource, setAttachmentFrame, setMeasurementSource, setSerialNumber, setUpdateRate, setUpdateTimeStamp, try_lock, Type, unlock, unlockMutex, updatePose

RaiSim — physics for robotics and AI.