diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08ab61463..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 @@ -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 a3c9173cc..1265d096f 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; @@ -221,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 < - 2) - std::cout << "Force-torque reported by robot: " << actual_tcp_force << std::endl; + // 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 { @@ -252,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; + } } } } @@ -284,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();