Rosanswers logo

I'm looking for some servo motors that I can use on a ROS2-based robot and am unsure what my options are. Ideally the motors would have integrated controllers that I could plug straight into the robots onboard computer and interfacing them with an available ROS2 package would be easy.

The trouble is that I really don't know if such a thing exists or exactly what makes a particular motor or controller ROS2 compatible. Could anybody advise where to start?

Originally posted by Py on ROS Answers with karma: 501 on 2022-01-26

Post score: 0


1 Answer 1


Rosanswers logo

Any motor can be "compatible" with ROS2. You just may need to make some interface (hardware and/or software) between that motor and ROS2. That being said, I think your question is really 1) How do I interface my motor hardware to my computer running ros2? and 2) How do I control that motor from ros2?

I'm no expert on what packages exist for this, I can only speak to my own experience with my own projects. Depending on what kind of onboard computer you have will change how you'd want to make that interface:

How to Connect Motor Hardware to Ros2 Computer

If your on-board computer has GPIO pins that can produce a PWM (or other) signal to control your servos, then you can just wire your motor driver directly to your on-board computer.

If your on-board computer doesn't have GPIO pins then you can use a micro-controller to interface the hardware and software. I've used arduinos, teensys, flight controllers, etc before with good success here.

How to Control Motor From Ros2

This part kinda depends on what you're needing to do with the motor. If have a motor position sensor like an encoder, or potentiometer, then you may want to work with the ros2_control stack. With ros2_control, you need to provide some urdf and other configuration files, and (most likely) a hardware interface plugin. This hardware interface plugin is responsible for reading feedback from and writing commands to your motor via your GPIO pins, arduino, teensy, etc.

If you don't need the full ros2_control stack, you'll probably want to write some node to accept motor commands via a ros2 topic, service or action, and set the motor control signal accordingly. Again that'l either be via GPIO pins, arduino, teensy, etc

For example, I've been integrating the 3D printed Moveo robotic arm into the MoveIt2 stack. I ended up using a teensy 4.1 with micro-ros to control my motors, and the ros2 control stack with a custom hardware interface plugin to send the right joint positions to the teensy. Micro-ros is great because you can make the micro-controller itself a ros2 node able to publish, subscribe, etc to ros2 via the micro-ros agent.

Originally posted by ChuiV with karma: 1046 on 2022-02-04

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

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