rofunc.devices.optitrack.process#
Process functions for Optitrack data.
Usage Example 1: from rofunc.devices.optitrack import get_objects, data_clean
input_path = “/path/to/optitrack/data” objs, meta = get_objects(input_path) data = get_time_series(input_path, meta[0])
table_pos_x = data.iloc[:, objs[0][‘table’][‘pose’][‘Position’][‘X’]]
Usage Example 2: from rofunc.devices.optitrack import get_objects, get_time_series del_objects = [‘cup’, ‘hand_right’] objs, meta = get_objects(input_path)
# Remove unused objects from the data for obj in del_objects:
del objs[obj]
data, labels = data_clean(input_path, legacy=False, objs=objs)[0]
label_idx = labels.index(‘table.pose.x’) table_pos_x = data[label_idx, :]
1. Module Contents#
1.1. Functions#
Returns a dictionary of objects from the Optitrack data. The Optitack csv must have the original name format (e.g. “Take 2020-06-03 15-00-00.csv”). The returned list does not necessarily have the same order as your file explorer, but the meta ond objects list do. Check the meta to make sure you work on the correct file. |
|
Cleans the Optitrack data. |
|
Cleans the Optitrack data. legacy version Args: |
|
Export rigid body motion data. :param input_dir: csv file path :return: [number of frames, number of rigid bodies, pose dimension = 7] |
1.2. API#
- rofunc.devices.optitrack.process.get_objects(input_path: str)[source]#
Returns a dictionary of objects from the Optitrack data. The Optitack csv must have the original name format (e.g. “Take 2020-06-03 15-00-00.csv”). The returned list does not necessarily have the same order as your file explorer, but the meta ond objects list do. Check the meta to make sure you work on the correct file.
- Args:
input_path (str): path to the Optitrack data. If the path is to a folder, all the file with names like “Take[…].csv” are read.
- Returns:
tuple: (objects, meta)
- rofunc.devices.optitrack.process.data_clean(input_path: str, legacy: bool = True, objs: dict = None, no_unlabeled=True, save: bool = False)[source]#
Cleans the Optitrack data.
- Parameters:
input_path – path to the Optitrack data.
legacy – if True, it will use the legacy version of the function. Defaults to True.
objs – dictionary of objects to keep. If set to None, export all data. Defaults to None.
no_unlabeled – if True, it will remove the unlabeled data. Defaults to True.
save – if True, it will save the cleaned data to disk. Defaults to False.
- Returns:
list of cleaned data for all csv in folder. Type of elements in list depend on args.
- rofunc.devices.optitrack.process.data_clean_legacy(input_path: str, demo_csv: str, out_path: str)[source]#
Cleans the Optitrack data. legacy version Args:
input_path (str): path to the Optitrack data. demo_csv (str): name of the csv file out_path (str): path to save the cleaned data for Manus
- Returns:
csv_data (:pandas:`DataFrame`): cleaned data as a pandas dataframe