Classes | Public Types | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
urcl::rtde_interface::DataPackage Class Reference

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. More...

#include <data_package.h>

Inheritance diagram for urcl::rtde_interface::DataPackage:
Inheritance graph
[legend]

Classes

struct  ParseVisitor
 
struct  SerializeVisitor
 
struct  SizeVisitor
 
struct  StringVisitor
 

Public Types

using _rtde_type_variant = boost::variant< bool, uint8_t, uint32_t, uint64_t, int32_t, double, vector3d_t, vector6d_t, vector6int32_t, vector6uint32_t, std::string >
 
- Public Types inherited from urcl::comm::URPackage< PackageHeader >
using HeaderType = PackageHeader
 

Public Member Functions

 DataPackage ()=delete
 
 DataPackage (const DataPackage &other)
 
 DataPackage (const std::vector< std::string > &recipe)
 Creates a new DataPackage object, based on a given recipe. More...
 
template<typename T >
bool getData (const std::string &name, T &val)
 Get a data field from the DataPackage. More...
 
template<typename T , size_t N>
bool getData (const std::string &name, std::bitset< N > &val)
 Get a data field from the DataPackage as bitset. More...
 
void initEmpty ()
 Initializes to contained list with empty values based on the recipe. More...
 
virtual bool parseWith (comm::BinParser &bp)
 Sets the attributes of the package by parsing a serialized representation of the package. More...
 
size_t serializePackage (uint8_t *buffer)
 Serializes the package. More...
 
template<typename T >
bool setData (const std::string &name, T &val)
 Set a data field in the DataPackage. More...
 
void setRecipeID (const uint8_t &recipe_id)
 Setter of the recipe id value used to identify the used recipe to the robot. More...
 
virtual std::string toString () const
 Produces a human readable representation of the package object. More...
 
virtual ~DataPackage ()=default
 
- Public Member Functions inherited from urcl::rtde_interface::RTDEPackage
 RTDEPackage ()=delete
 Creates a new RTDEPackage object. More...
 
 RTDEPackage (const PackageType type)
 
virtual ~RTDEPackage ()=default
 
- Public Member Functions inherited from urcl::comm::URPackage< PackageHeader >
 URPackage ()=default
 Creates a new URPackage object. More...
 
virtual ~URPackage ()=default
 

Private Attributes

std::unordered_map< std::string, _rtde_type_variantdata_
 
std::vector< std::string > recipe_
 
uint8_t recipe_id_
 

Static Private Attributes

static std::unordered_map< std::string, _rtde_type_variantg_type_list
 

Additional Inherited Members

- Protected Attributes inherited from urcl::rtde_interface::RTDEPackage
std::unique_ptr< uint8_t > buffer_
 
size_t buffer_length_
 
PackageType type_
 

Detailed Description

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.

Definition at line 59 of file data_package.h.

Member Typedef Documentation

using urcl::rtde_interface::DataPackage::_rtde_type_variant = boost::variant<bool, uint8_t, uint32_t, uint64_t, int32_t, double, vector3d_t, vector6d_t, vector6int32_t, vector6uint32_t, std::string>

Definition at line 63 of file data_package.h.

Constructor & Destructor Documentation

urcl::rtde_interface::DataPackage::DataPackage ( )
delete
urcl::rtde_interface::DataPackage::DataPackage ( const DataPackage other)
inline

Definition at line 67 of file data_package.h.

urcl::rtde_interface::DataPackage::DataPackage ( const std::vector< std::string > &  recipe)
inline

Creates a new DataPackage object, based on a given recipe.

Parameters
recipeThe used recipe

Definition at line 77 of file data_package.h.

virtual urcl::rtde_interface::DataPackage::~DataPackage ( )
virtualdefault

Member Function Documentation

template<typename T >
bool urcl::rtde_interface::DataPackage::getData ( const std::string &  name,
T &  val 
)
inline

Get a data field from the DataPackage.

The data package contains a lot of different data fields, depending on the recipe.

Parameters
nameThe string identifier for the data field as used in the documentation.
valTarget variable. Make sure, it's the correct type.
Exceptions
boost::bad_getif the type under given name does not match the template type T.
Returns
True on success, false if the field cannot be found inside the package.

Definition at line 124 of file data_package.h.

template<typename T , size_t N>
bool urcl::rtde_interface::DataPackage::getData ( const std::string &  name,
std::bitset< N > &  val 
)
inline

Get a data field from the DataPackage as bitset.

The data package contains a lot of different data fields, depending on the recipe.

Parameters
nameThe string identifier for the data field as used in the documentation.
valTarget variable. Make sure, it's the correct type.
Exceptions
boost::bad_getif the type under given name does not match the template type T.
Returns
True on success, false if the field cannot be found inside the package.

Definition at line 149 of file data_package.h.

void urcl::rtde_interface::DataPackage::initEmpty ( )

Initializes to contained list with empty values based on the recipe.

Definition at line 557 of file data_package.cpp.

bool urcl::rtde_interface::DataPackage::parseWith ( comm::BinParser bp)
virtual

Sets the attributes of the package by parsing a serialized representation of the package.

Parameters
bpA parser containing a serialized version of the package
Returns
True, if the package was parsed successfully, false otherwise

Reimplemented from urcl::rtde_interface::RTDEPackage.

Definition at line 569 of file data_package.cpp.

size_t urcl::rtde_interface::DataPackage::serializePackage ( uint8_t *  buffer)

Serializes the package.

Parameters
bufferBuffer to fill with the serialization
Returns
The total size of the serialized package

Definition at line 600 of file data_package.cpp.

template<typename T >
bool urcl::rtde_interface::DataPackage::setData ( const std::string &  name,
T &  val 
)
inline

Set a data field in the DataPackage.

The data package contains a lot of different data fields, depending on the recipe.

Parameters
nameThe string identifier for the data field as used in the documentation.
valValue to set. Make sure, it's the correct type.
Returns
True on success, false if the field cannot be found inside the package.

Definition at line 175 of file data_package.h.

void urcl::rtde_interface::DataPackage::setRecipeID ( const uint8_t &  recipe_id)
inline

Setter of the recipe id value used to identify the used recipe to the robot.

Parameters
recipe_idThe new value

Definition at line 193 of file data_package.h.

std::string urcl::rtde_interface::DataPackage::toString ( ) const
virtual

Produces a human readable representation of the package object.

Returns
A string representing the object

Reimplemented from urcl::rtde_interface::RTDEPackage.

Definition at line 589 of file data_package.cpp.

Member Data Documentation

std::unordered_map<std::string, _rtde_type_variant> urcl::rtde_interface::DataPackage::data_
private

Definition at line 202 of file data_package.h.

std::unordered_map< std::string, DataPackage::_rtde_type_variant > urcl::rtde_interface::DataPackage::g_type_list
staticprivate

Definition at line 200 of file data_package.h.

std::vector<std::string> urcl::rtde_interface::DataPackage::recipe_
private

Definition at line 203 of file data_package.h.

uint8_t urcl::rtde_interface::DataPackage::recipe_id_
private

Definition at line 201 of file data_package.h.


The documentation for this class was generated from the following files:


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26