Author: Ashwin Thomas Email: thomaa7@unlv.nevada.edu
Date: Last modified on 07/17/18
Keywords: HDT Arm, Tutorial, Basics, Movement, Launching and Running program
The photo above depicts the HDT Arm which allows you to grab, move, and track things. It is located near the kitchen area and controlled by the computer shown in the image above. This tutorial shows you how to run basic programs for the HDT Arm and shows off four programs: HDT Arm Motion, HDT Arm Object Tracker, HDT Arm Position Movement, and HDT Arm Hand Control. This tutorial takes about 30 minutes to complete.
This tutorial's motivation is to help readers understand how to run basic programs and control the HDT Arm. Readers of this tutorial assumes the reader has the following background and interests:
* Know how to work in ubuntu
* Perhaps also know how to set up all the basic hardware for the arm - i.e. plug in everything and turn on the computer
* Understands python coding
The rest of this tutorial is presented as follows:
IF YOU ARE HAVING TROUBLE VIEWING THE IMAGE THEN CLICK IT TO GET THE FULL SIZE PICTURE
This section gives step-by-step instructions along with photos to run programs for the HDT Arm.
Step 1
Open the “Home Folder” and navigate to the “launch” folder using the file path shown in the right image (click image to expand).
Step 2
Open the Terminal by clicking on the icon shown on the left. This will open the Terminal window.
Step 3
Change the directory to the “launch” folder by typing:
cd '/home/dasl/catkin_ws/src/mk2_controller/launch'
Step 4
To run a program for the arm type:
roslaunch [full_name_of_file]
Type in the name of the file into the bracketed portion (brackets aren't included in the actual command, they're just there for reference). To terminate a program at any time, click “Ctrl+C” in the terminal window.
After setting up the terminal (shown in previous section) type
roslaunch mk2_ik_joy.launch
into the terminal to begin the basic movement program for the arm. The screen shown in the above image should appear if the program is launched successfully.
Movement Controls
This is the main controller for the HDT Arm.
WARNING: BEFORE YOU BEGIN, MAKE SURE THERE IS PLENTY OF OPEN SPACE FOR THE ARM TO MOVE UNOBSTRUCTED
The arm should initially be in “Home Position” as shown. All movements in this tutorial will be done based on the perspective shown in the image. The fingers of the arm should be pointing at you except the thumb which should be pointing towards the floor. To return to the “Home Position” simply click the “8” trigger on the controller.
Push the left joystick up to move the arm backwards/away from you (left image). Push the left joystick down to move the arm forwards/towards you (right image).
Push the left joystick left to move the arm to the left (left image). Push the left joystick right to move the arm right (right image).
Push the right joystick up to raise the arm (left image). Push the right joystick down to lower the arm(right image).
To end the movement program, simply open the terminal and press “Ctrl+C”.
After setting up the terminal (shown earlier) type
roslaunch mk2_ik_vision.launch
into the terminal to begin the basic movement program for the arm. The screen shown in the left image should appear if the program is launched successfully. The window shows the feed being captured by the camera which is mounted on the arm. The arm should also assume the “Home Position” as shown on the right with the front two fingers pointing towards you and the thumb pointing to your right. To end the program at anytime, simply open the terminal and press “Ctrl+C”.
WARNING: BEFORE YOU BEGIN, MAKE SURE THERE IS PLENTY OF OPEN SPACE FOR THE ARM TO MOVE UNOBSTRUCTED
It is best to use a brightly colored object as it is easier for the arm to track. In this tutorial a sponge was used.
To begin, hold the object in view of the camera. The object should be near center.
Next, move the mouse over the object. Click the left mouse button and drag to create a small box around the object. This box doesn't have to cover the entire object it only needs to capture the color you want to track. Once the box highlights the color you want to track on screen then let go of the button. If done successfully, the screen should resemble the image on the right. If the selection isn't done properly (i.e. the circle is much too large or covers nearly the entire screen) then simply click the left mouse button in the camera feed to cancel the selection. A new selection can be made now. The program may need to be closed and relaunched in order for the arm's tracking to work if a redo is needed.
Now you can slowly move the object around within the arm's view and the arm should track it. A word of warning; the arm's tracking function can fail which might make the arm move erratically. If this occurs then click the “8” trigger on the controller and the arm will return to home position and stop. The program will now have to be closed and relaunched in order to run the tracking function.
Open the terminal and type:
roslaunch mk2_controller mk2_pos.launch
This launches the position movement program. It will turn the arm to different positions based on the buttons that are pressed.
MAKE SURE THERE IS PLENTY OF ROOM WHEN USING THE ARM
By pressing 1,2, or 3 you can move the arm to positions shown in the above pictures (in order). Press the 8 trigger anytime you would like to reset the arm back to home position. Press Ctrl+C in the terminal to end the program at any time.
Modifying the Positions
In order to modify the position the arm moves to, open the “Terminator” and type:
cd '/home/dasl/catkin_ws/src/mk2_controller/nodes'
This will take you to the proper file location. Then type:
gedit move_mk2_pos.py
This will open the file shown in the picture below.
The code to modify the final position is the highlighted portion shown.
Now let's do a breakdown of the code.
if self.joy_data.buttons[1]:
This line states which button on the controller needs to be pressed in order to move the arm. Be warned the values are stored in coding style, which means that self.joy_data.buttons[1] refers to button 2 on the controller. The recommended number range for self.joy_data.buttons[ ] is 0 through 9, which translates to buttons 1 through 10 on the controller.
self.position[0] = 0.31 self.velocity[0] = 0.5
These two lines in order set the position which the corresponding arm component moves to and the velocity at which it moves to that position.
The zero in self.position[0] corresponds to the torso yaw joint of the arm. Changing the number in the brackets will change which part of the arm will move. The picture above shows the list of components. The numbers range from 0 to 13. 0 corresponds to the torso_yaw_joint while 13 corresponds to right_ring_yaw_joint which is the ring finger on the hand. WORD OF CAUTION WHEN SETTING POSITIONS AND VELOCITIES! DO NOT SET THEM TOO HIGH! USE NUMBERS BELOW 1.5 AND GREATER THAN -1.5! USE VELOCITIES BELOW 1!
Open the terminal and type:
roslaunch mk2_controller mk2_joy.launch
This launches the hand control program. It will allow you to control the hand.
MAKE SURE THERE IS PLENTY OF ROOM FOR THE ARM TO MOVE BEFORE CONTINUING
Movement Controls
By holding down 3 the thumb will turn towards the palm. By holding down 4 the thumb will turn away from the palm.
Hold down 2 in order to close the fingers. Hold down 1 in order to open the fingers.
Combined with the arm movement controls, the HDT arm can pickup and move objects such as the water bottle shown in the above picture.
This tutorial's objective was to show how to setup and run some basic programs for the HDT Arm. The details of the terminal setup, HDT Arm Movement, HDT Arm Object Tracker, HDT Arm Position Movement, and HDT Arm Hand Control were given in this tutorial. Once the concepts were conveyed the reader could setup the HDT Arm properly and use these four programs.
Speculating future work derived from this tutorial, includes teaching how to modify the code in the different files. In the big picture, the problem of using the HDT Arm can be solved with this tutorial.
For questions, clarifications, etc, Email: thomaa7@unlv.nevada.edu