Guide 8 - RAPID Programming Language
Guide 8 - RAPID Programming Language
1.1. Acquire skills with the programming language used by the Robotstudio
1.2. Handle variables, functions, loops and conditionals to create routines.
1.3. Create digital inputs and outputs within procedures.
2. Introduction
Offset FUNCTION
Point2:=Offs (Point1, XOffset, YOffset, ZOffset)
Offs Returns a value of the robotarget type and accepts 4 arguments.
A robotarget (a point) and three values in mm corresponding to the offset for
the different axes.
For example:
- CONST robtarget P2: Define a point P2
- P2: = Offs (P1,5,10,15): point P2 will have the values of P1 offset 5mm
on the X axis, 10mm on the Y axis and 15mm on the Z axis
- MoveL Offs(P2,0,0,10),v1000,z50,tool1: The robot will move linearly
to point P2 but 10mm higher (offset in the Z axis)
These instructions are used to manage the flow of the program. Sometimes it is
interesting that certain program fragments are repeated, are executed at certain
times or are continuously cyclical. For this reason, it is very common to use these
instructions that control the itinerary or route of the program pointer within the
program code.
Table 4. The Rapid language for program flow instructions of ABB robots
4. Method
Create a route using the Robot IRB120 with the following parameters:
● The robot must have a controller and it must have "MyTool" as a tool.
● The stage must have 2 solids, a rectangle measuring 400x300x250 mm and
a cylinder with a radius of 200mm and a height of 300mm.
● Place the solids and the robot on a table.
● Create a procedure in Rapid that executes the two paths, 2 times through a
loop:
o To do this, use a count variable.
o To implement this procedure, use the FOR loop.
We select the robot with which we are going to work. We click on ABB Library
🡪 IRB 120. In the pop-up window we select IRB 120 and accept.
Now we place tool in the arm: Main window 🡪 Layout toolbar 🡪 Drag MyTool to
IRB120_. In the pop-up window we select Yes and we observe that the tool is in
place.
In the pop-up window: define a system name 🡪 select folder 6.08.01.00 🡪 next
🡪 select IRB120_3_58 01 🡪 next 🡪 finish. We observe that in the lower part of
the main window the Controller Status: 1/1 is green (This may take a few
minutes)
Figure 4. Controller configuration
We import the table. We click on Import Library 🡪 Browser for Library… 🡪We
select the file Table.rslib.
If the figure is not in the desired position, we can make turns and translations
by using the tools mentioned above. Or right click on Part_1 🡪 Position 🡪 Set
Position.
We can save the position of the robot tool. For this go to the toolbar, select
home 🡪 Path programming 🡪 Teach target. Now, we observe that within
Wobj0_, a Target_ element is created which correspond to the position saved
of the tool. We rename it as Start1.
Figure 11. Creating a target from a robot postition using "Teach Target"
Now we are going to create points, the same ones we will use to generate the
trajectory. It is important, check that we are working on the WO_Box system.
Then, we go to the toolbar, select Home 🡪 Path programming 🡪 Target 🡪
Create Target on Edge 🡪 OK
A new window will appear on the main tree. Here we select a top vertex of the
cube 🡪 click on create 🡪Close
And we will see how 4 Target elements appear in the main tree in WO_Box.
Figure 15. Vertex selection to generate points
In this case, the orientation it has would prevent the execution of the activity.
We change the orientation right click on a target 🡪 Modify Target 🡪 Rotate.
We make the necessary turns so that the robot can access the tool.
Copy the orientation carried out and Apply Orientation to the rest of the
points.
Now we create the path for the cylinder surface. It is important, check that we
are working on the WO_Cylinder system.
Then, we go to the toolbar, select Home 🡪 Path programming 🡪 Path 🡪
AutoPath
The orientation it has would prevent the execution of the activity. We change
the orientation right click on a target 🡪 Modify Target 🡪 Rotate.
We make the necessary turns so that the robot can access the tool.
Now, we connect the work object space to the solid figure. Right click on WO_,
go to attach to and choose the solid.
Figure 20. Connect workspace to solid
We create the trajectory: Go to main tree. Right click on Paths & procedures,
create patch. To create a movement, we drag the Targets created from wobj0,
WO_Box and WO_Cylinder to Path_. It is important to mark a path that begins
and ends at the same point.
We changed the precision of the trajectory. Under Path & Procedures, select
each move instruction (Path_), Right click 🡪Edit instruction 🡪 Zone 🡪 fine 🡪
Apply 🡪 Close.
Figure 22. Edit instruction Zone
Once the trajectories are created, we right-click over path created. Click on
auto configuration 🡪 Linear/Circular move instructions.
To make the trajectories repeat 2 times we use a FOR loop and the Count
variable
When we have finished the changes in the RAPID script, we select Apply 🡪
Apply all. In the end, go to Access 🡪 Synchronize 🡪 Synchronize to station🡪
OK
Figure 27. Synchronize to Station
Create a route using the Robot IRB120 with the following parameters:
● The robot must have a controller and it must have "MyTool" as a tool.
● The stage must have a cylinder with a radius of 100mm and a height of
300mm.
● Create two digital signals, one input and one output so that when pressing
the play button of the simulator, the robot waits for us to activate the input
signal to make a trajectory on the surface of the cylinder, at the end of the
trajectory, the output signal will be set to one.
4.2.1. Create a workstation
We select the robot with which we are going to work. We click on ABB Library
🡪 IRB 120. In the pop-up window we select IRB 120 and accept.
Now we place tool in the arm: Main window 🡪 Layout toolbar 🡪 Drag MyTool to
IRB120_. In the pop-up window we select Yes and we observe that the tool is in
place.
In the pop-up window: define a system name 🡪 select folder 6.08.01.00 🡪 next
🡪 select IRB120_3_58 01 🡪 next
We are going to create a starting point in worbj0. First, let's check that we are
taking the robot's workobject and also that the "MyTool" tool is selected.
To see this, we go to toolbar 🡪 home 🡪 parameters.
We can save the position of the robot tool. For this go to the toolbar, select
home 🡪 Path programming 🡪 Teach target. Now, we observe that within
Wobj0_, a Target_ element is created which correspond to the position saved
of the tool. We rename it as Start1.
We define the name and position of the work object 🡪 Rename WO_Cylinder. Here
you should change Object Frame position. We enter the Position values
(mm). Click on accept. Remember that the positions are created in relation to
the global frame. Finally, we select create.
Now we create the path for the cylinder surface. It is important, check that we
are working on the WO_Cylinder system. Then, we go to the toolbar, select
Home 🡪 Path programming 🡪 Path 🡪 AutoPath
A new window will appear in the main tree. We select on the surface of the
cylinder 🡪 Approximation Parameters 🡪 Circular 🡪 We leave the other
default values 🡪 Create 🡪 Close. Finally, we will see how Target elements
appear in the main tree in WO_Cylinder.
The orientation it has would prevent the execution of the activity. We change
the orientation right click on a target 🡪 Modify Target 🡪 Rotate.
We make the necessary turns so that the robot can access the tool.
Figure 40. Tool orientation change
Copy the orientation carried out and Apply Orientation to the rest of the
points.
The trajectory was created automatically. We must check if the order is correct
and cut that the trajectory begins and ends at the same point.
Figure 42. Created path
We changed the precision of the trajectory. Under Path & Procedures, select
each move instruction (Path_), Right click 🡪Edit instruction 🡪 Zone 🡪 fine 🡪
Apply 🡪 Close.
Once the trajectories are created, we right-click over path created. Click on
auto configuration 🡪 Linear/Circular move instructions.
We create the input signal. Inside the Configuration- I/O System window, we
select Signal 🡪 New Signal…
In the pop-up window, we call the signal Input1 🡪 Type of Signal 🡪Digital
Input 🡪 Assigned to Device 🡪PN_Internal_Device🡪 Device Mapping 🡪128 🡪 Ok.
We select accept in the warning popup
Figure 46. Input signal configuration
We create the exit signal. Inside the Configuration- I/O System window, we
select Signal 🡪 New Signal…
In the pop-up window, we call the signal Exit1 🡪 Type of Signal 🡪Digital Input
🡪 Assigned to Device 🡪PN_Internal_Device🡪 Device Mapping 🡪129 🡪 Ok. We
select accept in the warning popup
Figure 48. Exit signal configuration
In order to work with the new signals created we have to restart the
controller. We select Controller 🡪 Controller Tools 🡪 Restart. We accept in
the pop-up window and wait for it to reload.
Now we open the system signal control: in the toolbar we select Simulation🡪
Monitor 🡪 I/0 Simulator
When we have finished the changes in the RAPID script, we select Apply
🡪Apply all. In the end, go to Access 🡪 Synchronize 🡪 Synchronize to station🡪
OK
Finally, we obtain the simulation of the final trajectory and the correct
operation of the signal control panel.
Create a route using the Robot IRB120 with the following parameters:
● The robot must have a controller and it must have "MyTool" as a tool.
● Create a 300x400x300 mm tetrahedron, which will support the following
solid
● Create a solid in the form of a dot matrix; 4 rows
(6m apart) x 5 columns (5cm apart).
● Create a path where the robot traverses each point
of the matrix using the Offs function (see table 2)
We select the robot with which we are going to work. We click on ABB Library
🡪 IRB 120. In the pop-up window we select IRB 120 and accept.
In the pop-up window: define a system name 🡪 select folder 6.08.01.00 🡪 next
🡪 select IRB120_3_58 01 🡪 next 🡪 finish. We observe that in the lower part of
the main window the Controller Status: 1/1 is green (This may take a few
minutes)
We set the local origin of the tool: Right click on the matrix 🡪 Modify 🡪 Set Local
Origin. We select the center of the solid.
We define an origin, for that we are going to create a starting point in worbj0.
First, let's check that we are taking the robot's workobject and also that the
"MyTool" tool is selected. To see this, we go to toolbar 🡪 home 🡪 parameters.
We can save the position of the robot tool. For this go to the toolbar, select
home 🡪 Path programming 🡪 Teach target. Now, we observe that within
Wobj0_, a Target_ element is created which correspond to the position saved
of the tool. We rename it as Start1.
We create a point, for this exercise, we can work in wobj0. Then, we go to the
toolbar, select Home 🡪 Path programming 🡪 Target 🡪 Create Target on Edge
🡪 OK
A new window will appear above the main tree. Here we will create a point in
the center of first hole.
Figure 63. Point selection
In this case, the orientation it has would prevent the execution of the activity.
We change the orientation right click on a target 🡪 Modify Target 🡪 Rotate.
Now, we create the trajectory: Go to main tree. Right click on Paths &
procedures, create patch. To create a movement, we drag the Targets created
from wobj0 to Path_.
We changed the precision of the trajectory. Under Path & Procedures, select
each move instruction (Path_), Right click 🡪Edit instruction 🡪 Zone 🡪 fine 🡪
Apply 🡪 Close.
Once the trajectories are created, we right-click over path created. Click on
auto configuration 🡪 Linear/Circular move instructions.
⮚ We create the necessary algorithm for the trajectory. In this case we use the
offset function and the FOR loop
When we have finished the changes in the RAPID script, we select Apply 🡪
Apply all. In the end, go to Access 🡪 Synchronize 🡪 Synchronize to station🡪
OK
Figure 69. Synchronize to station
5. Activities
[Take screenshots, upload used RAPID code and record final simulation]
Figure 74. Simulation of input1 performing path10 on the top face edges of the first cylinder
Figure 75. Simulation of input2 performing path20 on the top face edges of the second cylinder
Figure 76. Performing Input 3 following the trajectory of path 10 and path 20
Figure 77. Performing Input 3 when input2 and input3 are activated.
Figure 78. Code of the trayectory of the robot with input
Figure 79. The picture shows the whole simulation in prism rectangular.
Figure 80. Code for the robot movement through prism
5.3. OFFSET function [Use the station of the point 4.3. as template]
5.3.1. Consider that the approach to each point will be made by an offset of
4cm in the Z axis. That is, before reaching each point, the tool will be
located 4cm above that point and will go down linearly to the point, will
go up again linearly 4cm and will look for a new point in the same way.
According to these conditions implement the following procedures:
Figure 83. Trajectory of the robot movement through each point of row 2 and 4 of the matrix
Figure 84. Code for the robot movement through each point of row 2 and 4 of the matrix
5.3.1.2. Procedure 2: Move through each point of column 1, 3 and
5 of the matrix.
[Take screenshots, upload used RAPID code and record final simulation]
Figure 85. Trajectory of the robot movement through each point of column 1, 3 and 5 of the matrix.
Figure 86. Code for the robot movement through each point of column 1, 3 and 5 of the matrix.
Conclusions
Finally, this practice carried out in the RobotStudio software allowed us to acquire and
improve our abilities and skills with the programming language used by Robotstudio.
Specifically in activity 1 it allowed us to improve our programming skills with loops, such as the
for that allows us to perform the same activity n times depending on the activity that is being
carried out. In this way, it is shown that programming and robotics work together in real life
applications. Since in the industry where robotics comes into play, robots perform the same
activity n times depending on the task they are executing.
Moreover, we can configure I/O for a robot controller system in RobotStudio. The robot can be
equipped with a number of digital and analog user signals that can be read and changed from
within the program. The signal names are defined in the system parameters. These names are
always available in the program for reading or setting I/O operations. To activity 5.2, we used a
set of commands to activate or inactivate input or output signals. For example, set and reset
can be used to change the value of the output signal and WaitDi can be used to wait until a
digital input signal is activated or for testing inputs.
For activity 5.2.2, when generating the simulation errors, but the program ignored these errors
and could go through the surfaces normally. It is important to highlight that the inputs and
outputs helped to synchronize and make the simulation independent without the need for
manual control. thus improving the automation of the robot.
In activity 5.3, an OFFSET function was carried out where it was taken into account that the
approach to each point will be carried out through a 4 cm offset in the Z axis. That is, before
reaching each point, the tool will be located 4 cm above that point and it will go down linearly
to the point, it will rise again linearly 4cm and it will look for a new point in the same way. It
was possible to create a function with digital inputs and outputs using instructions like MoveL
for linear movement, v1000 for the maximum speed that can be carried and offs that returns a
value of the robotarget type and accepts 4 arguments: a robotarget and three values in mm
corresponding to the offset for the different axes.
References