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
structChannelProperties — Sensor-frame bias, bandwidth, stochastic errors and quantization for one channel.structImuProperties — Complete IMU measurement model. All model effects are disabled by default.
Constructors & destructor
InertialMeasurementUnit
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
| Parameter | Description |
|---|---|
prop | Measurement settings and immutable sensor identity. |
as | Owning system; may be null until attachment. |
pos | Mount position relative to its body. |
rot | Sensor-to-body rotation. |
~InertialMeasurementUnit
~InertialMeasurementUnit() final = defaultRelease model state and pending delayed samples.
Public member functions
serializeProp
server::BoundedWriter serializeProp(server::BoundedWriter data) const finalWrite sensor metadata using the existing server wire format.
serializeMeasurements
server::BoundedWriter serializeMeasurements(server::BoundedWriter data) const finalWrite delivered accelerometer and gyro samples as floats.
getLinearAcceleration
const Eigen::Vector3d &getLinearAcceleration() constSpecific force (acceleration minus gravity) in the IMU frame [m/s^2].
getAngularVelocity
const Eigen::Vector3d &getAngularVelocity() constAngular velocity in the IMU frame [rad/s].
getOrientation
const Vec<4> &getOrientation() constGround-truth sensor-to-world quaternion (w, x, y, z) at the delivered acquisition time.
getGroundTruthOrientation
const Vec<4> &getGroundTruthOrientation() constGround-truth orientation at acquisition; identical to getOrientation().
getDeliveryTimeStamp
double getDeliveryTimeStamp() constWorld time when the most recent sample became available; negative before first delivery.
getAccelerometerBias
const Eigen::Vector3d &getAccelerometerBias() constCurrent accelerometer bias, including its random walk, in m/s^2.
getGyroscopeBias
const Eigen::Vector3d &getGyroscopeBias() constCurrent gyro bias, including its random walk, in rad/s.
setLinearAcceleration
void setLinearAcceleration(const Eigen::Vector3d &acc)Write hardware measurements when using MeasurementSource::MANUAL.
setAngularVelocity
void setAngularVelocity(const Eigen::Vector3d &vel)Write a hardware gyro measurement in the sensor frame [rad/s].
setOrientation
void setOrientation(const Vec<4> &orientation)Write a hardware sensor-to-world orientation (w, x, y, z).
getProperties
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.
const ImuProperties &getProperties() constRead settings without enabling legacy mutation tracking.
setProperties
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
void reset()Reset measurements and stochastic history using the configured seed and initial biases.
resetNoise
void resetNoise() noexceptRestart 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
uint64_t getDroppedMeasurementCount() constSamples dropped because the latency queue was full or allocation failed, since reset().
update
void update(World &world) finalAcquire/filter/deliver once for the current physics step; manual sources are untouched.
Static member functions
getType static
static Type getType()Concrete sensor type: IMU.
Public attributes
kMaxPendingMeasurements
static constexpr size_t kMaxPendingMeasurementsMaximum 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