optitrack_utils

OptiTrack Utilities Module.

This module provides utility functions to work with OptiTrack Motive rigid-body XML files. It includes functions to read and write marker locations for rigid bodies from/to XML files, preserving comments and formatting as far as supported by the standard-library XML parser. The module uses xml.etree.ElementTree to parse and modify the XML files while providing functions to handle marker locations and related properties.

robotblockset.optitrack.optitrack_utils.get_rigid_body_markers(filename: str) Tuple[ndarray, ndarray, ndarray][source]

Read marker locations from a Motive rigid-body XML file.

Parameters:

filename (str) – Path to the Motive rigid-body XML file.

Returns:

A tuple containing three NumPy arrays: - M (n, 3): Marker positions (n markers, 3 coordinates each) - Mv (n, 3): Marker location values - Mdv (n, 3): Default marker location values

Return type:

tuple

robotblockset.optitrack.optitrack_utils.set_rigid_body_markers(filename: str, M: ndarray | List[float] | List[int] | Tuple[float, ...] | Tuple[int, ...]) None[source]

Write new marker locations to a Motive rigid-body XML file.

Parameters:
  • filename (str) – Path to the Motive rigid-body XML file.

  • M (ArrayLike) – to the XML file (n markers, 3 coordinates each).

Return type:

None

Functions

get_rigid_body_markers(filename)

Read marker locations from a Motive rigid-body XML file.

set_rigid_body_markers(filename, M)

Write new marker locations to a Motive rigid-body XML file.