|
Robot Raconteur Companion C++ Library
|
The Robot Raconteur companion library contains utilities for working with Robot Raconteur services and devices. This companion library is intended to be used with the Robot Raconteur Core library (https://github.com/robotraconteur/robotraconteur). The companion library is written in C++ and is compatible with C++11 and later.
Robot Raconteur Core focuses on the core capabilities of Robot Raconteur, such as transport, discovery, and communication. The companion contains a number of miscellaneous utilities that are useful for working with other libraries such as Eigen, and for working with standard Robot Raconteur service types (https://github.com/robotraconteur/robotraconteur_standard_robdef).
The companion library is not required to use Robot Raconteur, but is recommended for most users.
The companion is intended to evolve faster than the core library, and accept contributions from the community.
The companion library is licensed under the Apache 2.0 license.
The Robot Raconteur Companion library contains the following utilities:
Documentation can be found at https://robotraconteur.github.io/robotraconteur_companion/
The library contains compiled standard service type thunk code. To use the standard service types without custom types, use the following in the CMake lists:
In the program initialization, use:
If custom service types are being used in the program, use the following:
In the program initialization, use:
Device Info structures are used to describe devices and their capabilities. The structures are provided to clients at runtime, typically through a property of a device service. For example, the com.robotraconteur.device.Device standard type defines the device_info property. The com.robotraconteur.robotics.robot.Robot standard type defines both device_info and robot_info properties. These structures can be used to describe a wide variety of devices, including robots, sensors, and other devices. YAML files are used to store the contents of these structures to make it easier to create and edit them. The Robot Raconteur companion library contains parsers for these YAML files. The following device info structure types are supported:
The parsers can be accessed using the RobotRaconteur::Companion::Util::LoadInfoFileFromString(), RobotRaconteur::Companion::Util::LoadInfoFile(), or RobotRaconteur::Companion::Util::LoadInfoFromNode() functions. These functions are in the RobotRaconteurCompanion/Util/LoadInfoFile.h header. The header file RobotRaconteurCompanion/Util/InfoParser/yaml/yaml_parser_all.h should be included to include all of the parser implementations.
A typical program will include:
And somewhere in the program, load the info. This example is for the joystick info structure, but the same pattern can be used for any of the info structures.
The Eigen library is a popular C++ library for linear algebra. The Robot Raconteur companion library provides converters for Eigen types to and from Robot Raconteur types. See the doxygen documentation for RobotRaconteurCompanion/Converters/EigenConverters.h for more information on the available converters.
The Robot Raconteur companion library provides converters for date/time types to and from Robot Raconteur types.
The companian library supports several time representations:
The companion library provides functions to populate and convert these types.
See the doxygen documentation for RobotRaconteurCompanion/Util/DateTimeUtil.h for more information on the available converters.
Robot Raconteur identifiers use a combination of a UUID and a string name. This allows for the UUID to be used in a production environment, while a simple string can be used when a human-readable name is needed.
The type com.robotraconteur.identifier.Identifier is used by standard types for identifiers. The companion library provides functions to populate and convert these types.
See the doxygen documentation for RobotRaconteurCompanion/Util/IdentifierUtil.h for more information on the available functions.
The type com.robotraconteur.uuid.UUID is used to represent a UUID by the Robot Raconteur standard types. The companion library provides functions to populate and convert these types.
See the doxygen documentation for RobotRaconteurCompanion/Util/UuidUtil.h for more information on the available functions.
Service Attributes are used to provide additional information about a service. This information is usually available during discovery, and can be used to select the appropriate service. The Robot Raconteur standard types are expected to populate the following attributes:
An example of using the service attributes utilities from the companion library is shown below for a joystick service:
Include files:
And somewhere in the program:
See the doxygen documentation for RobotRaconteurCompanion/Util/AttributesUtil.h for more information on the available functions.
"Sensor Data" is a concept used to provide loggable data from a sensor. The data is typically transmitted using a pipe member, and has a com.robotraconteur.sensordata.SensorDataHeader field as the first field in the data structure. The Robot Raconteur companion library provides functions to populate this structure.
An example using the sensor data utilities from the companion library is shown below for a joystick service:
See the doxygen documentation for RobotRaconteurCompanion/Util/SensorDataUtil.h for more information on the available functions.
The companion library can be built using the standard CMake build process.
vcpkg can also be used to build the companion library for use with your application. See https://github.com/microsoft/vcpkg for installation instructions.
To build Robot Raconteur, clone the vcpkg-robotraconteur overlay repo in the vcpkg directory:
and build the library:
To build x64, use:
Apache 2.0