Skip to content

Conversation

@luis-camero
Copy link
Contributor

Within the device container load_component method, the node option use_global_arguments is disabled.

opts.use_global_arguments(false);

Therefore, any remappings passed to the device_container node will not modify any loaded component. For example, if trying to hide the nmt_state topic published by the canopen_proxy_driver, the following modification to the launch file would not work:

lifecycle_device_container_node = launch_ros.actions.LifecycleNode(
        name="device_container_node",
        namespace=LaunchConfiguration("namespace"),
        package="canopen_core",
        output="screen",
        executable="device_container_node",
        parameters=[
            {"bus_config": LaunchConfiguration("bus_config")},
            {"master_config": LaunchConfiguration("master_config")},
            {"master_bin": LaunchConfiguration("master_bin")},
            {"can_interface_name": LaunchConfiguration("can_interface_name")},
        ],
        remappings=[("~/nmt_state", "_nmt_state")]
    )

Since the goal of disabling the global argument option is to keep all loaded devices independent, there should be a way to remap topics through the bus configuration file.

With these changes, a remappings entry can be added to each device in the configuration file, such that they all have their own remapped topics defined. For example, if we wanted to hide the rpdo topic on one proxy device and tpdo on another, we could set each independently:

options:
  dcf_path: "@BUS_CONFIG_PATH@"

master:
  node_id: 1
  driver: "ros2_canopen::MasterDriver"
  package: "canopen_master_driver"

proxy_device_1:
  node_id: 2
  dcf: "simple.eds"
  driver: "ros2_canopen::ProxyDriver"
  package: "canopen_proxy_driver"
  polling: true
  period: 10
  namespace: "/test1"
  remappings: 
    ~/rpdo: _rpdo

proxy_device_2:
  node_id: 3
  dcf: "simple.eds"
  driver: "ros2_canopen::ProxyDriver"
  package: "canopen_proxy_driver"
  polling: true
  period: 10
  namespace: "/test2"
  remappings:
    ~/tpdo: _tpdo

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.

1 participant