ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

remapping action name does not work

asked 2021-06-10 23:08:55 -0500

masynthetic gravatar image

updated 2021-06-11 14:05:02 -0500

I am working on using launch files and parameters to re-use my nodes but I am encountering a critical failure which is that remapping the action name the same way I am remapping service names does not seem to work.

my code looks like this

SERVER CODE

self._action_server = ActionServer(self, ActionInterface, "action_name", self.execute_callback)

LAUNCH FILE CODE

    server_node = Node(
    package = "package"
    executable ="executable"
    remappings=[
    ("action_name","action_server_1")
])

and in this instance running the launch file would start an action named "action_name" rather than "action_server_1"

why doesn't this work?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-06-15 15:49:00 -0500

Youssef_Lah gravatar image

updated 2021-06-15 23:06:59 -0500

this example works well for me, i am posting it even if it seems the same as yours:

Edit: have you tried adding commas after each line like in my example ?

number_counter_node = Node(
        package="my_pkg",
        executable="number_counter",
        name="my_number_counter",
        remappings=[
            ("number_count", "my_number_count")
        ]
    )
edit flag offensive delete link more

Comments

yeah I have checked carefully, here is my exact code:

server

        self._action_server = ActionServer(
        self,
        AxisControl,
        "move_axis_to", # clients use this
        self.execute_callback)

launch file

    move_canopy_x_axis_server_node = Node(
    package="garden_pkg",
    executable="axis_server",
    name="move_canopy_x_server",
    remappings=[
        ("send_recieve_serial", "send_recieve_canopy"),
        ("move_axis_to", "move_canopy_x_to"),
        ("axis_status", "canopy_x_axis_status")
    ]

)

but 'ros2 action list' returns 'move_axis_to', additionally 'ros2 topic list' reveals that the topic name remap works so I am sure that the remap syntax is not wrong.

masynthetic gravatar image masynthetic  ( 2021-06-20 18:43:21 -0500 )edit
0

answered 2021-06-11 03:36:15 -0500

Joe28965 gravatar image

If I'm not mistaken, you're using remappings wrong. I'm pretty sure it should be:

remappings=[
    ('action_name', 'action_server_1')
]

If you then want to add another remapping, it would look like this:

remappings=[
    ('action_name', 'action_server_1'),
    ('that_other_thing', 'new_name_for_it')
]
edit flag offensive delete link more

Comments

sorry I just mistyped in my example, you are right but it is in tuple format in reality

masynthetic gravatar image masynthetic  ( 2021-06-11 14:02:25 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2021-06-10 23:08:55 -0500

Seen: 617 times

Last updated: Jun 15 '21