ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Signal Driven SocketCAN Node [closed]

asked 2017-12-21 03:19:16 -0500

Yousof gravatar image


I am trying to establish a signal-driven SocketCAN in Linux with C++ as a ROS node. I am facing some issues. First of all I do not have the SIGIO signal for every message. Therefore at the reception of SIGIO I am reading from the socket until there is no message left. This is somehow solvable although It would be nice to know the reason and it may be a cause for the second unsolved problem.

The main problem is that in my signal Driven CAN ROS node, the messages are not sometimes read in the order of the arrival. Sometimes it is not FIFO. But interestingly the timestamp of the message is correct. For example the following image is showing the output of the candump can0 -ta -c on the left side and on the right side the output of my CAN node is shown. As you can see there is a a message in the wrong order (labeled with Time Error: ) on the right side.

Can this happen because of multi threading by ROS?? I am not doing any multi-threading in my node.

image description

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see for more details. by ahendrix
close date 2017-12-22 12:13:01.881571

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-22 12:12:45 -0500

ahendrix gravatar image

This seems like a Linux SocketCAN programming question, since you're having trouble with SocketCAN and not with ROS.

I haven't used SIGIO, but I suspect that like other signals, if a signal is already queued for processing the OS will not queue another signal until the first has been processed. It looks like your messages are coming in quickly enough that this could be happening.

ROS shouldn't be doing anything that would change the message delivery order, but putting together a simpler program that doesn't use ROS may help you isolate the issue.

I think the socketCAN layer in linux is supposed to deliver messages in order, but I've seen a few posts on the linux-can mailing list over the past year from people reporting bugs in message delivery order. I suggest you review the mailing list archives and look for potential bugs in your CAN driver: . If you don't find anything, I suggest that you join the mailing list and ask.

edit flag offensive delete link more


Thanks @ahendrix , Is there any other form of community rather than a mailing list about this topic?

Yousof gravatar image Yousof  ( 2017-12-30 04:08:54 -0500 )edit

Because the archive of the mailing list that I found contains very small amount of information.

Yousof gravatar image Yousof  ( 2017-12-30 07:32:19 -0500 )edit

Question Tools

1 follower


Asked: 2017-12-21 03:19:16 -0500

Seen: 426 times

Last updated: Dec 22 '17