Practice 5 - RoboDk - Python - Functions
Practice 5 - RoboDk - Python - Functions
Computing
PRACTICE #5
1. Objectives
Familiarization with the Python language in RoboDk.
Learn to program in Python to perform different actions at the station
working with the robot.
Theoretical framework
RoboDK is a software for offline simulation and programming.
offline programming means that robot programs can be created,
simulate and generate offline for a robot arm and a robot controller
specific. RoboDK contains a main menu, a toolbar, a
status bar and the main screen. The station tree on the main screen
contains all the available elements at the station, such as robots, frames of
reference, tools, programs, etc. The robot that will be used in the practice will be
Kawasaki RS03N, to carry out various tests with the RoboDK software
Offline programming has no limits with RoboDK. This software
provides an easy-to-use graphical user interface for simulating and programming
industrial robots. RoboDK will help you avoid singularities and axis limits. No
experience in programming is required. More information available at lthe section
of Progbranching outside of lineea of the documentation
(https://robodk.com/doc/en/Getting-Started.html)
With the RoboDK API, you can also program and simulate robots using Python..
Python isa programming language that allows you to work faster and integrate
their systems more effectively. Python allows expressing concepts in fewer
lines of code compared to other languages, making it easy and straightforward to
to learn.
More information available at lRob's sectionoDK API ofthe documentation. The
RoboDK API as wellis availablenoble forC # and Matlab.
Faculty of Electrical Engineering and Robotics Laboratory
Industrial
Computing
3. Description.
In this practice, a Pick and Place movement will be performed through programming.
Python in RoboDK. Additionally, some functions that the program will interpret.
provides with the aim of learning to interpret an external code.
New robots can be added from a local disk or from the online library.
1. Select File➔ Open online library (Ctrl + Shift + O). It will appear
a new nested window that displays the online library. It is also possible
select the corresponding button on the bar
of tools.
2. Use the filters to find your robot by brand, payload, etc. In this example,
we will use a Kawasaki RS03N robot.
Faculty of Electrical Engineering and Industrial Robotics Laboratory
Computing
3.2 Interface
4. Procedure
Proceeding with the example Pick and place with Laser Sensor of RoboDK.
The example includes four sections of code. A brief overview will follow.
explanation of the most important functions of each one.
• SetSimulationParams
This section is responsible for requesting information from the user for the
functioning of the program.
As shown in Figure 2, the user is prompted through the command box.
what I enter:
The size of the boxes indicating: length, width, and height.
2. The size of the pallet. This will be an array of 3 values detailing
the following information in the order shown: number of columns in the batch,
number of rows of the batch and number of floors of the batch.
3. Conveyor belt speed in mm/s.
Figure 2: Code–SetSimulationParams
• PrepareSimulation
This section of code is responsible for acquiring the information from the previous section to
process it and start with the process.
Figure 3 shows the part of the code responsible for acquiring the information from
previous code.
In Figure 4, the function 'box_calc' is located, which has the following input parameters
the dimensions of the box and the pallet size.
This function is responsible for creating an array of positions of the boxes from the
entered information.
Finally, the value returned is a list that details the position of each box.
on the pallet.
Faculty of Electrical Engineering and Robotics Laboratory
Industrial
Computing
• RobotA_GetParts
This section will be responsible for taking the boxes from the PalletA and placing them in the
conveyor belt.
The elements involved in this procedure are assigned (Robot, tool
and the reference systems)
For both the Robot A and Robot B code part, it starts with the
acquisition of the data obtained by the SetSimulationParams function and a
initialization of the functions described above
Figure 7 shows the functions responsible for opening and closing the clamp to hold.
the objects. This will be carried out based on the tool that is entered as
input parameter.
Figure 8 shows the main code for this part of the procedure. It starts
calculating the number of boxes in the production batch that will be the condition of the loop
while determining the number of iterations of the procedure.
Then, there is the segment responsible for acquiring the piece on the pallet and finally
leave it on the conveyor belt.
• RobotB_GetParts
This section will be responsible for taking the boxes from the conveyor belt and
place them on PalletB
The code used in this section is very similar to that of RobotA with the
difference that has the WaitSensor function described in the Figure
9; which will be responsible for detecting the presence of an object on the belt
carrier to later pick it up and leave it at PalletB