module documentation

Filling a message header's timestamp, so that no declaration has to hand-write a clock.

A client writing a pose into a Skill's Parameters says where, not when, so the adapter fills the time. It fills a stamp only where it is still zero, which is ROS2's convention for unset (tf2 reads it as "latest available"); a stamp a client wrote is kept.

A stamp is a field named stamp whose message has exactly the fields sec and nanosec. The name is part of the test because builtin_interfaces/msg/Duration has the same two fields. The clock belongs to the Runtime, since a ROS2 node may run on simulated time.

Function stamp_paths Return the field-name chain of every stamp reachable in one message type.
Function stamped Return the message with every stamp that is still zero filled from one clock reading.
Constant NANOSECONDS_FIELD The remainder field of a builtin_interfaces/msg/Time. The TF facet reuses both names.
Constant SECONDS_FIELD The whole-seconds field of a builtin_interfaces/msg/Time.
Constant STAMP_FIELD The one field name this module fills.
Function _filled Return the message with the stamp at one chain filled, or the message itself if it is set.
Function _is_a_time Return whether a message description is builtin_interfaces/msg/Time's shape.
Function _with Return a copy of one message with one field replaced; other fields are carried by reference.
Constant _TIME_FIELDS The shape that identifies builtin_interfaces/msg/Time.
@cache
def stamp_paths(message_type: type[Message]) -> tuple[tuple[str, ...], ...]:

Return the field-name chain of every stamp reachable in one message type.

A repeated message field is not descended into: a client that authored a list of waypoints authored their times too (opensmi.ros2.runtime.tf writes its own for a TFMessage).

def stamped(message: Message, *, seconds: int, nanoseconds: int) -> Message:

Return the message with every stamp that is still zero filled from one clock reading.

One clock reading serves the whole message. The same object is returned when nothing needed filling.

Parameters
message:MessageUndocumented
seconds:intThe whole seconds of the ROS2 clock, for the sec field.
nanoseconds:intThe remainder, for the nanosec field.
Returns
MessageUndocumented
NANOSECONDS_FIELD: str =

The remainder field of a builtin_interfaces/msg/Time. The TF facet reuses both names.

Value
'nanosec'
SECONDS_FIELD: str =

The whole-seconds field of a builtin_interfaces/msg/Time.

Value
'sec'
STAMP_FIELD: str =

The one field name this module fills.

Value
'stamp'
def _filled(message: Message, path: tuple[str, ...], seconds: int, nanoseconds: int) -> Message:

Return the message with the stamp at one chain filled, or the message itself if it is set.

def _is_a_time(described: MessageDescription) -> bool:

Return whether a message description is builtin_interfaces/msg/Time's shape.

def _with(message: Message, name: str, value: Message) -> Message:

Return a copy of one message with one field replaced; other fields are carried by reference.

_TIME_FIELDS =

The shape that identifies builtin_interfaces/msg/Time.

Value
{SECONDS_FIELD: PrimitiveType(name='int32'),
 NANOSECONDS_FIELD: PrimitiveType(name='uint32')}