Skip to content

Fix child_frame_id in controller_state_msg #1601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 25, 2025

Conversation

rehanshah17
Copy link
Contributor

@rehanshah17 rehanshah17 commented Mar 20, 2025

Closing #504

Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

  1. Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
  2. Give your PR a descriptive title. Add a short summary, if required.
  3. Make sure the pipeline is green.
  4. Don’t be afraid to request reviews from maintainers.
  5. New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.

To send us a pull request, please:

  • Fork the repository.
  • Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
  • Ensure local tests pass. (colcon test and pre-commit run (requires you to install pre-commit by pip3 install pre-commit)
  • Commit to your fork using clear commit messages.
  • Send a pull request, answering any default questions in the pull request interface.
  • Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

@christophfroehlich christophfroehlich changed the title fixed the copy and paste #504 issue, added the test check_frame_ids_in_controller_state Fix child_frame in controller_state_msg Mar 20, 2025
Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please have a look at the failing CI jobs

@rehanshah17
Copy link
Contributor Author

Pretty sure I just fixed the child_frame issue + the failing Cl jobs in the newest commit "fixing spaces".

@rehanshah17
Copy link
Contributor Author

This may be something very small that I am overlooking, but all the tests are failing from the first version of my code, instead of the newest commit. Is there something else that I have to do than pushing changes to the feature branch?

1 similar comment
@rehanshah17
Copy link
Contributor Author

This may be something very small that I am overlooking, but all the tests are failing from the first version of my code, instead of the newest commit. Is there something else that I have to do than pushing changes to the feature branch?

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR doesn't even build. Have you tested it locally before?

@saikishor saikishor changed the title Fix child_frame in controller_state_msg Fix child_frame_id in controller_state_msg Mar 23, 2025
Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you run the tests locally?
$ colcon test --packages-select admittance_controller
gives

2: [ RUN      ] AdmittanceControllerTest.check_frame_ids_in_controller_state
2: [INFO] [1742761539.052313660] [test_admittance_controller]: No specific joint names are used for command interfaces. Using 'joints' parameter.
2: [INFO] [1742761539.052334767] [test_admittance_controller]: state int types are: position
2: 
2: [INFO] [1742761539.052340550] [test_admittance_controller]: command int types are: position
2: 
2: [INFO] [1742761539.052343866] [test_admittance_controller]: chainable int types are: position
2: 
2: [INFO] [1742761539.052363494] [test_admittance_controller]: chainable int types are: velocity
2: 
2: [INFO] [1742761539.052372673] [test_admittance_controller]: Command interfaces are [position] and and state interfaces are [position].
2: /workspaces/ros2_rolling_ws/src/ros2_controllers/admittance_controller/test/test_admittance_controller.cpp:369: Failure
2: Expected equality of these values:
2:   msg.ref_trans_base_ft.header.frame_id
2:     Which is: ""
2:   controller_->admittance_->parameters_.kinematics.base
2:     Which is: "base_link"
2: 
2: [  FAILED  ] AdmittanceControllerTest.check_frame_ids_in_controller_state (10 ms)

@rehanshah17
Copy link
Contributor Author

for some reason I am not able to run these changes locally, colcon checks the install folder on my machine but the install folder is empty. Any help? This is the command and output

$ colcon test --packages-select admittance_controller
Starting >>> admittance_controller
[0.665s] colcon.colcon_cmake.task.cmake.test ERROR Failed to find the following files:
- /Users/rehanshah/Projects/ros_ws/admittance/AdmittanceController_ros2/install/admittance_controller/share/admittance_controller/package.sh
Check that the following packages have been built:
- admittance_controller
Failed   <<< admittance_controller [0.00s, exited with code 1]

Summary: 0 packages finished [0.22s]
  1 package failed: admittance_controller
(ros) ➜  AdmittanceController_ros2 git:(AdmittanceFix) ✗ 

@saikishor
Copy link
Member

@rehanshah17 did you try building the package?

@rehanshah17
Copy link
Contributor Author

upon building I get

Starting >>> imu_sensor_broadcaster
--- stderr: gpio_controllers          
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


CMake Error at CMakeLists.txt:16 (find_package):
  By not providing "Findcontroller_interface.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "controller_interface", but CMake did not find one.

  Could not find a package configuration file provided by
  "controller_interface" with any of the following names:

    controller_interfaceConfig.cmake
    controller_interface-config.cmake

  Add the installation prefix of "controller_interface" to CMAKE_PREFIX_PATH
  or set "controller_interface_DIR" to a directory containing one of the
  above files.  If "controller_interface" provides a separate development
  package or SDK, be sure it has been installed.


---
Failed   <<< gpio_controllers [5.71s, exited with code 1]
--- stderr: steering_controllers_library
CMake Error at CMakeLists.txt:34 (find_package):
  By not providing "Findbackward_ros.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "backward_ros", but CMake did not find one.

  Could not find a package configuration file provided by "backward_ros" with
  any of the following names:

    backward_rosConfig.cmake
    backward_ros-config.cmake

  Add the installation prefix of "backward_ros" to CMAKE_PREFIX_PATH or set
  "backward_ros_DIR" to a directory containing one of the above files.  If
  "backward_ros" provides a separate development package or SDK, be sure it
  has been installed.


---
Failed   <<< steering_controllers_library [5.72s, exited with code 1]

with a summary of

Summary: 0 packages finished [5.84s]
  2 packages failed: gpio_controllers steering_controllers_library
  6 packages aborted: admittance_controller diff_drive_controller force_torque_sensor_broadcaster forward_command_controller gripper_controllers imu_sensor_broadcaster
  8 packages had stderr output: admittance_controller diff_drive_controller force_torque_sensor_broadcaster forward_command_controller gpio_controllers gripper_controllers imu_sensor_broadcaster steering_controllers_library
  17 packages not processed

@christophfroehlich
Copy link
Contributor

have you installed ros2_control as binaries, or do you want to build it from source? if it is in your workspace, run colcon build --packages-up-to admittance_controller

@rehanshah17
Copy link
Contributor Author

I had to download it from robostack, so I am pretty sure I downloaded it from source.

(ros) ➜  admittance colcon build --packages-up-to admittance_controller
Starting >>> admittance_controller
--- stderr: admittance_controller                         
CMake Error at CMakeLists.txt:36 (find_package):
  By not providing "Findbackward_ros.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "backward_ros", but CMake did not find one.

  Could not find a package configuration file provided by "backward_ros" with
  any of the following names:

    backward_rosConfig.cmake
    backward_ros-config.cmake

  Add the installation prefix of "backward_ros" to CMAKE_PREFIX_PATH or set
  "backward_ros_DIR" to a directory containing one of the above files.  If
  "backward_ros" provides a separate development package or SDK, be sure it
  has been installed.


---
Failed   <<< admittance_controller [0.28s, exited with code 1]

Summary: 0 packages finished [0.38s]
  1 package failed: admittance_controller
  1 package had stderr output: admittance_controller

@christophfroehlich
Copy link
Contributor

I never used robostack, sorry. But you can clone the missing package from https://github.com/pal-robotics/backward_ros

@christophfroehlich
Copy link
Contributor

The tests are still failing

 build/admittance_controller/test_results/admittance_controller/test_admittance_controller.gtest.xml: 37 tests, 0 errors, 1 failure, 0 skipped
  <<< failure message
    /home/runner/work/ros2_controllers/ros2_controllers/.work/target_ws/src/ros2_controllers/admittance_controller/test/test_admittance_controller.cpp:369
    Expected equality of these values:
      msg.ref_trans_base_ft.header.frame_id
        Which is: ""
      controller_->admittance_->parameters_.kinematics.base
        Which is: "base_link"

@christophfroehlich
Copy link
Contributor

@rehanshah17 can you please fix the failing test?

@christophfroehlich
Copy link
Contributor

@rehanshah17 can you please fix the failing test?

Fixed that. tf2::eigenToTransform overwrites the previous initialized message. I reordered the assignment and also added a test for admittance_position frames.

Copy link

codecov bot commented Jul 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.64%. Comparing base (64c00ea) to head (e791e90).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1601   +/-   ##
=======================================
  Coverage   85.63%   85.64%           
=======================================
  Files         123      123           
  Lines       12409    12417    +8     
  Branches     1057     1057           
=======================================
+ Hits        10627    10635    +8     
  Misses       1432     1432           
  Partials      350      350           
Flag Coverage Δ
unittests 85.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ude/admittance_controller/admittance_rule_impl.hpp 93.51% <100.00%> (ø)
...nce_controller/test/test_admittance_controller.cpp 100.00% <100.00%> (ø)
...nce_controller/test/test_admittance_controller.hpp 94.88% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@christophfroehlich christophfroehlich added the backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble. label Jul 25, 2025
@christophfroehlich christophfroehlich merged commit 1321ae8 into ros-controls:master Jul 25, 2025
20 of 26 checks passed
mergify bot pushed a commit that referenced this pull request Jul 25, 2025
Co-authored-by: Christoph Fröhlich <[email protected]>
(cherry picked from commit 1321ae8)
mergify bot pushed a commit that referenced this pull request Jul 25, 2025
Co-authored-by: Christoph Fröhlich <[email protected]>
(cherry picked from commit 1321ae8)
christophfroehlich added a commit that referenced this pull request Jul 25, 2025
Co-authored-by: Rehan Shah <[email protected]>
Co-authored-by: Christoph Fröhlich <[email protected]>
saikishor pushed a commit that referenced this pull request Jul 25, 2025
Co-authored-by: Rehan Shah <[email protected]>
Co-authored-by: Christoph Fröhlich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintainers only! Label triggers PR backport to ROS2 humble. backport-jazzy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AdmittanceController] It looks like an unintentional copy-paste has happened
4 participants