Skip to content

sift_py.data_import.rosbags

Service to upload ROS2 bag files.

ROS organizes data exchange through topics, messages, and fields: * topics: Named messages that facilitate communication between ROS nodes. * messages: Data structures published and subscribed to on topics. Each message type defines a specific schema. * fields: Individual data elements within a message, such as integers, floats, strings, or nested structures.

This class extracts messages from a ROS bag, flattens their fields, and prepares them for uploading to Sift.

CLASS DESCRIPTION
RosbagsUploadService

Service to upload ROS2 bag files.

RosbagsUploadService

RosbagsUploadService(rest_conf: SiftRestConfig)

Service to upload ROS2 bag files.

METHOD DESCRIPTION
upload

Uploads the ROS2 bag file pointed to by path to the specified asset.

upload

upload(
    path: Union[str, Path],
    msg_dirs: List[Union[str, Path]],
    store: Stores,
    asset_name: str,
    ignore_errors: bool = False,
    run_name: Optional[str] = None,
    run_id: Optional[str] = None,
    handlers: Optional[Dict[str, Callable]] = None,
    show_progress: bool = True,
) -> DataImportService

Uploads the ROS2 bag file pointed to by path to the specified asset.

PARAMETER DESCRIPTION
path

Path to the ROS2 bag file.

TYPE: Union[str, Path]

msg_dirs

List of directories containing message definitions. Each entry should be a path the root directory of the msg definitions (e.g, /path/to/std_msgs). Inspect your topics and verify that the 'type' matches the directory structure of your message definitions. For example if the type is custom_msgs/msg/MyCustomMessage your directory structure should match that and you should include /path/to/custom_msgs in the msg_dirs list passed into this function.

TYPE: List[Union[str, Path]]

store

The Store type to use for the message definitions.

TYPE: Stores

asset_name

Name of the asset to upload the data to.

TYPE: str

ignore_errors

If True, will skip messages without definitions.

TYPE: bool DEFAULT: False

run_name

Name of the run to create for this data.

TYPE: Optional[str] DEFAULT: None

run_id

ID of the run to add this data to.

TYPE: Optional[str] DEFAULT: None

handlers

Dictionary of messages to callbacks for custom processing or sequence data (e.g, images or videos). Keys should be the ROS topic, value is a callable with the following signature: def callback(topic: str, timestamp: int, msg: object) ...

TYPE: Optional[Dict[str, Callable]] DEFAULT: None

show_progress

Whether to show the status bar or not.

TYPE: bool DEFAULT: True