rigid_body_motion.ros.RosbagWriter

class rigid_body_motion.ros.RosbagWriter(bag_file)[source]

Bases: object

Writer for motion topics to rosbag files.

__init__(bag_file)[source]

Constructor.

Parameters
bag_file: str

Path to rosbag file.

Methods

__init__(bag_file)

Constructor.

write_transform_stamped(timestamps, …)

Write multiple geometry_msgs/TransformStamped messages.

write_transform_stamped_dataset(ds, topic, …)

Write a dataset as geometry_msgs/TransformStamped messages.

write_transform_stamped(timestamps, translation, rotation, topic, frame, child_frame)[source]

Write multiple geometry_msgs/TransformStamped messages.

Parameters
timestamps: array_like, shape (n_timestamps,)

Array of timestamps.

translation: array_like, shape (n_timestamps, 3)

Array of translations.

rotation: array_like, shape (n_timestamps, 4)

Array of rotations.

topic: str

Topic of the messages.

frame: str

Parent frame of the transform.

child_frame: str

Child frame of the transform.

write_transform_stamped_dataset(ds, topic, frame, child_frame, timestamps='time', translation='position', rotation='orientation')[source]

Write a dataset as geometry_msgs/TransformStamped messages.

Parameters
ds: xarray.Dataset

Dataset containing timestamps, translation and rotation

topic: str

Topic of the messages.

frame: str

Parent frame of the transform.

child_frame: str

Child frame of the transform.

timestamps: str, default ‘time’

Name of the dimension containing the timestamps.

translation: str, default ‘position’

Name of the variable containing the translation.

rotation: str, default ‘orientation’

Name of the variable containing the rotation.