C++

Download and Installation

The C++ driver is distributed as pre-compiled binaries for easy integration.

Supported platforms:

  • Linux: x86_64 and aarch64
  • Windows: x86_64
  • macOS: arm64

Download: Get the binaries here

Installation: Copy the downloaded files to your C++ project and configure your build system

Usage Examples

We provide a complete set of examples to get yourself started with the C++ 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

The API below summarizes the public interface and key data types of BotaDriver.

Custom data types

DriverState Enum

Represents the internal lifecycle states of the BotaDriver.

enum 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 Union

Represents the status flags for a single data frame.

union DataStatus

Bitfield view (within the union) contains the following flags:

  • throttled (1 bit) - Data was rate-limited.

  • overrange (1 bit) - Data exceeds sensor limits.

  • invalid (1 bit) - Data is invalid or corrupt.

  • raw (1 bit) - Data is unprocessed raw sensor output.

  • 12 bits reserved.

uint16_t val

Combined 16-bit view of status flags.

uint8_t bytes[1]

Raw byte-level access.

BotaFrame Struct

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

struct BotaFrame
DataStatus status

Bitfield status information about the frame.

std::array<float, 3> force

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

std::array<float, 3> torque

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

uint32_t timestamp

Timestamp of the frame in microseconds since boot.

float temperature

Internal temperature in degrees Celsius.

std::array<float, 3> acceleration

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

std::array<float, 3> angular_rate

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

BotaFrame(DataStatus status_data, std::array<float, 3> force_data, std::array<float, 3> torque_data, uint32_t timestamp_data, float temperature_data, std::array<float, 3> acceleration_data, std::array<float, 3> angular_rate_data)

Constructs a frame with all sensor data.

BotaDriver class public interface

class BotaDriver

Public interface of the BotaDriver class.

Constructor and destructor
BotaDriver(const std::string &config_path)

Constructor that initializes the driver using a JSON configuration file. The path to the file must be provided.

~BotaDriver()

Default destructor.

Lifecycle management methods
bool configure()

Transitions the driver from UNCONFIGURED towards INACTIVE state, going through CONFIGURING transition state.

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

bool activate()

Transitions the driver from INACTIVE towards ACTIVE state, going through ACTIVATING transition state.

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

bool deactivate()

Transitions the driver from ACTIVE towards INACTIVE state, going through DEACTIVATING transition state.

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

bool cleanup()

Transitions the driver from INACTIVE towards UNCONFIGURED state, going through CLEANING_UP transition state.

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

bool shutdown()

Shuts down the driver and releases resources.

Returns false if something failed, otherwise true.

User functions
bool tare() const

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

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

BotaFrame readFrame() const

Returns the most recent available frame. It can only be called in the ACTIVE state, otherwise an error will be raised.

BotaFrame readFrameBlocking() const

Blocks until a new frame is available and returns it. Can only be called in the ACTIVE state, otherwise an error will be raised.

Getters
DriverState getDriverState() const

Returns the current internal driver state.

std::chrono::microseconds getExpectedTimestep() const

Returns the expected update interval of the sensor data.

uint16_t getDriverVersionGeneration()

Returns the generation number of the driver version (e.g., first digit in X.Y.Z).

uint16_t getDriverVersionMajor()

Returns the major version number (second digit in X.Y.Z).

uint16_t getDriverVersionMinor()

Returns the minor version number (third digit in X.Y.Z).

std::string getDriverVersionString()

Returns a string representation of the driver version.