Skip to content
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

[Spawner] Add support for wildcard entries in the controller param files (backport #1724) #1836

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Nov 2, 2024

This PR aims to add support for the wildcard entries for the controller config files. This is very helpful, for instance, if we need to load the joint_state_broadcaster or any other controllers to different CM namespaces, we could reuse the configuration of the controllers or broadcaster by just having them with a wildcard. If not, we must generate multiple configuration files for each namespaced controller manager.

I've also added tests to test the same architecture. I've also made some tests with ros2_control_demos, and it works well.

Reference: https://docs.ros.org/en/humble/Tutorials/Intermediate/Launch/Using-ROS2-Launch-For-Large-Projects.html#using-wildcards-in-yaml-files

Earlier approach:

/rrbot_1/position_trajectory_controller:
  ros__parameters:
    type: joint_trajectory_controller/JointTrajectoryController
    joints:
      - joint1
      - joint2

    command_interfaces:
      - position

    state_interfaces:
      - position

    state_publish_rate: 200.0 # Defaults to 50
    action_monitor_rate: 20.0 # Defaults to 20

    allow_partial_joints_goal: false # Defaults to false
    open_loop_control: true
    allow_integration_in_goal_trajectories: true
    constraints:
      stopped_velocity_tolerance: 0.01 # Defaults to 0.01
      goal_time: 0.0 # Defaults to 0.0 (start immediately)
  
  /rrbot_2/position_trajectory_controller:
  ros__parameters:
    type: joint_trajectory_controller/JointTrajectoryController
    joints:
      - joint1
      - joint2

    command_interfaces:
      - position

    state_interfaces:
      - position

    state_publish_rate: 200.0 # Defaults to 50
    action_monitor_rate: 20.0 # Defaults to 20

    allow_partial_joints_goal: false # Defaults to false
    open_loop_control: true
    allow_integration_in_goal_trajectories: true
    constraints:
      stopped_velocity_tolerance: 0.01 # Defaults to 0.01
      goal_time: 0.0 # Defaults to 0.0 (start immediately)

With this change, we can have one configuration as below and reuse it

/**/position_trajectory_controller:
  ros__parameters:
    type: joint_trajectory_controller/JointTrajectoryController
    joints:
      - joint1
      - joint2

    command_interfaces:
      - position

    state_interfaces:
      - position

    state_publish_rate: 200.0 # Defaults to 50
    action_monitor_rate: 20.0 # Defaults to 20

    allow_partial_joints_goal: false # Defaults to false
    open_loop_control: true
    allow_integration_in_goal_trajectories: true
    constraints:
      stopped_velocity_tolerance: 0.01 # Defaults to 0.01
      goal_time: 0.0 # Defaults to 0.0 (start immediately)

This is an automatic backport of pull request #1724 done by [Mergify](https://mergify.com).

@mergify mergify bot added the conflicts label Nov 2, 2024
Copy link
Contributor Author

mergify bot commented Nov 2, 2024

Cherry-pick of 83fff77 has failed:

On branch mergify/bp/iron/pr-1724
Your branch is up to date with 'origin/iron'.

You are currently cherry-picking commit 83fff77.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   controller_manager/doc/userdoc.rst
	modified:   controller_manager/test/test_controller_spawner_with_type.yaml

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   controller_manager/controller_manager/controller_manager_services.py
	both modified:   controller_manager/test/test_spawner_unspawner.cpp
	both modified:   doc/release_notes.rst

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Copy link

codecov bot commented Nov 3, 2024

Codecov Report

Attention: Patch coverage is 51.80723% with 40 lines in your changes missing coverage. Please review.

Project coverage is 62.35%. Comparing base (3a48508) to head (96e225b).
Report is 1 commits behind head on iron.

Files with missing lines Patch % Lines
controller_manager/test/test_spawner_unspawner.cpp 38.09% 5 Missing and 34 partials ⚠️
.../controller_manager/controller_manager_services.py 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             iron    #1836      +/-   ##
==========================================
- Coverage   62.40%   62.35%   -0.06%     
==========================================
  Files         112      112              
  Lines       13039    13098      +59     
  Branches     8833     8882      +49     
==========================================
+ Hits         8137     8167      +30     
- Misses        944      949       +5     
- Partials     3958     3982      +24     
Flag Coverage Δ
unittests 62.35% <51.80%> (-0.06%) ⬇️

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

Files with missing lines Coverage Δ
.../controller_manager/controller_manager_services.py 75.00% <95.00%> (+4.31%) ⬆️
controller_manager/test/test_spawner_unspawner.cpp 53.97% <38.09%> (-2.25%) ⬇️

... and 1 file with indirect coverage changes

@saikishor saikishor enabled auto-merge (squash) November 3, 2024 20:10
@saikishor saikishor merged commit 8ba9a49 into iron Nov 3, 2024
11 of 12 checks passed
@saikishor saikishor deleted the mergify/bp/iron/pr-1724 branch November 3, 2024 20:34
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.

3 participants