From c4fad15f138ab9065a4d6a0e1ce5e98d9fe7e00c Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 5 Mar 2026 12:14:13 +0100 Subject: [PATCH 1/3] Add implementation of creating ExampleRobotWrapper with recipe vectors The signature was added earlier, but the implementation was missing --- .../ur_client_library/example_robot_wrapper.h | 2 + src/example_robot_wrapper.cpp | 50 +++++++++++++------ tests/test_ur_driver.cpp | 2 +- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/include/ur_client_library/example_robot_wrapper.h b/include/ur_client_library/example_robot_wrapper.h index 06c31c202..08589eb7f 100644 --- a/include/ur_client_library/example_robot_wrapper.h +++ b/include/ur_client_library/example_robot_wrapper.h @@ -181,6 +181,8 @@ class ExampleRobotWrapper private: void handleRobotProgramState(bool program_running); + void initInternal(const UrDriverConfiguration& driver_config); + //! Dashboard client to interact with the robot std::shared_ptr dashboard_client_; diff --git a/src/example_robot_wrapper.cpp b/src/example_robot_wrapper.cpp index fed647794..74a8b8311 100644 --- a/src/example_robot_wrapper.cpp +++ b/src/example_robot_wrapper.cpp @@ -41,7 +41,37 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std: const std::string& autostart_program, const std::string& script_file) : headless_mode_(headless_mode), autostart_program_(autostart_program) { - primary_client_ = std::make_shared(robot_ip, notifier_); + UrDriverConfiguration driver_config; + driver_config.robot_ip = robot_ip; + driver_config.script_file = script_file; + driver_config.output_recipe_file = output_recipe_file; + driver_config.input_recipe_file = input_recipe_file; + driver_config.handle_program_state = + std::bind(&ExampleRobotWrapper::handleRobotProgramState, this, std::placeholders::_1); + driver_config.headless_mode = headless_mode; + initInternal(driver_config); +} + +ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std::vector output_recipe, + const std::vector input_recipe, const bool headless_mode, + const std::string& autostart_program, const std::string& script_file) + : headless_mode_(headless_mode), autostart_program_(autostart_program) +{ + + UrDriverConfiguration driver_config; + driver_config.robot_ip = robot_ip; + driver_config.script_file = script_file; + driver_config.output_recipe = output_recipe; + driver_config.input_recipe = input_recipe; + driver_config.handle_program_state = + std::bind(&ExampleRobotWrapper::handleRobotProgramState, this, std::placeholders::_1); + driver_config.headless_mode = headless_mode; + initInternal(driver_config); +} + +void ExampleRobotWrapper::initInternal(const UrDriverConfiguration& driver_config) +{ + primary_client_ = std::make_shared(driver_config.robot_ip, notifier_); primary_client_->start(); @@ -52,7 +82,7 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std: const DashboardClient::ClientPolicy client_policy = *robot_version < VersionInformation::fromString("10.0.0") ? DashboardClient::ClientPolicy::G5 : DashboardClient::ClientPolicy::POLYSCOPE_X; - dashboard_client_ = std::make_shared(robot_ip, client_policy); + dashboard_client_ = std::make_shared(driver_config.robot_ip, client_policy); // Connect the robot Dashboard if (!dashboard_client_->connect()) { @@ -71,29 +101,21 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std: { throw UrException("Could not initialize robot with primary client"); } - - UrDriverConfiguration driver_config; - driver_config.robot_ip = robot_ip; - driver_config.script_file = script_file; - driver_config.output_recipe_file = output_recipe_file; - driver_config.input_recipe_file = input_recipe_file; - driver_config.handle_program_state = - std::bind(&ExampleRobotWrapper::handleRobotProgramState, this, std::placeholders::_1); - driver_config.headless_mode = headless_mode; ur_driver_ = std::make_shared(driver_config); - if (!headless_mode && !std::empty(autostart_program)) + if (!headless_mode_ && !std::empty(autostart_program_)) { - startRobotProgram(autostart_program); + startRobotProgram(autostart_program_); } - if (headless_mode || !std::empty(autostart_program)) + if (headless_mode_ || !std::empty(autostart_program_)) { if (!waitForProgramRunning(500)) { throw UrException("Program did not start running. Is the robot in remote control?"); } } + } ExampleRobotWrapper::~ExampleRobotWrapper() diff --git a/tests/test_ur_driver.cpp b/tests/test_ur_driver.cpp index c9fbf3792..188bf06f8 100644 --- a/tests/test_ur_driver.cpp +++ b/tests/test_ur_driver.cpp @@ -95,7 +95,7 @@ class UrDriverTest : public ::testing::Test GTEST_SKIP_("Running URCap tests for PolyScope X is currently not supported."); } // Setup driver - g_my_robot = std::make_unique(g_ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, g_HEADLESS, + g_my_robot = std::make_unique(g_ROBOT_IP, OUTPUT_RECIPE_VECTOR, INPUT_RECIPE_VECTOR, g_HEADLESS, "external_control.urp", SCRIPT_FILE); g_my_robot->startRTDECommununication(true); From ef4cbd72d73c6458086a615decef94cb5279c182 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 5 Mar 2026 12:19:37 +0100 Subject: [PATCH 2/3] format --- src/example_robot_wrapper.cpp | 2 -- tests/test_ur_driver.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/example_robot_wrapper.cpp b/src/example_robot_wrapper.cpp index 74a8b8311..896da21c6 100644 --- a/src/example_robot_wrapper.cpp +++ b/src/example_robot_wrapper.cpp @@ -57,7 +57,6 @@ ExampleRobotWrapper::ExampleRobotWrapper(const std::string& robot_ip, const std: const std::string& autostart_program, const std::string& script_file) : headless_mode_(headless_mode), autostart_program_(autostart_program) { - UrDriverConfiguration driver_config; driver_config.robot_ip = robot_ip; driver_config.script_file = script_file; @@ -115,7 +114,6 @@ void ExampleRobotWrapper::initInternal(const UrDriverConfiguration& driver_confi throw UrException("Program did not start running. Is the robot in remote control?"); } } - } ExampleRobotWrapper::~ExampleRobotWrapper() diff --git a/tests/test_ur_driver.cpp b/tests/test_ur_driver.cpp index 188bf06f8..eb69aa54c 100644 --- a/tests/test_ur_driver.cpp +++ b/tests/test_ur_driver.cpp @@ -95,8 +95,8 @@ class UrDriverTest : public ::testing::Test GTEST_SKIP_("Running URCap tests for PolyScope X is currently not supported."); } // Setup driver - g_my_robot = std::make_unique(g_ROBOT_IP, OUTPUT_RECIPE_VECTOR, INPUT_RECIPE_VECTOR, g_HEADLESS, - "external_control.urp", SCRIPT_FILE); + g_my_robot = std::make_unique(g_ROBOT_IP, OUTPUT_RECIPE_VECTOR, INPUT_RECIPE_VECTOR, + g_HEADLESS, "external_control.urp", SCRIPT_FILE); g_my_robot->startRTDECommununication(true); } From 2240f40d140bc86efa6eddf1de0f577edbe780be Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 12 Mar 2026 17:08:15 +0100 Subject: [PATCH 3/3] Use unused RTDE fields for checking vector vs. file --- tests/test_ur_driver.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/test_ur_driver.cpp b/tests/test_ur_driver.cpp index eb69aa54c..d1398c744 100644 --- a/tests/test_ur_driver.cpp +++ b/tests/test_ur_driver.cpp @@ -43,6 +43,7 @@ const std::string SCRIPT_FILE = "../resources/external_control.urscript"; const std::string OUTPUT_RECIPE = "resources/rtde_output_recipe.txt"; const std::string INPUT_RECIPE = "resources/rtde_input_recipe.txt"; const std::vector OUTPUT_RECIPE_VECTOR = { "timestamp", + "actual_q", "actual_qd", "speed_scaling", "target_speed_fraction", @@ -66,19 +67,23 @@ const std::vector OUTPUT_RECIPE_VECTOR = { "timestamp", "robot_mode", "safety_mode", "robot_status_bits", - "safety_status_bits", "actual_current", "tcp_offset" }; const std::vector INPUT_RECIPE_VECTOR = { - "speed_slider_mask", "standard_digital_output_mask", - "standard_digital_output", "configurable_digital_output_mask", - "configurable_digital_output", "tool_digital_output_mask", - "tool_digital_output", "standard_analog_output_mask", - "standard_analog_output_type", "standard_analog_output_0", - "standard_analog_output_1" + "speed_slider_fraction", + "speed_slider_mask", + "standard_digital_output_mask", + "standard_digital_output", + "configurable_digital_output_mask", + "configurable_digital_output", + "tool_digital_output_mask", + "tool_digital_output", + "standard_analog_output_mask", + "standard_analog_output_type", + "standard_analog_output_0", }; -const std::string OUTPUT_RECIPE_VECTOR_EXCLUDED_VALUE = "actual_q"; -const std::string INPUT_RECIPE_VECTOR_EXCLUDED_VALUE = "speed_slider_fraction"; +const std::string OUTPUT_RECIPE_VECTOR_EXCLUDED_VALUE = "safety_status_bits"; +const std::string INPUT_RECIPE_VECTOR_EXCLUDED_VALUE = "standard_analog_output_1"; const std::string CALIBRATION_CHECKSUM = "calib_12788084448423163542"; std::string g_ROBOT_IP = "192.168.56.101"; bool g_HEADLESS = true;