0
$\begingroup$

Rosanswers logo

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...


Originally posted by 9a3eedi on ROS Answers with karma: 63 on 2017-08-03

Post score: 1


Original comments

Comment by Mathias Lüdtke on 2017-08-04:
Which errors do you get?

Comment by 9a3eedi on 2017-08-07:
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.

Comment by peterlin300 on 2017-08-07:
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?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Mathias Lüdtke with karma: 1596 on 2017-08-04

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by 9a3eedi on 2017-08-07:
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.

Comment by Mathias Lüdtke on 2017-08-07:
You can read (only) the error frames with candump -l any,0~0,#FFFFFFFF. (see /usr/include/linux/can/error.h for the layout)

Comment by Mathias Lüdtke on 2017-08-07:
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 https://www.kernel.org/doc/Documentation/networking/can.txt)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.