HEBI C++ API
3.12.0
|
The C++ API provides a more user-friendly interface to the HEBI C API. For those familiar with the C API, the core concepts here are the same.
The purpose of this API is to allow the user to communicate with groups of HEBI modules. This is accomplished by sending commands to the modules or by requesting feedback and other info from the modules.
A good place to start is figuring out how to create a group – this is done through the lookup, which acts as a registry of modules.
Then, look at the basic functionality of a group - how to send commands and receive feedback and other info.
Finally, dig into the details of the command, feedback, and info structures to see all of the information that you can send to and receive from the modules.
Along the way, there are plenty of examples to help you get started – these are a great place to start for those just wanting to jump right in. See github.com/HebiRobotics/hebi-cpp-examples. These will help you get started with compiling and using the API in your own project as well.
First, note that this library was designed to be used with the C++11 standard, and is not compatible with C++03. Ensure that you have the proper compiler switches to enable this support (e.g., -std=c++11 for gcc).
Integrating the library in your own project follows the basic approach taken by the examples (and looking through the CMakeLists.txt file is a good start). The steps are:
The third step is the tricky one – for projects using CMake, this should be relatively straightforward by following the example of the CMakeLists.txt used for the example code. Of course, your build system may be significantly different, even when using CMake. Basically, the crucial elements are a few command line parameters during compilation and linking of your project (the arguments below assume you are using gcc or g++):
Generally, users of the C++ API should restrict themselves to the documented public functions of the classes in the C++ API (those in the 'src' directory). There are a handful of public functions which are marked as 'internal'; these must be public due to certain class interactions, but should not be used except by other classes in the API.
Files in the C++ API are able to be modified by the user, but this is not recommended as (1) there may be unintended side effects and (2) future API updates may change these files arbitrarily.
Similarly, users of the C++ API are expected to only access HEBI modules through the C++ API; direct use of the lower-level C API along with the C++ API is not recommended, as the C++ wrappers are designed to prevent memory management pitfalls.