Skip to content

ROS

flowcean.ros loads ROS bag data for use in Flowcean environments.

ros

Classes

RosbagError

Bases: Exception

Dataframe conversion error.

Functions:

load_rosbag

load_rosbag(path: str | PathLike[str], topics: dict[str, list[str]], *, message_paths: Iterable[str | PathLike[str]] | None = None, cache: bool = True, cache_path: str | PathLike[str] | None = None) -> LazyFrame

Load a ROS2 Humble rosbag file and convert it to a Polars LazyFrame.

The structure of the data is inferred from the message definitions. If a message definition is not found in the ROS2 Humble typestore, it is added from the provided paths. Once all the message definitions are added, the data is loaded from the rosbag file.

Parameters:

Name Type Description Default
path str | PathLike[str]

Path to the rosbag.

required
topics dict[str, list[str]]

Dictionary of topics to load (topic: [paths]).

required
message_paths Iterable[str | PathLike[str]] | None

List of paths to additional message definitions.

None
cache bool

Whether to cache the data to a Parquet file.

True
cache_path str | PathLike[str] | None

Path to the cache file. If None, defaults to the same directory as the rosbag file with a .parquet extension.

None