robot_msgs

Header

stamp is seconds since the Unix epoch (or since sim start); frame_id names the frame.

Full docstring
WHY float seconds, not ROS's (sec, nanosec): it is what every trajectory and controller in
this codebase already uses. float64 resolves 0.24 µs at today's epoch; `stamp_ns` and
`from_ns` exist for the lossless edge (bags, MCAP).

`meta` is context ROS has no field for (an origin, units, where the numbers came from, what
a cleaner changed) as an immutable ``str -> str`` mapping.
WHY on the header, not a free-form field on each message: the header is already the one place
a message says what its numbers are relative to (`frame_id`); meta extends that slot, so every
stamped message and every trajectory gets it once, and everything that keeps the header
(slicing, `.at()`, `resample`, serialisation) keeps it too. WHY strings only: the values are
read by people and other tools; a number would be `str()`-ed silently, so it is refused and
the caller picks the spelling (``repr(origin)``). Dropped on ROS export: std_msgs/Header has
only stamp and frame_id (docs/DESIGN.md, "Header.meta").
Import
from robot_msgs.std import Header
ROS 2std_msgs/msg/Header

Fields

NameTypeDefault
stampfloat0.0
frame_idstr''
metaMapping[str, str]FrozenDict()

Example

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

Header(stamp=1761600000.25, frame_id='camera_color_optical_frame')
to_dict() as JSON
{
  "_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_ns(stamp_ns: int, frame_id: str = '') -> Header

No docstring.

from_sec_nanosec(sec: int, nanosec: int, frame_id: str = '') -> Header

No docstring.

now(frame_id: str = '') -> Header

No docstring.

from_dict

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

No docstring.

Properties

Read-only views computed from the fields.

stamp_ns: int

No docstring.

Methods

Return new values; messages are never mutated.

time_shifted(seconds: float) -> Header

No docstring.

to_sec_nanosec() -> tuple[int, int]

ROS builtin_interfaces/Time split.

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.

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