Skip to content

simulo.IMU

Inertial Measurement Unit sensor.

Measures linear acceleration and angular velocity of a body. Commonly mounted on robot base for state estimation.

Attributes:

  • offset — Sensor offset relative to parent frame

Example:

import simulo
imu = simulo.IMU(
offset=simulo.SensorOffset(pos=(0, 0, 0.1)),
)
scene.add(imu, at="/World/Robot/base/imu")
# Read data
accel = imu.read_linear_acceleration() # (num_envs, 3)
gyro = imu.read_angular_velocity() # (num_envs, 3)
simulo.IMU(
path: Optional[str] = None,
offset: Optional[SensorOffset] = None,
update_period: float = 0.0,
enabled: bool = True,
debug_vis: bool = False,
)
IMU.read_linear_acceleration() -> torch.Tensor

Get linear acceleration in sensor frame.

Returns:

Acceleration tensor of shape (num_envs, 3). Values are float32 in m/s^2.

Raises:

  • RuntimeError — If sensor not initialized
IMU.read_angular_velocity() -> torch.Tensor

Get angular velocity in sensor frame.

Returns:

Angular velocity tensor of shape (num_envs, 3). Values are float32 in rad/s.

Raises:

  • RuntimeError — If sensor not initialized
IMU.read_orientation() -> torch.Tensor

Get orientation quaternion in world frame.

Returns:

Orientation tensor of shape (num_envs, 4). Quaternion in (w, x, y, z) format.

Raises:

  • RuntimeError — If sensor not initialized