Python

Download and Installation

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

Supported platforms:

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

Installation using pip:

pip install bota-driver

Usage Examples

We provide a complete set of examples to get yourself started with the Python driver.

What you'll find in the examples:

  • Basic driver setup and configuration
  • Data reading from both stream and buffer
  • Integration patterns and best practices

API description

Custom data types

DriverState Enum

Represents the internal lifecycle states of the BotaDriver.

class DriverState
  • UNCONFIGURED – Primary state

  • INACTIVE – Primary state

  • ACTIVE – Primary state

  • FINALIZED – Primary state

  • CONFIGURING – Transition state

  • ACTIVATING – Transition state

  • DEACTIVATING – Transition state

  • CLEANING_UP – Transition state

  • SHUTTING_DOWN – Transition state

  • ERROR_PROCESSING – Transition state

DataStatus Class

Represents the status flags for a single data frame.

class DataStatus
val: int

Combined 16-bit value of the status flags.

throttled: bool

Indicates that the data was rate-limited.

overrange: bool

Indicates that the data exceeded sensor limits.

invalid: bool

Indicates that the data is invalid or corrupt.

raw: bool

Indicates that the data is unprocessed raw sensor output.

BotaFrame Class

Represents a full frame, including status, wrench, imu data, temperature and timestamp.

class BotaFrame(status: DataStatus, force: list[float], torque: list[float], timestamp: int, temperature: float, acceleration: list[float], angular_rate: list[float])
__init__(status: DataStatus, force: list[float], torque: list[float], timestamp: int, temperature: float, acceleration: list[float], angular_rate: list[float])

Constructs a frame

status: DataStatus

Bitfield status information about the frame.

force: list[float]

Force vector [Fx, Fy, Fz] in Newtons.

torque: list[float]

Torque vector [Tx, Ty, Tz] in Newton-meters.

timestamp: int

Timestamp of the frame in microseconds since boot.

temperature: float

Internal temperature in degrees Celsius.

acceleration: list[float]

Linear acceleration [Ax, Ay, Az] in m/s².

angular_rate: list[float]

Angular velocity [Wx, Wy, Wz] in rad/s.

BotaDriver class public interface

class BotaDriver
Constructor and destructor
__init__(config_path)

Constructor initializing the driver using a path to a JSON configuration file.

Parameters:

config_path (str) – Path to the JSON configuration file.

__del__()

Default destructor.

Life cycle management methods
configure()

Transitions the driver from UNCONFIGURED to INACTIVE, passing through the CONFIGURING transition.

Returns:

false if called from the wrong state or transition failed; otherwise, true.

Return type:

bool

activate()

Transitions the driver from INACTIVE to ACTIVE, passing through the ACTIVATING transition.

Returns:

false if called from the wrong state or transition failed; otherwise, true.

Return type:

bool

deactivate()

Transitions the driver from ACTIVE to INACTIVE, passing through the DEACTIVATING transition.

Returns:

false if called from the wrong state or transition failed; otherwise, true.

Return type:

bool

cleanup()

Transitions the driver from INACTIVE to UNCONFIGURED, passing through the CLEANING_UP transition.

Returns:

false if called from the wrong state or transition failed; otherwise, true.

Return type:

bool

shutdown()

Shuts down the driver and releases any associated resources.

Returns:

false if something failed; otherwise, true.

Return type:

bool

User functions
tare()

Computes and applies wrench offsets to zero the output. Can only be called in the INACTIVE state.

Returns:

false if called from the wrong state or something failed; otherwise, true.

Return type:

bool

read_frame()

Returns the most recent available frame. Must be called in the ACTIVE state; otherwise, an error is raised.

Returns:

A BotaFrame object containing the latest sensor data.

Return type:

BotaFrame

read_frame_blocking()

Blocks until a new frame is available, then returns it. Must be called in the ACTIVE state; otherwise, an error is raised.

Returns:

A BotaFrame object containing the newly received sensor data.

Return type:

BotaFrame

Getters
get_driver_state()

Returns the current internal driver state.

Returns:

The current state of the driver.

Return type:

DriverState

get_expected_timestep()

Returns the expected update interval for sensor data.

Returns:

The expected timestep between consecutive sensor data frames.

Return type:

datetime.timedelta

get_driver_version_string()

Returns a string representation of the driver version in the format X.Y.Z.

Returns:

A string representing the driver version.

Return type:

str