From 7bab9d14603234fa88f047cf78ea6794cd869454 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Mon, 11 May 2026 17:33:53 +0200 Subject: [PATCH 1/5] Use control frequency to throttle output --- examples/external_fts_through_rtde.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/external_fts_through_rtde.cpp b/examples/external_fts_through_rtde.cpp index a3c9173cc..bd4bb35d1 100644 --- a/examples/external_fts_through_rtde.cpp +++ b/examples/external_fts_through_rtde.cpp @@ -213,6 +213,12 @@ void rtdeWorker(const int second_to_run) auto start_time = std::chrono::steady_clock::now(); std::unique_ptr data_pkg = std::make_unique(g_my_robot->getUrDriver()->getRTDEOutputRecipe()); + int frequency = g_my_robot->getUrDriver()->getControlFrequency(); + int period_ms = 2; + if (frequency > 0) + { + period_ms = static_cast(1000.0 / frequency); + } while (g_RUNNING) { urcl::vector6d_t local_ft_vec = g_FT_VEC; @@ -224,7 +230,7 @@ void rtdeWorker(const int second_to_run) // Throttle output to once per second if (std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time).count() % 1000 < - 2) + period_ms) std::cout << "Force-torque reported by robot: " << actual_tcp_force << std::endl; } else From 59a23965b1601d025e3f720226e1e7a9b4411559 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Mon, 11 May 2026 17:34:27 +0200 Subject: [PATCH 2/5] REVERT_ME: Debug fts example --- examples/external_fts_through_rtde.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/external_fts_through_rtde.cpp b/examples/external_fts_through_rtde.cpp index bd4bb35d1..cddfe93ef 100644 --- a/examples/external_fts_through_rtde.cpp +++ b/examples/external_fts_through_rtde.cpp @@ -227,11 +227,15 @@ void rtdeWorker(const int second_to_run) // Data fields in the data package are accessed by their name. Only names present in the // output recipe can be accessed. Otherwise this function will return false. data_pkg->getData("actual_TCP_force", actual_tcp_force); + std::stringstream ss; + ss << std::fixed << std::setprecision(2) << actual_tcp_force; // Throttle output to once per second if (std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time).count() % 1000 < period_ms) - std::cout << "Force-torque reported by robot: " << actual_tcp_force << std::endl; + { + URCL_LOG_INFO("Force-torque reported by robot: %s", ss.str().c_str()); + } } else { @@ -258,6 +262,10 @@ void rtdeWorker(const int second_to_run) g_RUNNING = std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time).count() < second_to_run; + if (!g_RUNNING) + { + std::cout << "Time limit reached. Stopping." << std::endl; + } } } } From 526d6c30949bb1f0b4b0d8fcec4dd0c69edd5989 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Tue, 12 May 2026 08:37:56 +0200 Subject: [PATCH 3/5] When in CI, do not evaluate keyboard input Github actions seem to send keyboard input to the program with a very high frequency. --- .github/workflows/ci.yml | 2 ++ examples/external_fts_through_rtde.cpp | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08ab61463..28974f7a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,8 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: run examples run: ./run_examples.sh "192.168.56.101" 1 + env: + URCL_EXAMPLES_IN_CI: 1 - name: install gcovr if: ${{ !cancelled() && steps.build.outcome == 'success' }} run: sudo apt-get install -y gcovr diff --git a/examples/external_fts_through_rtde.cpp b/examples/external_fts_through_rtde.cpp index cddfe93ef..4dcad11b8 100644 --- a/examples/external_fts_through_rtde.cpp +++ b/examples/external_fts_through_rtde.cpp @@ -298,11 +298,19 @@ int main(int argc, char* argv[]) // The RTDE thread sends the force-torque data to the robot and receives the wrench data from the // robot. std::thread rtde_thread(rtdeWorker, second_to_run); - // Modify the artificial force-torque input through keyboard input - ftInputTui(); - - g_RUNNING = false; + if (std::getenv("URCL_EXAMPLES_IN_CI") == nullptr) + { + ftInputTui(); + } + else + { + // In CI mode, just keep the main thread alive while g_RUNNING is true + while (g_RUNNING) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + } if (rtde_thread.joinable()) { rtde_thread.join(); From b6ad1775930e9e44635c9df169edfcec74133e79 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Wed, 13 May 2026 16:28:59 +0200 Subject: [PATCH 4/5] REVERT: Debug RTDE packages --- examples/external_fts_through_rtde.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/external_fts_through_rtde.cpp b/examples/external_fts_through_rtde.cpp index 4dcad11b8..1265d096f 100644 --- a/examples/external_fts_through_rtde.cpp +++ b/examples/external_fts_through_rtde.cpp @@ -213,12 +213,12 @@ void rtdeWorker(const int second_to_run) auto start_time = std::chrono::steady_clock::now(); std::unique_ptr data_pkg = std::make_unique(g_my_robot->getUrDriver()->getRTDEOutputRecipe()); - int frequency = g_my_robot->getUrDriver()->getControlFrequency(); - int period_ms = 2; - if (frequency > 0) - { - period_ms = static_cast(1000.0 / frequency); - } + // int frequency = g_my_robot->getUrDriver()->getControlFrequency(); + // int period_ms = 2; + // if (frequency > 0) + //{ + // period_ms = static_cast(1000.0 / frequency); + // } while (g_RUNNING) { urcl::vector6d_t local_ft_vec = g_FT_VEC; @@ -230,12 +230,12 @@ void rtdeWorker(const int second_to_run) std::stringstream ss; ss << std::fixed << std::setprecision(2) << actual_tcp_force; // Throttle output to once per second - if (std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time).count() % - 1000 < - period_ms) - { - URCL_LOG_INFO("Force-torque reported by robot: %s", ss.str().c_str()); - } + // if (std::chrono::duration_cast(std::chrono::steady_clock::now() - + // start_time).count() % 1000 < + // period_ms) + //{ + URCL_LOG_INFO("Force-torque reported by robot: %s", ss.str().c_str()); + //} } else { From bdb103b1011f9d3e076947f8801010fffd8e651c Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Wed, 13 May 2026 16:29:35 +0200 Subject: [PATCH 5/5] REVERT: Run cb3 examples only --- .github/workflows/ci.yml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28974f7a9..1661299a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,21 +20,21 @@ jobs: - ROBOT_MODEL: 'ur5' URSIM_VERSION: '3.14.3' PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/cb3' - - ROBOT_MODEL: 'ur5e' - URSIM_VERSION: '5.9.4' - PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series' - - ROBOT_MODEL: 'ur20' - URSIM_VERSION: 'latest' - PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series' - - ROBOT_MODEL: 'ur5e' - URSIM_VERSION: '10.7.0' - PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex' - - ROBOT_MODEL: 'ur5e' - URSIM_VERSION: '10.11.0' - PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex' - - ROBOT_MODEL: 'ur5e' - URSIM_VERSION: '10.12.0' - PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex' + #- ROBOT_MODEL: 'ur5e' + #URSIM_VERSION: '5.9.4' + #PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series' + #- ROBOT_MODEL: 'ur20' + #URSIM_VERSION: 'latest' + #PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series' + #- ROBOT_MODEL: 'ur5e' + #URSIM_VERSION: '10.7.0' + #PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex' + #- ROBOT_MODEL: 'ur5e' + #URSIM_VERSION: '10.11.0' + #PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex' + #- ROBOT_MODEL: 'ur5e' + #URSIM_VERSION: '10.12.0' + #PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/polyscopex' steps: - uses: actions/checkout@v6 @@ -80,10 +80,10 @@ jobs: - name: Access PolyScope if: ${{ steps.check_polyscopex.outputs.is_polyscopex == 'true' }} run: chrome --no-sandbox --disable-settuid-sandbox --headless=new 192.168.56.101 & - - name: test - run: cd build && ctest --output-on-failure --output-junit junit.xml - env: - URSIM_VERSION: ${{matrix.env.URSIM_VERSION}} + #- name: test + #run: cd build && ctest --output-on-failure --output-junit junit.xml + #env: + #URSIM_VERSION: ${{matrix.env.URSIM_VERSION}} - name: Upload test results to Codecov if: ${{ !cancelled() && steps.build.outcome == 'success' }} uses: codecov/codecov-action@v6