This demo shows how to control the Snapper robot arm from code using basic servo interpolation. Servos can be moved one at a time or in batches. Interpolation is used to move the servos incrementally over time and produce smooth arm movement.
If you have not already, make sure you have gone through the Snapper Arm Getting Started Guide this will help make sure you've downloaded the RobotGeek Tools and Libraries, the demo firmware and have setup and tested the arm.
Project Parts List
The RobotGeek Snapper Robot Arm Kit comes with all of the robotic hardware you need for this demo.
This project can also be done with the RobotGeek Snapper Core Arm kit, assuming that you have your own microcontroller, power supply and wiring.
Whether you are building the complete snapper arm or working off the core kit, you will need to connect all of your servos as noted here for testing and operation.
During the assembly of the Snapper Arm, you should have wired up your servos to the sensor shield. Please take a moment to double check your connections and jumper match the following diagrams.
Note that if you have the original 9G Mini Servo Gripper, you should follow the original wiring diagram. The only difference is that you will attach the 9g servo to pin 10 instead of attaching a RobotGeek Servo
|Device||Sensor Shield Port|
It is not necessary to attach your controls to the arm for testing, but having them plugged in will not impede this demo.
The rest of this guide assumes that you've set up the required libraries and sketches in the Snapper Arm Getting Started Guide
Open the following sketch:
File -> Sketchbook -> RobotGeek sketches -> Snapper Arm -> Basic Examples -> RobotGeekArmInterpolation
Before you can load the code onto your Robot Arm, you'll need to adjust your code to match your gripper type. Around line 64 you should see the following code block
//#define GRIPPER_TYPE ROBOT_GEEK_9G_GRIPPER //#define GRIPPER_TYPE ROBOT_GEEK_PARALLEL_GRIPPER
If you have any problems finding these lines, just press the 'compile' button and you'll see an error just below the code block.
In the code block, the two lines are Commented Out. Any line that starts with
// is not processed by the Arduino IDE. This is useful for making code comments or to de-activate code without deleting the line. You will need to Uncomment one line by removing the slashes as shown below.
If you are using the RobotGeek Parallel Gripper, uncomment the second line. Your code should look like
//#define GRIPPER_TYPE ROBOT_GEEK_9G_GRIPPER #define GRIPPER_TYPE ROBOT_GEEK_PARALLEL_GRIPPER
If you are using the RobotGeek 9G Gripper, uncomment the first line. Your code should look like
#define GRIPPER_TYPE ROBOT_GEEK_9G_GRIPPER //#define GRIPPER_TYPE ROBOT_GEEK_PARALLEL_GRIPPER
You can now load the code onto your Geekduino. Remember to have plenty of room for the arm to move before you program it so that the arm doesn't accidently hit anything.
The code will move the arm to diffrernt hard-coded positions over a period of time.
PC Control These demos and projects allow the robot to be controlled via a computer.
ArbotiX Commander Control - These demos and projects control the Robot using the ArbotiX Commander, the handheld Arduino based remote control.
Direct Control - These demos and projects control the Robot directly from sensors connected directly to the Robot's control board.
Pose Control - These demos and projects allow you to create and playback a sequence of poses.
Serial Control - These demos and projects control the robot using a serial packet protocol.
Standalone - These demos and projects are deisgned to let your robot function without a computer or additional microcontroller.
Wireless Control - These demos and projects allow you to control the robot wirelessly - usually by replacing the Serial Connection with XBee modules.
Reference - These articles have technical details regarding the control and operation of the robot.
More info here