rosbags.convert

Rosbags file format conversion.

Conversion function transforms files from rosbag1 format to the latest rosbag2 format. It automatically matches ROS1 message types to their ROS2 counterparts and adds custom types not present in the type system.

exception rosbags.convert.ConverterError

Bases: Exception

Converter Error.

rosbags.convert.convert(srcs, dst, dst_version, default_typestore, typestore, exclude_topics, include_topics, exclude_msgtypes, include_msgtypes)

Convert between Rosbag1 and Rosbag2.

Parameters:
  • srcs (Sequence[Path]) – Rosbag files to read from.

  • dst (Path) – Destination path to write rosbag to.

  • dst_version (int | None) – Destination file format version.

  • default_typestore (Typestore | None) – Default typestore if source files have not message definitions.

  • typestore (Typestore | None) – Convert messages to this destination typestore.

  • exclude_topics (Sequence[str]) – Topics to exclude from conversion, even if included explicitly.

  • include_topics (Sequence[str]) – Topics to include in conversion, instead of all.

  • exclude_msgtypes (Sequence[str]) – Message types to exclude from conversion, even if included explicitly.

  • include_msgtypes (Sequence[str]) – Message types to include in conversion, instead of all.

Return type:

None

ExcGroups:

topics: Select topics to exclude or include. (options are mutually exclusive)