This code used here is from NOX a House wandering robot with Git repo, updated to move on "motor controller BTS7960" instead of " Adafruit motor shield "
Base controller sketches (arduino/esp firmware code) for a 2WD robot using Ros with Encoders, DC-motor.
-
first upload the sketch on your development board (esp32/ Arduino mega), do hardware connections.
-
please type "sudo dmesg | grep tty " to find the comm port number of your board (I got /dev/ttyUSB0).
-
please run "rosrun rosserial_python serial_node.py /dev/ttyUSB0 " in one terminal. (change your comm port accordingly)
-
please run " rosrun teleop_twist_keyboard teleop_twist_keyboard.py " in another terminal to view wheels spinning.
-
motor driver : BTS7960 (43Amps).
-
Motors: custom gearbox using RS775 motors with 25:1 gear ratio.
-
encoder : currently using absolute encoder with 20 Counts per revolution (rotary encoder ky-040).
-
volatge regulator : LM2596 DC DC Voltage Regulator with display.
-
battery : 12V 7.2AH Battery .
-
PC: Currently using my laptop, later will be using raspberry pi/ Jetson Nano.