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

Revision history [back]

click to hide/show revision 1
initial version

You are remapping the name of the node if you use the name arguments:

Node(
            package='control',
            executable='VelocityControlNode.py',
            name='velocity_control_node',
            parameters=[{'minPWM': 1100,
             'zeroPWM': 1500,
             'maxPWM': 1900}]
        ),

You have two ways to solve your issue:

  1. You avoid remapping the name from the launch file

  2. When you create the child node you use of the following two arguments

2.1 cli_args: You can override the remap rules like __node or even __ns (namespace)

self.srv_node = rclpy.create_node("srv_" + node_name, cli_args=["--ros-args", "-r", "__node:=" + "srv_" + node_name]

2.2 use_global_arguments: You just avoid using global arguments, so the constructor of the node will be able to give the correct name passed as argument to the __init__

self.srv_node = rclpy.create_node("srv_" + node_name, use_global_arguments=False)