rosbags.typesys

Rosbags Type System.

The type system manages ROS message types and ships all standard ROS2 distribution message types by default. The system supports custom message types through parsers that dynamically parse custom message definitons from different source formats.

Supported formats:
  • IDL files (subset of the standard necessary for parsing ROS2 IDL) [1]

  • MSG files [2]

class rosbags.typesys.Stores(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

All builtin stores.

EMPTY = 'empty'

Only builtin messages (Duration, Time).

LATEST = 'latest'

Alias for lastest ROS2 LTS.

ROS1_NOETIC = 'ros1_noetic'

Noetic Ninjemys.

ROS2_DASHING = 'ros2_dashing'

Dashing Diademata.

ROS2_ELOQUENT = 'ros2_eloquent'

Eloquent Elusor.

ROS2_FOXY = 'ros2_foxy'

Foxy Fitzroy.

ROS2_GALACTIC = 'ros2_galactic'

Galactic Geochelone.

ROS2_HUMBLE = 'ros2_humble'

Humble Hawksbill.

ROS2_IRON = 'ros2_iron'

Iron Irwini.

exception rosbags.typesys.TypesysError

Bases: Exception

Parser error.

rosbags.typesys.get_types_from_idl(text)

Get types from idl message definition.

Parameters:

text (str) – Message definition.

Return type:

dict[str, tuple[list[tuple[str, Literal['bool', 'byte', 'char', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'float128', 'string'], str | bool | int | float]], list[tuple[str, tuple[Literal[<Nodetype.BASE: 1>], tuple[Literal['bool', 'byte', 'char', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'float128', 'string'], int]] | tuple[Literal[<Nodetype.NAME: 2>], str] | tuple[Literal[<Nodetype.ARRAY: 3>, <Nodetype.SEQUENCE: 4>], tuple[tuple[Literal[<Nodetype.BASE: 1>], tuple[Literal['bool', 'byte', 'char', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'float128', 'string'], int]] | tuple[Literal[<Nodetype.NAME: 2>], str], int]]]]]]

Returns:

List of message message names and parsetrees.

rosbags.typesys.get_types_from_msg(text, name)

Get type from msg message definition.

Parameters:
  • text (str) – Message definiton.

  • name (str) – Message typename.

Return type:

dict[str, tuple[list[tuple[str, Literal['bool', 'byte', 'char', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'float128', 'string'], str | bool | int | float]], list[tuple[str, tuple[Literal[<Nodetype.BASE: 1>], tuple[Literal['bool', 'byte', 'char', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'float128', 'string'], int]] | tuple[Literal[<Nodetype.NAME: 2>], str] | tuple[Literal[<Nodetype.ARRAY: 3>, <Nodetype.SEQUENCE: 4>], tuple[tuple[Literal[<Nodetype.BASE: 1>], tuple[Literal['bool', 'byte', 'char', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'float128', 'string'], int]] | tuple[Literal[<Nodetype.NAME: 2>], str], int]]]]]]

Returns:

list with single message name and parsetree.

rosbags.typesys.get_typestore(name)

Get typestore by name.

Return type:

Typestore

Parameters:

name (Stores)

rosbags.typesys.register_types(typs, typestore=None)

DEPRECATED.

Return type:

None

Parameters:
  • typs (Typesdict)

  • typestore (Typestore | None)