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 #1724

Conversation

saikishor
Copy link
Member

@saikishor saikishor commented Aug 27, 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)

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 97.82609% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (master@4eabd25). Learn more about missing BASE report.
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
.../controller_manager/controller_manager_services.py 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1724   +/-   ##
=========================================
  Coverage          ?   87.33%           
=========================================
  Files             ?      121           
  Lines             ?    12140           
  Branches          ?     1086           
=========================================
  Hits              ?    10603           
  Misses            ?     1148           
  Partials          ?      389           
Flag Coverage Δ
unittests 87.33% <97.82%> (?)

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

Files with missing lines Coverage Δ
controller_manager/test/test_spawner_unspawner.cpp 99.25% <100.00%> (ø)
.../controller_manager/controller_manager_services.py 74.62% <95.00%> (ø)

@saikishor
Copy link
Member Author

I've added the reviewers manually, as the Reviewer lottery job is failing

bmagyar
bmagyar previously approved these changes Sep 11, 2024
Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

Thank you!

@bmagyar
Copy link
Member

bmagyar commented Sep 11, 2024

@saikishor I am wondering though where would it make sense to showcase this feature? Demos?

@saikishor
Copy link
Member Author

@saikishor I am wondering though where would it make sense to showcase this feature? Demos?

Yes @bmagyar ! It totally makes sense.

@saikishor
Copy link
Member Author

@bmagyar I've created an issue to follow-up. I'll take care of it soon, can we get this merged in the meantime :)

@saikishor
Copy link
Member Author

@saikishor I am wondering though where would it make sense to showcase this feature? Demos?

@bmagyar I've added an example in ros2_control_demos: ros-controls/ros2_control_demos#599

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.

@bmagyar bmagyar merged commit 83fff77 into ros-controls:master Oct 17, 2024
21 checks passed
@jcarpinelli-bdai
Copy link

Thank you all! @bmagyar do you know yet if this change is planned to eventually be backported to Humble?

@saikishor saikishor deleted the support/wilcard_entries/param_files branch October 17, 2024 23:45
@christophfroehlich
Copy link
Contributor

@saikishor is this backportable? we haven't backported the params-file functionality?!

@saikishor
Copy link
Member Author

@saikishor is this backportable? we haven't backported the params-file functionality?!

@christophfroehlich the params-file is probably there in Humble. We can take a look at this once we are back from ROSCon.

@saikishor saikishor added backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron. labels Nov 2, 2024
mergify bot pushed a commit that referenced this pull request Nov 2, 2024
…les (#1724)

(cherry picked from commit 83fff77)

# Conflicts:
#	controller_manager/controller_manager/controller_manager_services.py
#	controller_manager/test/test_spawner_unspawner.cpp
#	doc/release_notes.rst
mergify bot pushed a commit that referenced this pull request Nov 2, 2024
…les (#1724)

(cherry picked from commit 83fff77)

# Conflicts:
#	controller_manager/controller_manager/controller_manager_services.py
#	controller_manager/test/test_spawner_unspawner.cpp
#	doc/release_notes.rst
saikishor added a commit that referenced this pull request Nov 3, 2024
saikishor added a commit that referenced this pull request Nov 3, 2024
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 maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants