Python

Download and Installation

The Python SDK is available as a PyPI package for easy installation.

Supported platforms:

  • Linux: x86_64 and aarch64 (Python ≥ 3.8)
  • Windows: Python ≥ 3.12
  • macOS: Python ≥ 3.12

Installation using pip:

pip install bota-tf-utils

Usage Demo

We provide a demo to get yourself started with the Python SDK.

What you'll find in the demo:

  • Wrench, Twist, IMU and Pose transformer setup and configuration
  • Static and dynamic TF entry patterns
  • Real-time loop integration examples in Python

API Description

All four transformation utilities follow the same interface pattern. Each class is imported from the bota_tf_utils module and is constructed with an optional path to a JSON configuration file (see Concept for the config file structure).

BotaTfWrench

Transforms a 6-DOF wrench [fx, fy, fz, tx, ty, tz] between reference points and expression axes.

class bota_tf_utils.BotaTfWrench

Constructor and Destructor

__init__(config_file: str = '') None

Constructs the transformer. Optionally loads static TF entries from a JSON config file (section key "tf_wrench_config"). If config_file is empty, all entries must be set via the setters below.

Parameters:

config_file (str) – Path to the JSON configuration file (may be empty).

__del__() None

Default destructor.

Metadata

name() str

Returns the name specified in the JSON config, or an empty string if no config was loaded.

Return type:

str

TF Setters

set_input_reference_point(origin: str, translation: list[float]) bool

Sets the translation from origin to the input reference point (expressed in origin axes).

Parameters:
  • origin (str) – "fixed_frame" or "moving_frame".

  • translation (list[float]) – [x, y, z] in metres from origin frame to input reference point.

Returns:

True on success; False if this entry was already loaded from JSON.

Return type:

bool

set_input_expression_axes(origin: str, rotation: list[float]) bool

Sets the rotation from origin to the input expression axes.

Parameters:
  • origin (str) – "fixed_frame" or "moving_frame".

  • rotation (list[float]) – [qw, qx, qy, qz] unit quaternion rotation from origin frame to input expression axes.

Returns:

True on success; False if this entry was already loaded from JSON.

Return type:

bool

set_output_reference_point(origin: str, translation: list[float]) bool

Sets the translation from origin to the output reference point (expressed in origin axes).

Parameters:
  • origin (str) – "fixed_frame" or "moving_frame".

  • translation (list[float]) – [x, y, z] in metres from origin frame to output reference point.

Returns:

True on success; False if this entry was already loaded from JSON.

Return type:

bool

set_output_expression_axes(origin: str, rotation: list[float]) bool

Sets the rotation from origin to the output expression axes.

Parameters:
  • origin (str) – "fixed_frame" or "moving_frame".

  • rotation (list[float]) – [qw, qx, qy, qz] unit quaternion rotation from origin frame to output expression axes.

Returns:

True on success; False if this entry was already loaded from JSON.

Return type:

bool

Dynamic TF

set_fixed_to_moving_frame_tf(tf: list[float]) None

Pushes the current fixed-to-moving-frame transform. Must be called every loop iteration when any TF entry uses "moving_frame". Cannot be set via the JSON config.

Parameters:

tf (list[float]) – [tx, ty, tz, qw, qx, qy, qz] — translation (metres) followed by unit quaternion from fixed frame to moving frame.

Transform

update(wrench_in: list[float], wrench_out: list[float]) BotaControlReturnCode

Transforms the input wrench and writes the result to wrench_out.

Parameters:
  • wrench_in (list[float]) – Input wrench [fx, fy, fz, tx, ty, tz] at the input reference point, expressed in the input expression axes.

  • wrench_out (list[float]) – Output wrench [fx, fy, fz, tx, ty, tz] at the output reference point, expressed in the output expression axes.

Returns:

BotaControlReturnCode.OK on success, or a warning/error code according to the configured policy.

Return type:

BotaControlReturnCode


BotaTfPose

Transforms a 7-DOF pose [px, py, pz, qw, qx, qy, qz] between reference points and expression axes. Uses config key "tf_pose_config".

Note

BotaTfPose does not have a set_fixed_to_moving_frame_tf() method. The orientation of the moving frame is encoded directly in the input pose quaternion, so no separate dynamic TF call is needed each loop iteration.

class bota_tf_utils.BotaTfPose

Constructor and Destructor

__init__(config_file: str = '') None

Constructs the transformer. Optionally loads static TF entries from "tf_pose_config".

Parameters:

config_file (str) – Path to the JSON configuration file (may be empty).

__del__() None

Metadata

name() str

TF Setters

set_input_reference_point(origin: str, translation: list[float]) bool
set_input_expression_axes(origin: str, rotation: list[float]) bool
set_output_reference_point(origin: str, translation: list[float]) bool
set_output_expression_axes(origin: str, rotation: list[float]) bool

Transform

update(pose_in: list[float], pose_out: list[float]) BotaControlReturnCode

Transforms the input pose and writes the result to pose_out.

Parameters:
  • pose_in (list[float]) – Input pose [px, py, pz, qw, qx, qy, qz].

  • pose_out (list[float]) – Output pose [px, py, pz, qw, qx, qy, qz].

Return type:

BotaControlReturnCode


BotaTfTwist

Transforms a 6-DOF twist [vx, vy, vz, wx, wy, wz] between reference points and expression axes. The interface is identical to BotaTfWrench — only the config key ("tf_twist_config") and the signal semantics differ.

class bota_tf_utils.BotaTfTwist
__init__(config_file: str = '') None

Constructs the transformer. Optionally loads static TF entries from "tf_twist_config".

__del__() None
name() str
set_input_reference_point(origin: str, translation: list[float]) bool
set_input_expression_axes(origin: str, rotation: list[float]) bool
set_output_reference_point(origin: str, translation: list[float]) bool
set_output_expression_axes(origin: str, rotation: list[float]) bool
set_fixed_to_moving_frame_tf(tf: list[float]) None
update(twist_in: list[float], twist_out: list[float]) BotaControlReturnCode

Transforms the input twist and writes the result to twist_out.

Parameters:
  • twist_in (list[float]) – Input twist [vx, vy, vz, wx, wy, wz].

  • twist_out (list[float]) – Output twist [vx, vy, vz, wx, wy, wz].

Return type:

BotaControlReturnCode


BotaTfImu

Transforms a 6-DOF IMU signal [ax, ay, az, wx, wy, wz] between reference points and expression axes, accounting for the centripetal acceleration term when the reference point changes. Uses config key "tf_imu_config".

class bota_tf_utils.BotaTfImu
__init__(config_file: str = '') None

Constructs the transformer. Optionally loads static TF entries from "tf_imu_config".

__del__() None
name() str
set_input_reference_point(origin: str, translation: list[float]) bool
set_input_expression_axes(origin: str, rotation: list[float]) bool
set_output_reference_point(origin: str, translation: list[float]) bool
set_output_expression_axes(origin: str, rotation: list[float]) bool
set_fixed_to_moving_frame_tf(tf: list[float]) None
update(imu_in: list[float], imu_out: list[float]) BotaControlReturnCode

Transforms the input IMU signal and writes the result to imu_out.

Parameters:
  • imu_in (list[float]) – Input IMU signal [ax, ay, az, wx, wy, wz] (m/s² and rad/s).

  • imu_out (list[float]) – Output IMU signal [ax, ay, az, wx, wy, wz].

Return type:

BotaControlReturnCode