Skip to content

Commit 1bcac0e

Browse files
committed
Added functionality to check if a RTDE data package value is of a given type
1 parent 8b7bccd commit 1bcac0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ur_robot_driver/include/ur_robot_driver/rtde/data_package.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,19 @@ class DataPackage : public RTDEPackage
102102
*/
103103
size_t serializePackage(uint8_t* buffer);
104104

105+
/*!
106+
* \brief Check if a specific data field is of a given type.
107+
*
108+
* \param name The string identifier for the data field as used in the documentation.
109+
*
110+
* \returns True, if the data field is of the given type, false otherwise.
111+
*/
112+
template <typename T>
113+
static bool isType(const std::string& name)
114+
{
115+
return g_type_list[name].which() == _rtde_type_variant(T()).which();
116+
}
117+
105118
/*!
106119
* \brief Get a data field from the DataPackage.
107120
*

0 commit comments

Comments
 (0)