Control multiple servos using motor controllers with ROS2 and Python.
This project provides a Python-based interface to control servos using the Pololu Maestro controller.
- Python 3.6 or higher
- Pololu Maestro Control Center (optional for configuration)
pyserial
rclpy
(for ROS2 integration)
- Clone the repository:
git clone https://github.com/TheWalrus368/Servo_Controllers.git
- Install Python dependencies:
pip3 install pyserial pip3 install adafruit-circuitpython-lis3dh pip3 install adafruit-circuitpython-pca9685 pip3 install adafruit-circuitpython-motorkit
-
Setup:
colcon build source install/setup.bash
-
Starting the USB service
ros2 run servo_pkg usb_servo_service
-
OR Starting the i2c service
ros2 run servo_pkg i2c_servo_service
-
Starting the client The servo_client.py contains some sample code that controls the servo with the USB or the i2c controllers
If one of the controllers is not connected don't try to use the method in main, it will make the other not work.
ros2 run servo_pkg servo_client