C++ =========== Download and Installation ------------------------- The C++ driver is distributed as **pre-compiled binaries** for easy integration. .. raw:: html

Supported platforms:

Download: Get the binaries here

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

Usage Examples --------------- .. _cpp_usage_examples: We provide a complete set of examples to **get yourself started** with the C++ driver. .. raw:: html

What you'll find in the examples:

→ C++ Driver Examples Repository ←
API description ------------------ The API below summarizes the public interface and key data types of ``BotaDriver``. Custom data types ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. raw:: html
DriverState Enum
Represents the internal lifecycle states of the BotaDriver. .. cpp: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 .. raw:: html
DataStatus Union
Represents the status flags for a single data frame. .. cpp: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. .. cpp:member:: uint16_t val Combined 16-bit view of status flags. .. cpp:member:: uint8_t bytes[1] Raw byte-level access. .. raw:: html
BotaFrame Struct
Represents a full frame, including status, wrench, imu data, temperature and timestamp. .. cpp:struct:: BotaFrame .. cpp:member:: DataStatus status Bitfield status information about the frame. .. cpp:member:: std::array force Force vector `[Fx, Fy, Fz]` in Newtons. .. cpp:member:: std::array torque Torque vector `[Tx, Ty, Tz]` in Newton-meters. .. cpp:member:: uint32_t timestamp Timestamp of the frame in microseconds since boot. .. cpp:member:: float temperature Internal temperature in degrees Celsius. .. cpp:member:: std::array acceleration Linear acceleration `[Ax, Ay, Az]` in m/s². .. cpp:member:: std::array angular_rate Angular velocity `[Wx, Wy, Wz]` in rad/s. .. cpp:function:: BotaFrame(DataStatus status_data, std::array force_data, std::array torque_data, uint32_t timestamp_data, float temperature_data, std::array acceleration_data, std::array angular_rate_data) Constructs a frame with all sensor data. BotaDriver class public interface ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. cpp:class:: BotaDriver Public interface of the BotaDriver class. .. raw:: html
Constructor and destructor
.. cpp:function:: BotaDriver(const std::string &config_path) Constructor that initializes the driver using a JSON configuration file. The path to the file must be provided. .. cpp:function:: ~BotaDriver() Default destructor. .. raw:: html
Lifecycle management methods
.. cpp:function:: 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``. .. cpp:function:: 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``. .. cpp:function:: 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``. .. cpp:function:: 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``. .. cpp:function:: bool shutdown() Shuts down the driver and releases resources. Returns ``false`` if something failed, otherwise ``true``. .. raw:: html
User functions
.. cpp:function:: 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``. .. cpp:function:: BotaFrame readFrame() const Returns the most recent available frame. It can only be called in the ``ACTIVE`` state, otherwise an error will be raised. .. cpp:function:: 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. .. raw:: html
Getters
.. cpp:function:: DriverState getDriverState() const Returns the current internal driver state. .. cpp:function:: std::chrono::microseconds getExpectedTimestep() const Returns the expected update interval of the sensor data. .. cpp:function:: uint16_t getDriverVersionGeneration() Returns the generation number of the driver version (e.g., first digit in ``X.Y.Z``). .. cpp:function:: uint16_t getDriverVersionMajor() Returns the major version number (second digit in ``X.Y.Z``). .. cpp:function:: uint16_t getDriverVersionMinor() Returns the minor version number (third digit in ``X.Y.Z``). .. cpp:function:: std::string getDriverVersionString() Returns a string representation of the driver version.