Arduino software to steer the SainSmart DIY 6-axis palletizing robot arm and Sunfounder Rollpaw gripper.
The software uses smooth sin²(t) (where t is the time) speed profiles to drive the robot joints. At any time the sum of up to two speed profiles is output to the drives. Using sin²(t)+cos²(t)=1 one can achieve constant motion. The plot shows jerk (blue), acceleration (red), speed (green), and position (magenta).
Altogether the equipment cost is about 200£. Furthermore you need a PC with a USB port.
First install the dependencies. Please refer to the file .travis.yml for more information.
Create the initial calibration file with the limits and offsets of each servo:
cp calibration.hh.default calibration.hh
Then build the Arduino program using make:
make
Note: You might have to change the BOARD_TAG in the arduino/Makefile. See /usr/share/arduino/hardware/arduino/boards.txt for supported board tags.
You can also build and run the tests on the PC using the check target:
make check
The upload target will upload the program via /dev/ttyUSB0 to the Arduino board.
make upload
Warning: program the board before connecting the servos the first time to prevent erratic motion!
Warning: once servos are plugged into the board, always connect the servo power to the DFRobot I/O expansion shield before connecting the USB cable to the Arduino to prevent the board power from stalling which causes erratic motion!
Warning: self-collisions or collisions with the surface and other objects can damage the servos!
You can then adjust the limits and offsets for your robot and then compile and upload the modified software.
You can control the robot using the screen serial terminal (make sure ttyUSB0 is the correct port):
screen /dev/ttyUSB0 115200
Examples of servo commands are:
You can exit the screen terminal using Ctrl-A \.
Warning: self-collisions of the robot can damage the servos!
You can control the robot using a calibrated XBox controller.
ruby control.rb
Note that for some reason you sometimes need to run the serial terminal first, press t a few times, and then exit for the Arduino to wake up.