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

Does a CAN bus library or package exist in ROS?

asked 2014-01-27 14:54:27 -0500

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

ngrennan gravatar image

Newbie here. I have installed ROS Hydro and I have run through all the ROS basic tutorials but I have no practical experience yet. I have an ELMO motor controller and motor set up on a workbench with a CAN bus interface. I'm ready to try to write some code to send commands over the CAN bus to turn the motor on and off, but I don't really know where to start.

Are there any CAN bus libraries included with ROS or something that I can download as a plugin? Any other advise for a newbie? Thanks in advance!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-01-27 20:51:35 -0500

gvdhoorn gravatar image

AFAIK there is no really 'generic CAN driver node' available, but some packages that interface to CAN do exist. For instance the cob_generic_can package:

The package cob_generic_can provides an interface for nodes on a can-bus and examplary wrappers for two PeakSys-can-libs. When a can-bus-device is generated (for an example see cob_base_drive_chain) you can use generic_can to create as many itfs as there will be components communicating via this can-bus. Assign type of the can communication device (e.g. usb-to-can or can-card of a specific vendor) and can-address of the target device. This package comes with wrappers for PeakSys and PeakSysUSB adapters.

I'm not sure you can directly use this for your specific setup, but it should provide you with enough pointers to get something going.

edit flag offensive delete link more

Comments

Thanks! I'll check it out!

Kurt Leucht gravatar image Kurt Leucht  ( 2014-02-01 03:18:08 -0500 )edit

Just curious if you got this working i am looking at using it to control some maxon EPOS controllers and was wondering if you had some pointers?

Ryan Steindl gravatar image Ryan Steindl  ( 2014-04-07 13:26:44 -0500 )edit

I have not had the opportunity yet. My machine has the can-utils installed: https://gitorious.org/linux-can/can-utils/source/67a2bdcd336e6becfa5784742e18c88dbeddc973: So I borrowed some of that code and tweaked it and wrote a node that sends CAN commands based on the cansend.c file that works fine.

Kurt Leucht gravatar image Kurt Leucht  ( 2014-04-09 03:39:14 -0500 )edit
0

answered 2014-05-05 02:58:12 -0500

This is probably a terrible answer, but my machine had the can-utils installed: https://gitorious.org/linux-can/can-u... ... so I borrowed some of that code and tweaked it and wrote a node that sends CAN commands based on the can-utils cansend.c file that works just fine for my purposes. I just needed a proof of concept so this was a quick and dirty way to prove I could send CAN messages from a ROS node. This won't be my final production code, though. I will look into the cob_generic_can package to see what benefits it gives me.

edit flag offensive delete link more

Comments

@Kurt Leucht, Is it really works that you use CAN bus node of ROS to send command to the your motor?

Terry Su gravatar image Terry Su  ( 2016-01-02 01:34:25 -0500 )edit

can you send me the code for the node please?

bob ross gravatar image bob ross  ( 2021-07-09 11:07:05 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2014-01-27 14:54:27 -0500

Seen: 8,558 times

Last updated: May 05 '14