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

Revision history [back]

click to hide/show revision 1
initial version

Hi

Commomly, servos are controlled by PWM. So you'll need a piece of hardware which offers such an interface (Pin). Rasperry Pi as well as Arduino will do (see links for more detailed explaination and exemplary tutorials on how to do this without ROS). On a Pi you can use Python. On an arduino you will basically write C++.

On a current Pi4 ROS2 should be able to install and run ROS natively, so you can just install it write a ROS node which controlls the servo directly. To interface ROS from lower level devices you can use micro-ROS if your plaform is supported (see link). If not supported like an arduino uno you will have to use a ROS node on a regular PC (or Pi...) and control the arduino with a common interface such as serial. The proper way to do so would be implementing a ROS2 control hardware interface such as done here but for a start it might be easier for you just to use the arduino firmware and a serial library (Serial lib (C++) or PySerial(Python)) in your ROS node e.g. if you just want a simple subscriber to servo position topics.

Finally, the question will be how do you want to control your Robot? Will there by any kind of other sensors and/or user input (e.g A gamepad, a camera with image processing, etc...)? Those will require other pieces of hard- and software, possibly on other computers connected to a network. Connecting them to your robot and keeping everything modular is where ROS will come into account. Otherwise it could also be that ROS would be overkill for your application.

From your questions it seems you will have quite a bit to look into. I hope the links provided will serve as a good start.