ros_canopen icon indicating copy to clipboard operation
ros_canopen copied to clipboard

CAN Bridge Node can't differentiate between multiple interfaces after reception / before sending

Open njoye opened this issue 2 years ago • 2 comments

Currently the socketcan_bridge_node (consisting of the topic_to_socketcan_node and the socketcan_to_topic_node) can't differentiate between multiple socketcan interfaces as soon as the messages are published in the ROS network or before the messages are passed to the socketcan bridge. The reason for this is that the topic name of each node is fixed to received_messages and sent_messages without regard for the can interface. I will provide a PR in the next days that will make the topic name changeable through the use of ros parameters similar to the parameters that can be set for the can interface name. This will allow users to send data onto two different can busses without sending them onto both at the same time as well as receiving messages from different can busses on different topics which might reduce or eliminate the need for filtering and discarding unnecessarily received messages.

Backwards-compatibility will be achieved by defaulting to the existing topic names should no parameter be set.

njoye avatar Jun 01 '22 15:06 njoye

What about remapping the topics?

Topic names as parameters is a bit of an anti-pattern.

gavanderhoorn avatar Jun 01 '22 16:06 gavanderhoorn

  <!-- Socket CAN bridge can1-->  
  <node pkg="socketcan_bridge" type="socketcan_bridge_node" name="socketcan1_node" output="screen">
    <param name="can_device" value="can1" />
    <!-- <rosparam param="can_ids"> [ ] </rosparam> -->
  </node>

  <!-- Socket CAN bridge can0--> 
  <node ns="can0" pkg="socketcan_bridge" type="socketcan_bridge_node" name="socketcan0_node" output="screen">
    <param name="can_device" value="can0" />
    <rosparam param="can_ids"> [ 390, 646 ] </rosparam>
  </node>

We're using 2 different can interfaces also by just putting the nodes into a namespace. :-)

ivan140 avatar Jul 13 '22 09:07 ivan140

Probably got carried away when thinking about this problem. I’ll see to do just that … issue can be closed.

Am Mi., 01.Juni.2022 um 18:28, G.A. vd. Hoorn @.***> schrieb:

What about remapping the topics/

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

njoye avatar Oct 11 '22 08:10 njoye