Arm Link Sequence Playback

PC Control

This article will show you how to use the Arm Link Software and Firmware to capture, change and arrange a sequence of poses. You can then save that sequence to a new stand-alone firmware. This sequence can be integrated into your own custom projects.

Before you start this project, make sure you've assembled, programed, and tested your robotic arm by going through the Snapper Arm Getting Started Guide. You will also need to go through the Arm Link Software getting started guide to learn how to install and use the Arm Link Software.

For more information on Arm Link and Arm Link References, please see the Arm Link Overview Page

Project Parts List

This demo will require the hardware you setup in the Previous Arm link Guide as well as a RobotGeek Pushbutton or other momentary pushbutton with pullup resistor. This pushbutton is included in the Snapper Arm Complete Kit.

Step 1: Hardware Installation

Wiring will be very similar to what you set up in the Previous Arm link Guide. The only difference is that this demo will also need a pushbutton on pin 2 of your microcontroller. This buttom will be used to start / stop the sequence.

Your Robotic Arm will need to be plugged into your computer via the USB cable while programming and running the Arm Link Software. However once you have programmed the Stand-Alone SnapperArmPlayback sketch (Step 3), you can unplug the USB cable.


Step 2: Create a Sequence Using Arm Link

Follow the instructions in the Arm Link Software Guide to install the SnaperArmLinkSerial firmware onto your Robotic Arm as well as to install the Arm Link Software onto your computer.

Once your firmware and software are setup, connect to the Robotic Arm in the Arm Link Software. Click the 'New Pose' button in the Sequence Panel to create a new pose. The new pose will be indicated by a numbered panel to the right of the pose panel buttons. This newly created pose will contain the coordinates that the Control Panel currently shows , the default pose.

Now use the Control Panel to choose a new position for the Arm to move to. Click 'Update' to make sure that the arm has moved to the position you intended it to go to. Feel free to make slight adjustments to the arm to the correct position. Once you are happy with the arm's position, click the 'New Pose' Button again and you will see another pose created. This pose will contain the coordinates that the Control Panel currently shows.

Repeat this process of positioning the arm and making new poses until you have the desired number of poses. Click the 'Play Poses' button to see all of your poses in action. Press 'Stop Poses' to stop the playback. Playback will always start with the selected pose, unless no poses are selected, which will start the playback from pose 0.

If you need to adjust a pose, first click on the individual pose to select it. The pose should expand to be larger than the other poses to show it is selected. Now click 'Load Pose' to load the pose into the control panel. You will need to click 'Update' to physically move the arm to that poses's position. You can now make any adjustments to the control panel to adjust the pose. Once you are happy with the pose, click 'Save Pose' to save the pose data back into the selected pose.

You can load a pose, then create new poses to make copies of a specific pose. You can also drag and drop poses to re-order them. Poses will maintain their color, but lose their specific numbering.

There are two timing variables you can adjust. The first is the Delta value (the amount of time it takes to complete the pose). The delta value is unique for each movement. A smaller delta value will create a faster movement, and a larger delta will create a slower movement.

The second variable is the pause value. This value determines how long the arm will wait after the pose is complete before it initiates the next pose. This pose can be set to 0, or any arbitrary value. Simply enter the time value in milliseconds, and each pose will wait for that period of time. In the Arm Link Software, this value is global for all poses, though it is possible to change it per-pose once you've exported the sequence.

Once you are satisfied with your sequence and timing, press 'Save to File'. This will open a window dialog and ask you to pick a folder to put the exported armSequence.h file. Temporarily put the file on your Desktop.

Step 3: Load the Sequence into the Stand Alone Firmware

In the Snapper Arm Getting Started Guide you should have downloaded the Snapper Arm Demo Code and added it to your RobotGeek sketches folder. This file included the SnapperArmPlayback code. Before you open the sketch in your IDE, you will need to copy your armSequence.h file into the SnapperArmPlayback folder. Assuming your Arduino folder is in your Documents folder, you can find the SnapperArmPlayback here:

Documents -> Arduino -> RobotGeek sketches -> SnapperArm -> SnapperArmPlayback

In this folder you will find several files including a default copy of armSequence.h. The default copy of the file moves each axis on the arm sequentially. You can save this file in another folder for later use, or you can delete it. Now copy the armSequence.h file you saved to your desktop into the SnapperArmPlayback folder.

Now you can open the SnapperArmPlayback sketch into your Arduino IDE. In the Arduino IDE, you can find the sketch under:

File -> Sketchbook -> RobotGeek sketches -> Snapper Arm -> SnapperArmPlayback  

Before you can load the code onto your Robot Arm, you'll need to adjust your code to match your gripper type. In the Arduino IDE, click on the tab GlobalArm.h Around line 16 you should see the following code block


