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

Remapping action names does not work #1312

Open
Bjoernolav opened this issue Aug 11, 2022 · 3 comments · May be fixed by ros2/rcl#1170
Open

Remapping action names does not work #1312

Bjoernolav opened this issue Aug 11, 2022 · 3 comments · May be fixed by ros2/rcl#1170
Labels
backlog help wanted Extra attention is needed

Comments

@Bjoernolav
Copy link

Bjoernolav commented Aug 11, 2022

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • Docker container based on ros:humble

Steps to reproduce issue

Run the following launch file to launch the fibonacci action server from action_tutorials_py with remapping of the action name:

from launch import LaunchDescription
from launch_ros.actions import Node


def generate_launch_description():
    node = Node(
        package='action_tutorials_py',
        executable='fibonacci_action_server',
        remappings=[
            ('fibonacci', '/remapped_fibonacci'),
            ('~/list_parameters', '/fibonacci_list_parameters'),
        ]
    )
    return LaunchDescription([
        node
    ])

Expected behavior

Launching the fibonnaci_action_server node running with the /remapped_fibonacci action server, and also exposing the /fibonacci_list_parameters service instead of the /fibonacci_action_server/fibonacci_list_parameters service.

Actual behavior

The service is remapped correctly, but the action is not.

Output from ros2 action list

➜  zb_ws ros2 action list
/fibonacci

Output from ros2 service list

➜  zb_ws ros2 service list
/fibonacci_action_server/describe_parameters
/fibonacci_action_server/get_parameter_types
/fibonacci_action_server/get_parameters
/fibonacci_action_server/set_parameters
/fibonacci_action_server/set_parameters_atomically
/fibonacci_list_parameters
@clalancette
Copy link
Contributor

Yeah, this is a feature for actions that we never implemented. It is probably possible to implement it relatively straightforwardly in https://github.com/ros2/rcl/tree/rolling/rcl_action , but it just isn't done so currently.

There is a workaround that can be used, which is to remap all of the topics and services that are associated with an action. For the fibonacci example, that would look something like:

ros2 run action_tutorials_py fibonacci_action_server --ros-args -r /fibonacci/_action/feedback:=/myout/_action/feedback -r /fibonacci/_action/status:=/myout/_action/status -r /fibonacci/_action/cancel_goal:=/myout/_action/cancel_goal -r /fibonacci/_action/get_result:=/myout/_action/get_result -r /fibonacci/_action/send_goal:=/myout/_action/send_goal

And for the client:

ros2 run action_tutorials_py fibonacci_action_client  --ros-args -r /fibonacci/_action/feedback:=/myout/_action/feedback -r /fibonacci/_action/status:=/myout/_action/status -r /fibonacci/_action/cancel_goal:=/myout/_action/cancel_goal -r /fibonacci/_action/get_result:=/myout/_action/get_result -r /fibonacci/_action/send_goal:=/myout/_action/send_goal

I don't know if we are going to have time to look at this soon, but we'll keep it on the list to eventually fix.

@dhood
Copy link
Member

dhood commented Sep 4, 2023

I can confirm that remapping the topics as you suggested @clalancette does the job.

This caught me by surprise, though - I wasn't expecting this feature to be missing, so I was troubleshooting locally for a bit. I'm sure it's documented somewhere though in the release notes :-) just fyi

This would probably be a good issue for a new contributor to work on, do you think? Perhaps "just" a call to rcl_resolve_name is missing?

In the meantime here's a launch example for someone else who comes across this:

    my_node = Node(
        package='my_package',
        executable='my_node.py',
        remappings=[
            ('/fibonacci/_action/feedback', '/myout/_action/feedback'),
            ('/fibonacci/_action/status', '/myout/_action/status'),
            ('/fibonacci/_action/cancel_goal', '/myout/_action/cancel_goal'),
            ('/fibonacci/_action/get_result', '/myout/_action/get_result'),
            ('/fibonacci/_action/send_goal', '/myout/_action/send_goal'),
        ],
    )

@Ryanf55
Copy link

Ryanf55 commented Apr 1, 2024

Same for XML:

<?xml version="1.0"?>
<launch>
  <node pkg="action_tutorials_cpp" exec="fibonacci_action_server" namespace="action_tutorials_cpp">
    <remap from="/action_tutorials_cpp/fibonacci" to="/foobar"/>
  </node>
</launch>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants