You are on page 1of 6

Objective

The goal of this lab is to develop techniques to program the Karel S100 robots. These
techniques will involve parallel development of the program and the geometry of the
points.

Programming

The programming for this lab involves using the Karel language in the S100 robot system
which is vastly different than the RC language used in previous labs. The Karel language
uses word commands opposed to the numerically intense RC language.

To start the programming process, the KCL mode on the controller unit had to be
activated by pressing the soft key F1, then Soft key Develop, followed by Default to enter
a program name. Junior was entered as the program name to be developed. After the
name was entered soft key, Edit, was pressed to enter the editor. Juniors Skeleton was
then developed with the major sections required for a program to function. These include
a DEFINE line, Variable section, VAR, BEGIN line and lastly and line. Creating this
skeleton allows the program development to progress in two parallel steps, code writing
and point defining. The skeleton was then uploaded to the PC attached through the RS
232 port on the front of the control unit. This was achieved by pressing the KCL soft key
to exit the Edit mode. Then enter Copy/Overwrite BM:Junior.kl FD:. This takes the file
from the bubble memory of the control unit to the hard disk of local PC. This will only
work if the PC is ready to receive the program, by opening the DOS KFLOPPY program.

Three system variables were used in programming the S100 robot. The $TERMTYPE
variable provides four different options in how a target is approached. The FINE option
is the most precise option that ensures that the robot will be at the exact target location.
The robot does this by going through a settle cycle where the robot has to be at the exact
location with a tight tolerance for a given amount of time. The COARSE option provides
the settling option that the FINE variable does, the difference is the tolerance which is
larger for the COARSE option. The NoSettle option is similar to the G11 code in the RC
language in providing a splining function to create a smoother transition between
points. This function brings the robot to a point and does not go through the settling
cycle, thus making it faster, but less accurate than the FINE or COARSE variables. The
NoDecel option brings the robot to the destination point, but where the robot would
normally slowdown it says that this is close enough and moves on to the next point
without decelerating. This makes for a very large tolerance at the destination point.

The second system variable is $MOTYPE which determines how the robot will move.
The JOINT option is the optimal way to move a robot. This option uses the least amount
of energy. The LINEAR option moves the end effecter in straight line motions. The
CIRCULAR option moves the end effecter in an arc motion along a three point arc. This
motion requires three points to calculate: beginning point, via point and end point.
The third system variable is $SPEED which is measured by the speed of the tool tip in
mm/sec. The $SPEED variable can be manipulated by the Teach Pendant or within the
program code. The maximum speed of a robot is dependent on the specifications of the
particular robot used, for the s100 robot this is 1500 mm/s. After these three system
variables were specified for the program, the body of the code begins.

The body of the code begins by using the open hand command to ensure that the gripper
will not strike the part. For the robot to move to the conveyor to procure the part, it
travels through safe point 1 and safe point 2 using the MOVE TO command. Then using
the MOVE NEAR command, the robot will approach the part from a high safe point
directly above the part offset by a real value measured along the positive ZTOOL direction
above to the part. From this high safe point, the robot approaches a low safe point that is
even closer to the part. To move the tool tip to the location of the part to grab it, a WITH
command will be used to alter all the system variables for only this move. To be safe, a
$SPEED of 150 mm/sec, a $TERMTYPE of fine, and a linear $MOTYPE is used. This
speed will allow time to react to any malfunctions that the robot may have. Using the
FINE termtype the location will be exact, and moving linearly will ensure that the robot
will not touch or damage a part when moving over the part to grab it. To pick the part,
the CLOSE HAND 1 command is used, and the gripper secures the part in the tool. Then
the part needs to be moved to the pallet, so to move it above the conveyor a MOVE
AWAY command that moves the tool center in a negative ZTOOL direction relative to the
current position. This process puts the robot into a low safe position and another MOVE
AWAY command is needed to get it to a high safe position. This move requires a
mathematical calculation of (HI_SAF-LO_SAF), because this move requires a real
distance which is relative to the current position. This will bring the robot with the part
to the high safe position. The robot then will travel to the table, to palletize the part by
going to SAFE 3. For the robot to place the part on the table, the robot travels through
the high and low safe position using the MOVE NEAR command as above. To palletize
the part the WITH command redefines the system variables to be used, again setting 150,
FINE and LINEAR. When at the drop point, the robot opens the hand to release the part
with the OPEN HAND 1 command. Then the robot returns to the high safe point using
the previously described MOVE AWAY procedure. At the high safe point, the robot
delays 1.5 seconds (DELAY 150) to wait for a process to complete cycling. The part is
then acquired from the table by moving near the low safe point. The system variables are
then redefined before the picking of the part to SAFE 3. Once the part is reacquired, the
robot moves through low safe and the difference of (HI_SAF-LO_SAF) before reaching
SAFE 3. When returning to the conveyor, the robot goes through SAFE 2. The MOVE
NEAR command is used to align the robot with the drop off point through high and low
safe points. The WITH command is then used to redefine the system variables in
preparation to place the part on the conveyor. The hand is then opened using the OPEN
HAND 1 function and the robot executes the MOVE AWAY procedure. The robot then
moves to SAFE 1 through SAFE 2.