If you are using the RobotGeek Parallel Gripper, uncomment the second line. Your code should look like


If you are using the RobotGeek 9G Gripper, uncomment the first line. Your code should look like


Now that the gripper type is defined, the code will take care of correctly processing your gripper type. If you are having problems finding these lines, click on the Compile button in the Arduino IDE and it will show an error near the lines you need to change.

Now you can load the sketch onto your Geekduino. The arm should go to its home position while it waits for the sequence to start. You can activate the sequence by pressing the button you have attached to the arm, or by opening the serial monitor (38400 baud) and sending a 1.

Your arm will now play the sequence you designed. The arm will play the sequence once and then stop on the last pose. The actions should be the same as they were in the Arm Link Software. You can start the pose again by pressing the pushbutton/entering the serial command again.

If you press the button a second time, the arm will stop when it finishes its current pose. If you send a '1' over the serial terminal, the arm will complete its entire sequence and then stop.

Advanced Usage

Minimal Code

The folder SnapperArmPlaybackMinimal contains a sketch with the minimum amount of code to play the arm sequence one time. This code may assist you if you wish to integrate the arm playback code into existing projects/code. If you want to add your own sequence into this file, add the contents of the do loop in armSequence.h into the setup loop in SnapperArmPlaybackMinimal.ino

IKSequencingControl() Overview

The armSequence.h file works by making several calls to the IKSequencingControl() function. This function allows you to easily move the arm to a specific position.

The IKSequencingControl() function takes parameters.The snapper arm only uses 8 of these parameters. The 'Wrist Roate' parameter should be set to a '0' value.

Parameter # Cartesian Mode Cylindrical Mode Backhoe Mode
1 X-Axis Base Servo Rotation
2 Y-Axis Coordinate Shoulder Servo Rotation
3 Z-Axis Coordinate Elbow Servo Rotation
4 Wrist Angle ° Wrist Servo Rotation
5 Wrist Rotate
6 Griper Servo Rotation
7 Delta Value (milliseconds)
8 Pause Value (Milliseconds)
9 Enable

For example, in cartesian mode, the following line will move the arm to (0,150,150) (X,Y,Z) with a 0° wrist angle, and the gripper closed. It will move over a period of 2 seconds and wait for one second after pose completion.

IKSequencingControl(0 , 150 , 150 , 0 , 0 , 0 , 2000 , 1000, 1);

Adjusting Timing

You can fine tune each pose by adjusting the 7th and 8th parameters in the IKSequencingControl() function. Changing the 7th parameter, the delta value will effect the time it takes for the arm to move from its current position to the next position. The previous examples has the arm moving over 2000 milliseconds. If you want the arm to move over 5000 milliseconds, change the code to

IKSequencingControl(0 , 150 , 150 , 0 , 512 , 0 , 5000 , 1000, 1);

Changing the 8th parameter, the pause value will effect the time the arm waits after the pose is completed. The previous examples has the arm waiting for 1000 milliseconds. If you want the arm to move to the next position immediately, change the code to

IKSequencingControl(0 , 150 , 150 , 0 , 512 , 0 , 2000 , 0, 1);

Manually Adjusting Values

Using the Arm Link Software is the best way to generate values for the arms, as it will check limits and let you try out the arm. However it is possible to manually create your own poses from scratch. See the Arm Limits tables to see the ranges of values you can use for each arm/parameter. NOTE:The delta value listed in the previous tables does not apply to the IKSequencingControl() function. See 'Adjusting Timing' above for instructions on adjusting the delta value.

Interrupting Sequences

Once you have sent an command for the arm to move and it has begun moving, the individual pose cannot be interrupted - it will always complete the pose.

The SnapperArmPlayback code can stop a sequence after any pose via the pushbutton. This is because the pushbutton is attached to an interrupt pin. When a change is made to this pin (such as the pushbutton being activated), the currently running code is paused and special interrupt code is executed. This code sets the playState variable to 0. Any further IKSequencingControl() calls do not execute arm movements because this enable is turned off.

It is also possible to insert additional code in the IKSequencingControl() function to check for additional conditions. This will allow you to interrupt the sequence based on other conditions (like serial events, analog data, and other non-interrupt digital pins).

Advanced Pushbutton Options

If you are NOT using a pushbutton (and instead are relying on the serial terminal or automated sequences) you will need to change line 41 from

#define USE_BUTTON true


#define USE_BUTTON false

This will disable the code from trying to read the digital pin (and possible reading noise/activating the arm)

If you are using a Pushbutton with Jumper Wires or any other 2-wire momentary switch, change line 45 should be


Changing this #define will set the logic up and the pull up resistor for your pushbutton.

If you are using a RobotGeek Pushbutton or a pushbutton with a built in pull-down resistor, you can leave the define as-is.



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

Feedback Form