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

made namespace in receiver launch script a parameter #58

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

Conversation

tobi807
Copy link

@tobi807 tobi807 commented Jan 7, 2025

Need to start 2 Can Receiver (2x PCAN) in one launch script and wanted to keep the supplied receiver launch file.

<launch>

  <arg name="receiver_interval_sec" default="5.0" />
  <arg name="enable_can_fd" default="false" />
  <arg name="use_bus_time" default="false" />
  <arg name="channel_0_name" default="can0_msg" />
  <arg name="channel_1_name" default="can1_msg" />

  <include file="$(find-pkg-share ros2_socketcan)/launch/socket_can_receiver.launch.py">
    <arg name="namespace" value="can0" />
    <arg name="interface" value="can0" />
    <arg name="interval_sec" value="$(var receiver_interval_sec)" />
    <arg name="enable_can_fd" value="$(var enable_can_fd)" />
    <arg name="from_can_bus_topic" value="$(var channel_0_name)" />
    <arg name="use_bus_time" value="$(var use_bus_time)" />
  </include>

  <include file="$(find-pkg-share ros2_socketcan)/launch/socket_can_receiver.launch.py">
    <arg name="namespace" value="can1" />
    <arg name="interface" value="can1" />
    <arg name="interval_sec" value="$(var receiver_interval_sec)" />
    <arg name="enable_can_fd" value="$(var enable_can_fd)" />
    <arg name="from_can_bus_topic" value="$(var channel_1_name)" />
    <arg name="use_bus_time" value="$(var use_bus_time)" />
  </include>

</launch>

They ended up with the same name in the same namespace. My solution is to move them in different namespace, and I did that by modifying the receiver launch file to accept the namespace as parameter from the parant launch file. Not sure if it is the ros way. If there is a better way please discard the pull request.

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