Ask Your Question

how to communicate the hardware to a realtime controller

asked 2011-10-25 22:25:19 -0500

Bemfica gravatar image

updated 2014-01-28 17:10:39 -0500

ngrennan gravatar image

hi guys!

Let say that I'm using an action server to request some action to my realtime controller. And let say that my hardware (motors and sensors) are being communicating trough a CANBus (not realtime) and I have a node to parse the CAN messages and read/write over the bus. The question is how to link up the "CAN node-driver" to the controller in a "realtime-safe way". I should use another action client? I should use services?

PS: the message parser communicates with the bus using treads, and currently is not linked with the realtime controller.

thank you in advance!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-10-26 21:15:14 -0500

tfoote gravatar image

If you're talking to the controller over a CAN bus, which is not realtime safe. There's no way to implement a realtime controller in software.

A common way to do a realtime controller is to have the realtime thread and a non-realtime thread which does the external communications, and passes data into the realtime thread in a lock free manner. You can do this but it's not going to be worth the effort if you're on the other side of a CAN bus. Realtime requirements are about guaranteeing maximum response times, if there's ever a link which cannot provide those guarantees you cannot continue to be realtime beyond that connection.

edit flag offensive delete link more


okay I know that, BUT, I can do guarantee if the bus doesn't gives me the response in X time, the data is no more valid so, do some safety action... this is sotf realtime but it's good enough in my case. tks for the look free trick
Bemfica gravatar image Bemfica  ( 2011-10-27 21:50:17 -0500 )edit

answered 2011-10-25 23:26:21 -0500

dornhege gravatar image

My unqualified guess would be to not use ROS functionality for realtime interfaces at all, i.e. do it directly.

edit flag offensive delete link more


are you saying by using RTAI? or simply to put everything inside the controller?
Bemfica gravatar image Bemfica  ( 2011-10-25 23:58:41 -0500 )edit
I would say that you should eliminate all TCP/IP and queuing caused by ROS. If you want a ROS interface in between _maybe_ a nodelet might work, but I'm not sure about that.
dornhege gravatar image dornhege  ( 2011-10-26 03:47:24 -0500 )edit
excuse me, maybe I'm losing something but, so the pr2_mechanism is useless? because I'm trying to follow the same way to implement my controller, the only difference is that I'm not using the Ethernet card to communicate with the robot. Instead I'm using a PCI CANbus card.
Bemfica gravatar image Bemfica  ( 2011-10-27 21:18:21 -0500 )edit
I'm very sure the PR2 stuff is thought through! I'm just saying if you put any TCP/IP, queuing, etc. in between you don't have realtime guarantees. For my CAN bus driver I've used an approach similar to the one described by tfoote.
dornhege gravatar image dornhege  ( 2011-10-28 05:27:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-10-25 22:25:19 -0500

Seen: 1,336 times

Last updated: Oct 26 '11