28 #ifndef UR_CLIENT_LIBRARY_DATA_PACKAGE_H_INCLUDED 29 #define UR_CLIENT_LIBRARY_DATA_PACKAGE_H_INCLUDED 31 #include <unordered_map> 36 #include <boost/variant.hpp> 40 namespace rtde_interface
69 this->data_ = other.
data_;
101 virtual std::string toString()
const;
110 size_t serializePackage(uint8_t* buffer);
123 template <
typename T>
126 if (data_.find(name) != data_.end())
128 val = boost::strict_get<T>(data_[name]);
148 template <
typename T,
size_t N>
149 bool getData(
const std::string& name, std::bitset<N>& val)
151 static_assert(
sizeof(T) * 8 >= N,
"Bitset is too large for underlying variable");
153 if (data_.find(name) != data_.end())
155 val = std::bitset<N>(boost::strict_get<T>(data_[name]));
174 template <
typename T>
177 if (data_.find(name) != data_.end())
195 recipe_id_ = recipe_id;
200 static std::unordered_map<std::string, _rtde_type_variant>
g_type_list;
202 std::unordered_map<std::string, _rtde_type_variant>
data_;
207 template <
typename T>
215 template <
typename T>
218 std::stringstream ss;
225 template <
typename T>
233 template <
typename T>
244 #endif // ifndef UR_CLIENT_LIBRARY_DATA_PACKAGE_H_INCLUDED void operator()(T &d, comm::BinParser &bp) const
void parse(T &val)
Parses the next bytes as given type.
DataPackage(const DataPackage &other)
size_t operator()(T &d, uint8_t *buffer) const
The BinParser class handles a byte buffer and functionality to iteratively parse the content...
bool getData(const std::string &name, T &val)
Get a data field from the DataPackage.
std::unordered_map< std::string, _rtde_type_variant > data_
std::array< double, 3 > vector3d_t
PackageType
Possible package types.
std::string operator()(T &d) const
uint16_t operator()(T &d) const
RUNTIME_STATE
Possible values for the runtime state.
boost::variant< bool, uint8_t, uint32_t, uint64_t, int32_t, double, vector3d_t, vector6d_t, vector6int32_t, vector6uint32_t, std::string > _rtde_type_variant
DataPackage(const std::vector< std::string > &recipe)
Creates a new DataPackage object, based on a given recipe.
std::array< int32_t, 6 > vector6int32_t
bool getData(const std::string &name, std::bitset< N > &val)
Get a data field from the DataPackage as bitset.
void setRecipeID(const uint8_t &recipe_id)
Setter of the recipe id value used to identify the used recipe to the robot.
static size_t serialize(uint8_t *buffer, T val)
A generalized serialization method for arbitrary datatypes.
std::array< uint32_t, 6 > vector6uint32_t
std::vector< std::string > recipe_
std::array< double, 6 > vector6d_t
The DataPackage class handles communication in the form of RTDE data packages both to and from the ro...
static std::unordered_map< std::string, _rtde_type_variant > g_type_list
bool setData(const std::string &name, T &val)
Set a data field in the DataPackage.