During programming after the initial code was written and uploaded there were six lines
that were copied and pasted into the code. These lines had all the geometries of the
variables that were defined in the beginning of the code, such as SAFE 1, SAFE 2, SAFE
3, PICK, and PLACE. The method used to define these points is described in the
following section. The following shows the actual code developed.
PROGRAM JUNIOR
--
VAR
SAF1, SAF2, SAF3, PICK, PLACE:POSITION
RATE1:INTEGER
LO_SAF, HI_SAF:REAL
--
BEGIN
-- RATE1=1400MM/SEC RATE2=150MM/SEC
$SPEED=RATE1
$TERMTYPE=FINE
$MOTYPE=JOINT
OPEN HAND 1
-- MOVE TO CONVEYOR TO GET PART
MOVE TO SAF1
MOVE TO SAF2
MOVE NEAR PICK BY HI_SAF
MOVE NEAR PICK BY LO_SAF
WITH $SPEED = 150, $TERMTYPE = FINE, $MOTYPE = LINEAR MOVE TO PICK
CLOSE HAND 1
MOVE AWAY LO_SAF
MOVE AWAY (HI_SAF-LO_SAF)
--WITH PART MOVE TABLE AND PLACE AND DELAY FOR 1.5 SEC
MOVE TO SAF3
MOVE NEAR PLACE BY HI_SAF
MOVE NEAR PLACE BY LO_SAF
WITH $SPEED = 150, $TERMTYPE = FINE, $MOTYPE = LINEAR MOVE TO
PLACE
OPEN HAND 1
MOVE AWAY LO_SAF
MOVE AWAY (HI_SAF-LO_SAF)
DELAY 1500
--ACQUIRE THE PART FROM TABLE
MOVE NEAR PLACE BY LO_SAF
WITH $SPEED = 150, $TERMTYPE = FINE, $MOTYPE = LINEAR MOVE TO
PLACE
CLOSE HAND 1
MOVE AWAY LO_SAF
MOVE AWAY (HI_SAF-LO_SAF)
MOVE TO SAF3
--MOVE PART BACK TO THE CONVEYOR AND PLACE AND RETURN TO SAF1
MOVE TO SAF2
MOVE NEAR PICK BY HI_SAF
MOVE NEAR PICK BY LO_SAF
WITH $SPEED = 150, $TERMTYPE = FINE, $MOTYPE = LINEAR MOVE TO PICK
OPEN HAND 1
MOVE AWAY LO_SAF
MOVE AWAY (HI_SAF-LO_SAF)
MOVE TO SAF2
MOVE TO SAF1
--
END JUNIOR
Point Definition

Figure 1: Side view of workstation Figure 2: Top view of workstation

For the program to Pick and Place the cylinder parts, 5 positions had to be defined in the
variable section. These points as declared in the VAR section of the skeleton were called
SAFE 1, SAFE 2, SAFE 3, PICK and PLACE. SAFE 1 was used as the home position,
SAFE 2 was near the pick point of the parts, SAFE 3 was near the place point, PICK was
the point on the conveyor belt where the part was to be picked up, and PLACE is the
point on the table where the part is dropped off. Figure 1 and 2 show these points that
were programmed.

Defining the points was achieved using the teach pendant. The teach pendant is active
when the program to be edited is open in the KCL mode. Then one of the two dead mans
switches has to be depressed before turning the ENABLE toggle switch. When the teach
pendant is active enter the TEACH mode by depressing the PREVIOUS key twice and
then the soft key TEACH. Now the position variables that were defined in the skeleton
can be defined. Scroll to the desired point to be programmed and now choose a method in
which to move the robot. In the top right corner of the teach pendants LCD display has
the mode of movement that is currently active. There are 5 types of motion possible to
achieve the desired pose of the robot. JOINT, WORLD, and TOOL were the type used in
this lab.

JOINT allows the control of each individual joint of the robot. The joint motions are
controlled on the teach pendant by the keys in the lower right containing 1 through 5
corresponding to the joint to be moved. When in the JOINT mode, keys 1 through 5
control each respective joint. This mode is best used when orienting the arm. When in the
WORLD mode, the motions are relative to the base frame of the robot. Due to this there
are only three options for motion, X,Y,Z of the base frame. This mode proves to be
helpful when getting into close proximity of the PICK and PLACE points. Trying to
maneuver the robot joint by joint difficult because of the relativity of each joints motion;
moving in a larger Cartesian space is easiest to predict motions from a human
perspective. The wrist joints are active in this mode, but their motions are unpredictable
because this particular robot doesnt have a yaw capability. TOOL mode moves the robot
relative to the tool frame. The best way to use this mode is to have the hand oriented and
positioned above the desired point and use only the motion along the Z axis of the tool.
Use of the X and Y axis in this mode can be confusing because the tool frame may not
have the exact desired orientation.

Programming the SAFE points was a process that doesnt require precise locations and
orientations. Once the point is highlighted in the teach mode the joints were moved
accordingly to get roughly the desired pose. SAFE 1 was considered the home position
where the robot would be located when the program started and stopped. The pose of this
point was achieved through use of the JOINT mode entirely. The wrist was pitched to
have an orientation such that the Z axis of the hand is pointed upward in world
coordinates. Then when the arm was moved to SAFE 2 e wrist wouldnt have to pitch as
much to achieve the desired pose. SAFE 2 was roughly oriented to be between the robot
base and the conveyor while in JOINT mode.

Next, the PICK point was programmed using a combination of the JOINT, WORLD, and
TOOL modes. The JOINT mode was used to orient the arm and therefore the hand to be
square to the conveyor. Once the hand was square to the conveyor, the WORLD mode
was used to maintain the orientation of the hand and locate the hand above the part. Once
again the rotated using the JOINT mode to allow for space for a part in the next location
on the conveyor. Finally, the TOOL mode was used to move along the Z axis of the hand;
bringing the hand to the proper pose to close the hand and grip the part.

With the part in hand, PLACE was programmed in a similar manner as the PICK point.
Because the orientation of the wrist was to be maintained, the WORLD mode was used to
bring the part straight up off the conveyor. Then switching to the JOINT mode the robot
was rotated about the base frame Z axis, joint 1, to bring the part above the table. Once
the robot was located roughly above the table, JOINT mode was used to make the part
square to the PLACE position marked on the table. To bring the part to the table, TOOL
mode was used to approach the table along the Z axis of the hand. It was decided to leave
a small gap between the table and the part to avoid collision with the table. This was a
good thought initially, but then it was realized that the program was to place the part and
then go up and wait for a set time and then go down and pick the part up again to return it
to the conveyor. With the part essentially being dropped the distance of the small gap and
reusing the PLACE point to retrieve the part a small amount of error could accumulate
and cause a collision when returning the part to the conveyor. So the PLACE point was
reprogrammed to be a little bit closer to the table to minimize the interference with the
conveyor.

It is important to note the saving sequence for each of the points that were programmed.
After the desired geometry was achieved the point was recorded by pressing the DONE
soft key. This though doesnt save the geometry permanently. To save the point
permanently the soft key SAVE had to be pressed. It isnt necessary to press the save after
each point, but to be safe they were saved after each point geometry is recorded.
Analysis

Once the final program was compiled, the effect of using various $TERMTYPE
commands on the cycle time was evaluated at two different speeds, 800mm/s and
1400mm/s (Table 1). The first test was performed using the $TERMTYPE=FINE, which
controls the arm movement by closely approaching the target. This produced an average
cycle time of 30.05 seconds when the speed was at a rate of 800mm/s, and 25.82 seconds
at a rate of 1400mm/s.

The second test performed was using the COARSE control, which decreased the program
cycle time for both speeds effectively increasing the efficiency of the program by 4.2%
for the low speed and 5.3% for the high rate. COARSE control is similar in nature to the
FINE control since the target is also closely approached, but within a window of
tolerance. This was followed by evaluating the effect of using the NoSettle control
command, which produces a path similar in effect to the G11 command used in RC robot
programming. However, it is very different in concept. Instead of Splining the
transition from point to point, NoSettle will set a spatial volume where once the arm
reaches the specified space the program immediately jumps to the next line. This once
again decreased the program cycle time effectively increasing the program efficiency by
15% and 19.2% compared to the Fine cycle times.

The last program alteration incorporated the NoDecel motion command, which is
comparable to the G12 code used in RC programming. Each target has a deceleration
envelope where once it hits that, the program by default would decelerate, but when using
the NoDecel command instead of slowing down it skips this action and goes to the next
point. Utilizing the NoDecel command optimized the program by cutting off
approximately ten seconds from the initial Fine command runs. This increased the
program efficiency by 32% for the low speed and up to 40% for the high speed runs.
Saving time and being efficient is the goal, since in the end time is money.

Table 1: Cycle time vs. $TERMTYPE


$Speed = 800mm/s
Code Fine (s) Coarse (s) NoSettle (s) NoDecel (s)
Run 1 29.97 28.78 25.72 20.44
Run 2 30.12 28.78 25.38 20.59
Ave 30.05 28.78 25.55 20.52
Efficiency 4.2% 15.0% 31.7%
$Speed = 1400mm/s
Code Fine (s) Coarse (s) NoSettle (s) NoDecel (s)
Run 1 25.78 24.53 20.87 15.53
Run 2 25.85 24.37 20.87 15.50
Ave 25.82 24.45 20.87 15.52
Efficiency 5.3% 19.2% 39.9%

You might also like