ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

socketcan_bridge_node error handling

asked 2017-08-03 04:52:39 -0600

9a3eedi gravatar image

I have an application that uses socketcan_bridge_node to do CAN communication. It works well, but occasionally the CAN network enters an error mode and the entire bridge node stops working. Is there a way I can detect this and reset the CAN?

The interesting thing is that, even if the node is in error mode, I can still send CAN packets on the same network without resetting using canutils (cansend, etc.). This tells me that the problem lies with the node not handling the error properly

I am not an expert on CAN networks however, so there might be something about CAN errors that I'm not understanding...

edit retag flag offensive close merge delete


Which errors do you get?

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2017-08-04 10:14:44 -0600 )edit

I'm getting "controller problems". It's really hard to isolate though, it only seems to happen when a microcontroller (not the computer running ROS) in the CAN network starts controlling a motor, and outdoors (hot weather) not indoors. Either way, I just want to be able to recover as a workaround.

9a3eedi gravatar image 9a3eedi  ( 2017-08-07 01:19:24 -0600 )edit

HI! I also want to use ros socketcan_interface to communicate with the robot. i.e. subscribe data and send it to my microcontroller by USB-CAN. But I don't have any idea,can you tell me maybe how should i do?

peterlin300 gravatar image peterlin300  ( 2017-08-07 09:40:43 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-08-04 10:14:29 -0600

Mathias Lüdtke gravatar image

updated 2017-08-07 14:55:56 -0600

There is no way to read the error state from the socketcan_bridge nodes or some sort of recover mechanism.

I have filed an issue to track this.

SocketCAN has different error notfications and socketcan_interface treats all as errors. The higher-level node (e.g. socketcan_bridge_node) is supposed to handle them.

In general you should not get any errors, otherwise something is wrong with your network, your settings or your load is too high.

edit flag offensive delete link more


There's definitely something wrong in the network, but I was at least hoping there's a way to recover for now until I figure out what the problem was. Thanks for filing the issue. I might actually even fix it myself.

9a3eedi gravatar image 9a3eedi  ( 2017-08-07 01:20:53 -0600 )edit

You can read (only) the error frames with candump -l any,0~0,#FFFFFFFF. (see /usr/include/linux/can/error.h for the layout)

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2017-08-07 14:48:35 -0600 )edit

The can::DriverInterface class (base of ThreadedSocketCANInterface) provides a recover function for soft errors. For hard errors the kernel interface needs to be restarted (see )

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2017-08-07 15:03:47 -0600 )edit

Question Tools



Asked: 2017-08-03 04:52:39 -0600

Seen: 1,226 times

Last updated: Aug 07 '17