robot_msgs

Imu

Angular velocity in rad/s, linear acceleration in m/s², both in header.frame_id.

Full docstring
Each covariance is a (3, 3) matrix (ROS flattens to 9), or `None` when unknown.
Import
from robot_msgs.sensor import Imu
ROS 2sensor_msgs/msg/Imu

Fields

NameTypeDefault
orientationQuaternionrequired
angular_velocityVector3required
linear_accelerationVector3required
orientation_covarianceArray | NoneNone
angular_velocity_covarianceArray | NoneNone
linear_acceleration_covarianceArray | NoneNone
headerHeaderHeader()

Example

One instance from the package's own test catalog; the output is its real repr().

Imu(orientation=Quaternion(x=0.0, y=0.0, z=0.0, w=1.0), angular_velocity=Vector3(x=0.0, y=0.0, z=0.1), linear_acceleration=Vector3(x=0.0, y=0.0, z=9.81), orientation_covariance=float64[3×3], header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'))
to_dict() as JSON
{
  "_type": "sensor/Imu",
  "orientation": {
    "_type": "geometry/Quaternion",
    "x": 0.0,
    "y": 0.0,
    "z": 0.0,
    "w": 1.0
  },
  "angular_velocity": {
    "_type": "geometry/Vector3",
    "x": 0.0,
    "y": 0.0,
    "z": 0.1
  },
  "linear_acceleration": {
    "_type": "geometry/Vector3",
    "x": 0.0,
    "y": 0.0,
    "z": 9.81
  },
  "orientation_covariance": {
    "dtype": "<f8",
    "shape": [3, 3],
    "data": [0.001, 0.0, 0.0, 0.0, 0.001, 0.0, 0.0, 0.0, 0.001]
  },
  "angular_velocity_covariance": null,
  "linear_acceleration_covariance": null,
  "header": {
    "_type": "std/Header",
    "stamp": 1761600000.25,
    "frame_id": "camera_color_optical_frame",
    "meta": {}
  }
}

Long arrays are cut after 16 values and say so with “…”.

Functions

Constructors

Classmethods and staticmethods: ways to build one.

from_dict

from Msg
from_dict(data: Mapping[str, Any]) -> M

No docstring.

Methods

Return new values; messages are never mutated.

replace

from Msg
replace(**changes: Any) -> M

A copy with some fields changed. Validation runs again.

to_dict

from Msg
to_dict() -> dict[str, Any]

JSON-safe dict with a "_type" key; arrays keep their dtype and shape.

Uses

Types its fields refer to.

Quaternion Vector3 Header

robot_msgs 0.1.0 @ 2dc6666GitHub · MIT license · generated from the package, not written per type