ros2_socketcan
ros2_socketcan copied to clipboard
Feature request: disable loopback
In ros1 we used to use the socketcan bridge to convert the canbusses to can_msgs/Frame
ros messages. All messages we put on /to_canbus
were never on the /from_canbus
topic.
However, for ROS2 this package is recommended it seems.
Now we do see all messages we send on the /to_canbus
back on the /from_canbus
topic. Not only led this to (solvable) issues, but this actually almost doubles the frequency of the /from_canbus
topic. And (thus) doubles the handling effort on the subscribing nodes as these messages need to be discarded.
Is there a way to get the 'old' behavior back?
This could be implemented by adding
// Check if it's a TX frame
if (frame.can_id & (CAN_ERR_TX_TIMEOUT | CAN_ERR_CRTL_TX_WARNING | CAN_ERR_CRTL_TX_PASSIVE))
{
// This is a TX frame, ignore it
continue;
}
After the read
here: https://github.com/autowarefoundation/ros2_socketcan/blob/d25a55528eb7b27ab3c22c1b888a7276ae4af6f9/ros2_socketcan/src/socket_can_receiver.cpp#L140C48-L140C53
Would such a PR be accepted if not made optional? As I can't think of a usecase where anyone wants this. As they also could subscribe to the /to_can_bus_topic
topic.
I'm also interested by this!