File tree Expand file tree Collapse file tree
include/ur_client_library/ur Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -267,4 +267,31 @@ inline std::string robotTypeString(const RobotType& type)
267267 }
268268}
269269
270+ /* *
271+ * @brief Converts a RobotSeries enum value to its corresponding string representation.
272+ *
273+ * This function takes a RobotSeries enum value and returns a string that represents the robot series.
274+ * If the provided RobotSeries value does not match any known series, it logs a warning and returns "UNDEFINED".
275+ *
276+ * @param series The RobotSeries enum value to convert.
277+ * @return A string representation of the robot series.
278+ */
279+ inline std::string robotSeriesString (const RobotSeries& series)
280+ {
281+ switch (series)
282+ {
283+ case RobotSeries::CB3 :
284+ return " CB3" ;
285+ case RobotSeries::E_SERIES :
286+ return " E_SERIES" ;
287+ case RobotSeries::UR_SERIES :
288+ return " UR_SERIES" ;
289+ default :
290+ std::stringstream ss;
291+ ss << " Unknown Robot Series: " << static_cast <int >(series);
292+ URCL_LOG_WARN (ss.str ().c_str ());
293+ return " UNDEFINED" ;
294+ }
295+ }
296+
270297} // namespace urcl
Original file line number Diff line number Diff line change @@ -137,3 +137,11 @@ TEST(TestHelpers, robotSeriesFromTypeAndVersion)
137137 EXPECT_EQ (robotSeriesFromTypeAndVersion (RobotType::UNDEFINED , cb3_version), RobotSeries::UNDEFINED );
138138 EXPECT_EQ (robotSeriesFromTypeAndVersion (RobotType::UNDEFINED , polyscope_x_version), RobotSeries::UNDEFINED );
139139}
140+
141+ TEST (TestHelpers, robotSeriesString)
142+ {
143+ EXPECT_EQ (robotSeriesString (RobotSeries::CB3 ), " CB3" );
144+ EXPECT_EQ (robotSeriesString (RobotSeries::E_SERIES ), " E_SERIES" );
145+ EXPECT_EQ (robotSeriesString (RobotSeries::UR_SERIES ), " UR_SERIES" );
146+ EXPECT_EQ (robotSeriesString (RobotSeries::UNDEFINED ), " UNDEFINED" );
147+ }
You can’t perform that action at this time.
0 commit comments