Skip to content

Add new Handle constructor for easier initialization #2253

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

Conversation

saikishor
Copy link
Member

Right now, when we add new tests, we will have to generate the InterfaceInfo for each state and command interface, and this is nothing but increasing the lines of code. I've added a new constructor that we can use inside the tests

Previous approach

  const std::string collision_interface = "collision";
  const std::string itf_name = "joint1";
  InterfaceInfo info;
  info.name = collision_interface;
  info.data_type = "bool";
  InterfaceDescription interface_descr(itf_name, info);
  StateInterface handle{interface_descr};

New approach:

  const std::string POSITION_INTERFACE = "position";
  const std::string JOINT_NAME_1 = "joint1";
  StateInterface handle{itf_name, POSITION_INTERFACE, "double", "23.0"};

@saikishor saikishor added the backport-jazzy This label should be used by maintainers only! Label triggers PR backport to ROS 2 jazzy. label May 19, 2025
@saikishor saikishor force-pushed the add/new/handle/constructor branch from e5ff0c6 to 40811c4 Compare May 19, 2025 12:35
Copy link

codecov bot commented May 19, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.92%. Comparing base (7f0bd68) to head (d123216).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...re_interface/include/hardware_interface/handle.hpp 89.47% 2 Missing ⚠️
hardware_interface/test/test_handle.cpp 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2253      +/-   ##
==========================================
- Coverage   88.92%   88.92%   -0.01%     
==========================================
  Files         143      143              
  Lines       16436    16454      +18     
  Branches     1422     1422              
==========================================
+ Hits        14615    14631      +16     
- Misses       1268     1270       +2     
  Partials      553      553              
Flag Coverage Δ
unittests 88.92% <87.50%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...rface/include/hardware_interface/hardware_info.hpp 81.48% <100.00%> (+0.71%) ⬆️
...re_interface/include/hardware_interface/handle.hpp 90.90% <89.47%> (-0.27%) ⬇️
hardware_interface/test/test_handle.cpp 98.48% <83.33%> (-1.52%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

LGTM, some minor requests only

@bmagyar bmagyar merged commit c3e8082 into ros-controls:master May 23, 2025
20 of 27 checks passed
@bmagyar bmagyar deleted the add/new/handle/constructor branch May 23, 2025 14:57
mergify bot pushed a commit that referenced this pull request May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-jazzy This label should be used by maintainers only! Label triggers PR backport to ROS 2 jazzy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants