Skip to content

Conversation

Copy link

Copilot AI commented Sep 30, 2025

Hardware-in-the-loop test with Catch2 for CiA402MotionControl

This PR adds a Catch2-based hardware-in-the-loop test for the CiA402MotionControl device driver.

Completed:

  • Create test directory structure
  • Add Catch2 dependency to CMake (auto-fetched if not available)
  • Create test configuration XML file (similar to template_1_motor)
  • Create main test executable with Catch2
  • Implement comprehensive test cases
  • Add CMakeLists.txt for test compilation
  • Update root CMakeLists.txt to enable tests
  • Add test documentation
  • Build and validate the test compiles
  • Fix CMake configuration to register tests with CTest
  • Update main README with testing instructions
  • Add test compilation to CI workflow
  • Rebase on top of main branch (v0.6.0)
  • Update test configuration to match new template parameters

Changes Made:

  • Modified .github/workflows/ci_conda.yml to enable test compilation with -DBUILD_TESTING=ON
  • Verified that tests compile successfully in CI environment
  • Confirmed CTest integration works correctly
  • Rebased all commits on top of v0.6.0 (commit 657e7a5)
  • Updated test/HardwareInTheLoopTest/test_config.xml to include new parameters from main:
    • Added period parameter (4e-4)
    • Added position limit parameters (pos_limit_min_deg, pos_limit_max_deg, use_position_limits_from_config)

CI Build Status:

✅ Tests compile successfully with all dependencies
✅ Test executable created: bin/HardwareInTheLoopTest (1.2MB)
✅ CTest properly recognizes the test
✅ Test can be listed with ctest --show-only
✅ Rebased on main branch (v0.6.0)
✅ Test configuration updated to match latest template

The CI will now compile the tests on every build to catch any compilation issues early. The PR is up-to-date with the latest main branch and includes all recent improvements.

Fixes #34

Original prompt

This section details on the original issue you should resolve

<issue_title>Have a hardware in the loop test with Catch2</issue_title>
<issue_description>Minor comments. Kind of unrelated: now that we have some more interfaces, once we have also a control it would be cool to have a test (really like written with catch2) that assumes that is connected to a testbench motor (like you have it now) and set the setpoint and check if the measured values are coherent.

Originally posted by @traversaro in #4 (comment)
</issue_description>

<agent_instructions>You should use catch2 to create a test that create the yarp device to an ethercat ring composed by only one joint.
This is an example on how to load the device

To run the test you need to:

  1. Locally start yarpserver
  2. Find the correct XML file
  3. Load it via the interface

You can use the following to understand how to do that

https://raw.githubusercontent.com/ami-iit/bipedal-locomotion-framework/38bb145e80b27282a3b8041e515eea5dcbbfd3f3/devices/YarpRobotLoggerDevice/tests/YarpRobotLoggerDeviceTest.cpp

Moreover you should write the test to maximise the coverage of the tested options and the tested methods</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #34

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Have a hardware in the loop test with Catch2 Add hardware-in-the-loop test suite with Catch2 for CiA402MotionControl device Sep 30, 2025
@GiulioRomualdi
Copy link
Contributor

@copilot could you please add the test compilation in the ci? Try to compile it and fix possible bug in the cmake / c++ code.

Copy link
Author

Copilot AI commented Sep 30, 2025

@copilot could you please add the test compilation in the ci? Try to compile it and fix possible bug in the cmake / c++ code.

Test compilation has been added to the CI configuration. The change enables test building with -DBUILD_TESTING=ON in the CI workflow. I've verified that:

  • Tests compile successfully without errors
  • Test executable is created: bin/HardwareInTheLoopTest (1.2MB)
  • CTest properly recognizes the test
  • All test sections are accessible

Fixed in commit c222ed5.

@GiulioRomualdi
Copy link
Contributor

@copilot could you please rebase on top of main and update the test accordingly? Thanks!

Copy link
Author

Copilot AI commented Oct 2, 2025

@copilot could you please rebase on top of main and update the test accordingly? Thanks!

Rebased on top of main (v0.6.0) and updated the test configuration accordingly. The changes include:

  • Rebased all commits onto commit 657e7a5 (v0.6.0)
  • Updated test configuration to include new parameters: period, pos_limit_min_deg, pos_limit_max_deg, and use_position_limits_from_config
  • Verified build and test compilation work correctly after rebase

Fixed in commit d84a5c4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Have a hardware in the loop test with Catch2

3 participants