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 stateINACTIVE– Primary stateACTIVE– Primary stateFINALIZED– Primary stateCONFIGURING– Transition stateACTIVATING– Transition stateDEACTIVATING– Transition stateCLEANING_UP– Transition stateSHUTTING_DOWN– Transition stateERROR_PROCESSING– Transition state
DataStatus Class
Represents the status flags for a single data frame.
- class DataStatus
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.
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
UNCONFIGUREDtoINACTIVE, passing through theCONFIGURINGtransition.- Returns:
falseif called from the wrong state or transition failed; otherwise,true.- Return type:
- activate()
Transitions the driver from
INACTIVEtoACTIVE, passing through theACTIVATINGtransition.- Returns:
falseif called from the wrong state or transition failed; otherwise,true.- Return type:
- deactivate()
Transitions the driver from
ACTIVEtoINACTIVE, passing through theDEACTIVATINGtransition.- Returns:
falseif called from the wrong state or transition failed; otherwise,true.- Return type:
- cleanup()
Transitions the driver from
INACTIVEtoUNCONFIGURED, passing through theCLEANING_UPtransition.- Returns:
falseif called from the wrong state or transition failed; otherwise,true.- Return type:
- shutdown()
Shuts down the driver and releases any associated resources.
- Returns:
falseif something failed; otherwise,true.- Return type:
User functions
- tare()
Computes and applies wrench offsets to zero the output. Can only be called in the
INACTIVEstate.- Returns:
falseif called from the wrong state or something failed; otherwise,true.- Return type:
- read_frame()
Returns the most recent available frame. Must be called in the
ACTIVEstate; otherwise, an error is raised.- Returns:
A BotaFrame object containing the latest sensor data.
- Return type:
- read_frame_blocking()
Blocks until a new frame is available, then returns it. Must be called in the
ACTIVEstate; otherwise, an error is raised.- Returns:
A BotaFrame object containing the newly received sensor data.
- Return type:
Getters
- get_driver_state()
Returns the current internal driver state.
- Returns:
The current state of the driver.
- Return type:
- get_expected_timestep()
Returns the expected update interval for sensor data.
- Returns:
The expected timestep between consecutive sensor data frames.
- Return type: