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

How to connect ROS2 with a motor driver?

asked 2021-10-14 07:20:46 -0500

Spyros gravatar image

I use a Copley Controls Stepnet motor driver STP-075-07 and I programed my controller with the GUI software CME. The connection is done with the CANopen communication. Now I want to send control commands (i.e. desired position) from a ROS2 node from my laptop. The connection is going to be again with CANopen. I have the following questions:

  • What package should I use to make the connection between ROS2 and the driver, with the CANopen communication?
  • Is there any sample code, or a guide I can use as a reference?
  • How can I access and modify the values of the driver parameters (objects) through my code?

This is the first time I work with CAN communication and ROS2 (so far I was using ROS1). Now I'll work with Ubuntu 20 and ROS2 foxy. Any feedback is appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-10-14 09:00:20 -0500

Dragonslayer gravatar image

As I assume you send direct can messages, you will likely have to go with a hardware interface. ros2_control I also looked into this, and I didnt come across good documentation. I got this information though, might help.

edit flag offensive delete link more


I use a CAN-to-USB adapter which ends up on my laptop. If I install the relevant linux driver of the adapter, would I still need this hardware interface package?

Spyros gravatar image Spyros  ( 2021-10-14 09:32:16 -0500 )edit

I would think so if that driver isnt a special ros driver. Its in the Hardware-Interface where you take ros topic data and "repackage" it to an outgoing standard (or the other way arround -> input). Depending on how your usb-can works you either have to send it as straight serial data trough the usb-port and the adapter makes it can protocol conform or your driver has some sort of API to use, or you have to use a can library to make your data conform. Here is the last working example I know of, they use a frame, though not a can frame, might give you some additional insight. Finally I dug up this library, I had it bookmarked, but I never had the time to go into can myself yet, so I dont know if this is worth it. However I also saved this link with it, so ...(more)

Dragonslayer gravatar image Dragonslayer  ( 2021-10-14 11:15:28 -0500 )edit

Would be nice if you could give an update once you figured it out. thanks. All the best.

Dragonslayer gravatar image Dragonslayer  ( 2021-10-14 11:15:58 -0500 )edit

Question Tools



Asked: 2021-10-14 07:20:46 -0500

Seen: 974 times

Last updated: Oct 14 '21