Class DataPackage
Defined in File data_package.h
Inheritance Relationships
Base Type
public urcl::rtde_interface::RTDEPackage
(Class RTDEPackage)
Class Documentation
-
class DataPackage : public urcl::rtde_interface::RTDEPackage
The DataPackage class handles communication in the form of RTDE data packages both to and from the robot. It contains functionality to parse and serialize packages for arbitrary recipes.
Public Types
-
using _rtde_type_variant = std::variant<bool, uint8_t, uint32_t, uint64_t, int32_t, double, vector3d_t, vector6d_t, vector6int32_t, vector6uint32_t, std::string>
Public Functions
-
DataPackage() = delete
-
inline DataPackage(const DataPackage &other)
-
inline DataPackage(const std::vector<std::string> &recipe, const uint16_t &protocol_version = 2)
Creates a new DataPackage object, based on a given recipe.
- Parameters:
recipe – The used recipe
protocol_version – Protocol version used for the RTDE communication
-
virtual ~DataPackage() = default
-
void initEmpty()
Initializes to contained list with empty values based on the recipe.
-
virtual bool parseWith(comm::BinParser &bp)
Sets the attributes of the package by parsing a serialized representation of the package.
- Parameters:
bp – A parser containing a serialized version of the package
- Returns:
True, if the package was parsed successfully, false otherwise
-
virtual std::string toString() const
Produces a human readable representation of the package object.
- Returns:
A string representing the object
-
size_t serializePackage(uint8_t *buffer)
Serializes the package.
- Parameters:
buffer – Buffer to fill with the serialization
- Returns:
The total size of the serialized package
-
template<typename T>
inline bool getData(const std::string &name, T &val) Get a data field from the DataPackage.
The data package contains a lot of different data fields, depending on the recipe.
- Parameters:
name – The string identifier for the data field as used in the documentation.
val – Target variable. Make sure, it’s the correct type.
- Returns:
True on success, false if the field cannot be found inside the package.
-
template<typename T, size_t N>
inline bool getData(const std::string &name, std::bitset<N> &val) Get a data field from the DataPackage as bitset.
The data package contains a lot of different data fields, depending on the recipe.
- Parameters:
name – The string identifier for the data field as used in the documentation.
val – Target variable. Make sure, it’s the correct type.
- Returns:
True on success, false if the field cannot be found inside the package.
-
template<typename T>
inline bool setData(const std::string &name, T &val) Set a data field in the DataPackage.
The data package contains a lot of different data fields, depending on the recipe.
- Parameters:
name – The string identifier for the data field as used in the documentation.
val – Value to set. Make sure, it’s the correct type.
- Returns:
True on success, false if the field cannot be found inside the package.
-
inline void setRecipeID(const uint8_t &recipe_id)
Setter of the recipe id value used to identify the used recipe to the robot.
- Parameters:
recipe_id – The new value
-
using _rtde_type_variant = std::variant<bool, uint8_t, uint32_t, uint64_t, int32_t, double, vector3d_t, vector6d_t, vector6int32_t, vector6uint32_t, std::string>