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

Update controller_manager_plugin.cpp #3179

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wizard-coder
Copy link

Fixing the bug where the namespace is not properly applied when using Ros2ControlMultiManager

Description

When using two ROS2 controls, the namespace is automatically detected, but the namespace is not properly applied when registering the action client.

For more details, please refer to #3150

Fixing the bug where the namespace is not properly applied when using Ros2ControlMultiManager
@mikeferguson
Copy link
Contributor

@wizard-coder - I reviewed the ticket as well - can you post the contents of ros2_controllers.left.yaml either here or on the original ticket? (I see you have the full launch file posted, but not the config).

@mikeferguson
Copy link
Contributor

As a note - this logic has been touched quite a bit in the past:

@wizard-coder
Copy link
Author

The contents of the config file are as follows:

ros2_contollers.left.yaml

/**/controller_manager:
  ros__parameters:
    update_rate: 100 # Hz

    arm_controller:
      type: joint_trajectory_controller/JointTrajectoryController

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

/**/arm_controller:
  ros__parameters:
    joints:
      - left_joint0
      - left_joint1
      - left_joint2
      - left_joint3
      - left_joint4
      - left_joint5
      - left_joint6
    command_interfaces:
      - position
    state_interfaces:
      - position
    allow_nonzero_velocity_at_trajectory_end: true

/**/joint_state_broadcaster:
  ros__parameters:
    joints:
      - left_joint0
      - left_joint1
      - left_joint2
      - left_joint3
      - left_joint4
      - left_joint5
      - left_joint6

    interfaces:
      - position

ros2_controllers.right.yaml

/**/controller_manager:
  ros__parameters:
    update_rate: 100 # Hz

    arm_controller:
      type: joint_trajectory_controller/JointTrajectoryController

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

/**/arm_controller:
  ros__parameters:
    joints:
      - right_joint0
      - right_joint1
      - right_joint2
      - right_joint3
      - right_joint4
      - right_joint5
      - right_joint6
    command_interfaces:
      - position
    state_interfaces:
      - position
    allow_nonzero_velocity_at_trajectory_end: true

/**/joint_state_broadcaster:
  ros__parameters:
    joints:
      - right_joint0
      - right_joint1
      - right_joint2
      - right_joint3
      - right_joint4
      - right_joint5
      - right_joint6

    interfaces:
      - position

@wizard-coder
Copy link
Author

As a note - this logic has been touched quite a bit in the past:

In the case of Ros2ControlManager, since ns_ is initialized as an empty string, I believe it should be initialized from the ros_control_namespace parameter. However, in the case of Ros2ControlMultiManager, it first finds the namespaces and then initializes ns_ through the Ros2ControlManager(const std::string& ns) initialization function. Therefore, since ns_ is already set at this point, I believe the initialization via ros_control_namespace should be ignored.

@mikeferguson
Copy link
Contributor

However, in the case of Ros2ControlMultiManager, it first finds the namespaces and then initializes ns_ through the Ros2ControlManager(const std::string& ns) initialization function

There we go - that's the part I was missing as to how you were getting the ns_ set initially - thanks.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

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

Project coverage is 44.45%. Comparing base (e2d9dc5) to head (db529c0).

Files with missing lines Patch % Lines
...ontrol_interface/src/controller_manager_plugin.cpp 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3179      +/-   ##
==========================================
+ Coverage   44.45%   44.45%   +0.01%     
==========================================
  Files         698      698              
  Lines       61561    61558       -3     
  Branches     7461     7459       -2     
==========================================
+ Hits        27360    27361       +1     
+ Misses      34033    34028       -5     
- Partials      168      169       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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