ros2_socketcan icon indicating copy to clipboard operation
ros2_socketcan copied to clipboard

How to start can0 and can1 interface same time?

Open imecar-github opened this issue 1 year ago • 1 comments

Hello thanks for the amazing package. But I have a question. When I want to start can0, there is not problem. But when I want to start can0 and can1, ROS log says:

[socket_can_receiver_node_exe-1] [WARN] [1691756535.767704941] [rcl_lifecycle]: No transition matching 3 found for current state active [socket_can_receiver_node_exe-1] [ERROR] [1691756535.767726592] []: Unable to start transition 3 from current state active: Transition is not registered., at /tmp/binarydeb/ros-galactic-rcl-lifecycle-3.1.4/src/rcl_lifecycle.c:355 [socket_can_sender_node_exe-2] [WARN] [1691756535.769189078] [rcl_lifecycle]: No transition matching 3 found for current state active [socket_can_sender_node_exe-2] [ERROR] [1691756535.769207656] []: Unable to start transition 3 from current state active: Transition is not registered., at /tmp/binarydeb/ros-galactic-rcl-lifecycle-3.1.4/src/rcl_lifecycle.c:355

Are there any way to get can0 and can1 same time? Can we give name as like

from_can_bus_can0 to_can_bus_can0 from_can_bus_can1 to_can_bus_can1

imecar-github avatar Aug 11 '23 12:08 imecar-github

If you compile ros2_socketcan from source, you can use this:


    <!-- socketcan_bridges -->
    <group>
        <push-ros-namespace namespace="can0"/>
        <include file="$(find-pkg-share ros2_socketcan)/launch/socket_can_bridge.launch.xml" >
            <arg name="interface" value="can0"/>
            <arg name="from_can_bus_topic" value="rx" />
            <arg name="to_can_bus_topic" value="tx" />
        </include>
    </group>

    <group>
        <push-ros-namespace namespace="can1"/>
        <include file="$(find-pkg-share ros2_socketcan)/launch/socket_can_bridge.launch.xml" >
            <arg name="interface" value="can1"/>
            <arg name="from_can_bus_topic" value="rx" />
            <arg name="to_can_bus_topic" value="tx" />
        </include>
    </group>

Until https://github.com/autowarefoundation/ros2_socketcan/pull/39 is released in binary form.

Timple avatar Apr 08 '24 07:04 Timple