This package explains how to control PWM DC motors and Servo motors using ROS
- RHINO 60RPM 40KGCM 12V DC PLANETARY GEARED QUAD ENCODER SERVO MOTOR - 1
- Cytron DC Motor Driver MD10C -1
- 12 V DC Power supply
- BreadBoard
- Jumper Wires
- Teensy 4.1
- ROS Noetic
- VS Code with PlatformIO
-
Name the project, Select Board teensey 4.1
-
Create src/main.cpp, paste the code present in src folder. Change the CPR Value for adjusting the angle of rotation of motor.
-
Go to Include folder and make a file named PositionControl.h and paste the given code.
-
Go to libraries section and search for ros. Download the Rosserial Arduino Library by Michael Ferguson. Select the project name and add project dependency.
-
Add one more library named 'AutoPID' using same method.
-
Compile the Code and upload to teensey.
-
Run the below commands in separate terminals:-
-
Terminal 1:
roscore
- Terminal 2:
rosrun rosserial_arduino serial_node.py /dev/ttyACM0 _baud:=9600
- Terminal 3:
*rostopic pub /position_in std_msgs/Float32 "data: 10.0" -1*