29 #ifndef UR_CLIENT_LIBRARY_DATA_PACKAGE_H_INCLUDED 30 #define UR_CLIENT_LIBRARY_DATA_PACKAGE_H_INCLUDED 32 #include <unordered_map> 41 namespace rtde_interface
70 this->data_ = other.
data_;
81 DataPackage(
const std::vector<std::string>& recipe,
const uint16_t& protocol_version = 2)
106 virtual std::string toString()
const;
115 size_t serializePackage(uint8_t* buffer);
127 template <
typename T>
130 if (data_.find(name) != data_.end())
132 val = std::get<T>(data_[name]);
151 template <
typename T,
size_t N>
152 bool getData(
const std::string& name, std::bitset<N>& val)
154 static_assert(
sizeof(T) * 8 >= N,
"Bitset is too large for underlying variable");
156 if (data_.find(name) != data_.end())
158 val = std::bitset<N>(std::get<T>(data_[name]));
177 template <
typename T>
180 if (data_.find(name) != data_.end())
198 recipe_id_ = recipe_id;
203 static std::unordered_map<std::string, _rtde_type_variant>
g_type_list;
205 std::unordered_map<std::string, _rtde_type_variant>
data_;
213 #endif // ifndef UR_CLIENT_LIBRARY_DATA_PACKAGE_H_INCLUDED
DataPackage(const DataPackage &other)
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.
RUNTIME_STATE
Possible values for the runtime state.
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.
uint16_t protocol_version_
std::array< uint32_t, 6 > vector6uint32_t
std::vector< std::string > recipe_
DataPackage(const std::vector< std::string > &recipe, const uint16_t &protocol_version=2)
Creates a new DataPackage object, based on a given 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...
std::variant< bool, uint8_t, uint32_t, uint64_t, int32_t, double, vector3d_t, vector6d_t, vector6int32_t, vector6uint32_t, std::string > _rtde_type_variant
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.