robits.core.data_model package

Submodules

robits.core.data_model.action module

class robits.core.data_model.action.BimanualAction(right_action: CartesianAction, left_action: CartesianAction)

Bases: object

Represents a bimanual action, which consists of separate actions for the right and left arms.

Variables:
  • right_action – The action for the right hand.

  • left_action – The action for the left hand.

classmethod from_numpy(action: ndarray) BimanualAction

Creates a BimanualAction instance from a NumPy array.

Parameters:

action – A NumPy array containing both right and left actions.

Returns:

An instance of BimanualAction with parsed right and left actions.

Raises:

ValueError – If the input array cannot be split into two equal parts.

left_action: CartesianAction
right_action: CartesianAction
to_numpy() ndarray

Converts the BimanualAction instance into a NumPy array.

Returns:

A concatenated NumPy array representing both right and left actions.

class robits.core.data_model.action.CartesianAction(position: ndarray, quaternion: ndarray, hand_open: bool)

Bases: object

Defines a cartesian action consisting of position, orientation, and the gripper state.

Variables:
  • position – The position in meters.

  • quaternion – The orientation represented as a quaternion in xyzw format.

  • hand_open – A flag indicating whether the gripper is open (True) or closed (False).

classmethod from_matrix(pose: ndarray, hand_open: bool = True) CartesianAction

Creates a CartesianAction instance from a given 4x4 pose matrix.

Parameters:
  • pose – A 4x4 transformation matrix representing the pose.

  • hand_open – A boolean flag indicating whether the gripper is open.

Returns:

A CartesianAction instance.

classmethod from_numpy(action: ndarray) CartesianAction

Creates a CartesianAction instance from a NumPy array.

Parameters:

action – A NumPy array of length 9 containing position, quaternion, and gripper state.

Returns:

A CartesianAction instance.

Raises:

ValueError – If the input array does not have exactly 9 elements.

hand_open: bool
classmethod parse(action: Sequence[float] | ndarray) CartesianAction

Parses a sequence of float values into a CartesianAction.

Parameters:

action – A sequence containing position, quaternion, and gripper state.

Returns:

A CartesianAction instance.

position: ndarray
property position_as_tuple: Tuple[float]

Converts the position to a tuple format.

Returns:

A tuple representation of the position.

quaternion: ndarray
property quaternion_as_tuple: Tuple[float]

Converts the quaternion to a tuple format. Quaternion is stored in the xyzw format

Returns:

A tuple representation of the quaternion.

property rot_matrix: ndarray

Computes the orientation of the action as a 3x3 rotation matrix.

Returns:

A 3x3 rotation matrix representing the orientation.

to_matrix() ndarray

Computes the action as a homogeneous 4x4 transformation matrix.

Returns:

A 4x4 homogeneous transformation matrix representing the pose.

to_numpy() ndarray

Converts the CartesianAction instance into a NumPy array in the form (position, quaternion, gripper state)

Returns:

A NumPy array representing position, quaternion, and gripper state.

robits.core.data_model.camera_capture module

class robits.core.data_model.camera_capture.CameraData(rgb_image: ndarray, depth_image: ndarray, np_xyz_points: ndarray | None = None, np_colors: ndarray | None = None)

Bases: object

Data model for camera images. Mainly RGB-D

  • rgb_image is stored in (height, width, colors) format.

  • depth_image is stored in (height, width) format.

  • Data type for rgb_image is np.uint8.

  • Data type for depth_image is float32, with depth values in meters (m).

  • Units for point_cloud are in meters (m).

Variables:
  • rgb_image – The RGB image stored as a NumPy array (height, width, 3).

  • depth_image – The depth image stored as a NumPy array (height, width).

  • np_xyz_points – The 3D point cloud coordinates (optional).

  • np_colors – The corresponding RGB colors for the point cloud (optional).

camera_data() Dict[str, bool]

Checks which types of camera data are available.

Returns:

A dictionary indicating the presence of RGB, depth, and point cloud data.

depth_image: ndarray
has_images() bool

Checks if both RGB and depth images are available.

Returns:

True if both RGB and depth images exist, otherwise False.

has_point_cloud() bool

Checks if the point cloud data is available.

Returns:

True if both np_xyz_points and np_colors are available, otherwise False.

np_colors: ndarray | None = None
np_xyz_points: ndarray | None = None
property point_cloud: ndarray

Constructs the point cloud by concatenating np_xyz_points and np_colors.

Returns:

A NumPy array representing the point cloud.

Raises:

ValueError – If the point cloud data is unavailable.

rgb_image: ndarray
to_dict() Dict[str, ndarray]

Converts the CameraData instance into a dictionary.

Returns:

A dictionary containing rgb_image, depth_image, and optionally point_cloud.

robits.core.data_model.dataset module

class robits.core.data_model.dataset.Dataset(entries: List[Entry] = <factory>, metadata: Dict[str, ~typing.Any]=<factory>)

Bases: object

Represents a dataset containing multiple entries and metadata.

Parameters:
  • entries – List of dataset entries.

  • metadata – Metadata related to the dataset.

entries: List[Entry]
metadata: Dict[str, Any]
class robits.core.data_model.dataset.Entry(seq: int, proprioception: Dict[str, ~typing.Any]=<factory>, camera_data: Dict[str, ~robits.core.data_model.camera_capture.CameraData]=<factory>, camera_info: Dict[str, ~numpy.ndarray]=<factory>)

Bases: object

Represents a single snapshot entry in a dataset.

Parameters:
  • seq – Serial identifier of this snapshot. Should be ordered

  • proprioception – Dictionary containing proprioceptive sensor data.

  • camera_data – Dictionary containing captured camera data.

  • camera_info – Dictionary containing camera metadata as NumPy arrays.

camera_data: Dict[str, CameraData]
camera_info: Dict[str, ndarray]
proprioception: Dict[str, Any]
seq: int