Arm Link Sequence Playback

Description

mt_ignore
Standalone
mt_ignore
Pose Playback
mt_ignore
PC Control (Setup Only)

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 appropriate Getting Started Guide for your arm. 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.

Project Parts List

b_400_400_16777215_00__images_projects_armControl_armControlSquare.png

Step 1: Hardware Installation

Check the Getting Started Guide for instructions on assembling, programming and testing your Robot Arm. Your Robotic Arm will need to be plugged into your computer via the FTDI-USB cable while programming and running the Arm Link Software. However once you have programmed the Stand-Alone InterbotiXArmPlayback sketch (Step 3), you can unplug the FTDI-USB cable.

If you plan on using a pushbutton to pause/play the stand alone firmware, attach it to digital pin 2.

b_400_400_16777215_00__images_tutorials_armSequence_arbotiXArmSequenceJumper.png b_400_400_16777215_00__images_tutorials_armSequence_arbotiXArmSequenceRG.png

Step 2: Create a Sequence Using Arm Link

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

For the rest of this guide we will stay in the Cartesian/Straight Arm mode/orientation. These same instructions can be followed to create a sequence in any of the other modes/orientations. For information about mixing modes, see the end of this article

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

Download the InterbotiX Arm Firmware Standalone

Download the Standalone Arm Firmware zip file. Unzip the file and open the InterbotiXArmPlayback folder. 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 InterbotiXArmPlayback folder.

Now that your files are all set up, open the InterbotiXArmPlayback.ino file in Arduino. In the InterbotiXArmPlayback.ino file on line 35 you will see the following block of code:

//#define ARMTYPE PINCHER
//#define ARMTYPE REACTOR
//#define ARMTYPE WIDOWX

For example, to get the code to work with the Reactor arm, un-comment the line REACTOR #define

//#define ARMTYPE PINCHER
#define ARMTYPE REACTOR
//#define ARMTYPE WIDOWX

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

to

#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

#define BUTTON_TRUE LOW

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.

#define BUTTON_TRUE HIGH

Now you can load the sketch onto your ArbotiX-M. The arm should go to its sleep position and wait for a command. 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 InterbotiXArmPlaybackMinimal 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 InterbotiXArmPlaybackMinimal.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.

Before you use the IKSequencingControl() function, you need to set the arm mode. This can be done by setting the global variable g_bIKMode.

IK Mode g_bIKMode enum g_bIKMode raw value
Cartesian - Normal Wrist IKM_IK3D_CARTESIAN 1
Cartesian - 90° Wrist IKM_IK3D_CARTESIAN_90 2
Cylindrical - Normal Wrist IKM_CYLINDRICAL 3
Cylindrical - 90° Wrist IKM_CYLINDRICAL_90 4
Backhoe/Joint Mode IKM_BACKHOE 5

For Example, to set the IK mode to Cartesian mode / Normal Wrist, set the variable like this:

g_bIKMode = IKM_IK3D_CARTESIAN;

Once this variable is set, you can begin to use the IKSequencingControl() function. This function will always take 9 parameters. Each parameter will vary depending on which mode you are using the arm in.

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, centered wrist rotate, 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 , 512 , 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.

Mixing IK Modes

Mixing IK modes is not currently supported. It is possible to mix modes by changing the IK mode between IKSequencingControl() calls, but it is currently untested.

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 InterbotiXArmPlayback 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).

Sleep Mode After Sequences

At the end of armSequence.h you will see

 //PutArmToSleep();

If you un-comment this line you the arm will move to sleep position after the sequence is done. You can add other code here as well to have the arm do other actions after a sequence.

×

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