0% found this document useful (0 votes)
11 views8 pages

Practice 5 - RoboDk - Python - Functions

This document presents a programming practice for a pick and place using Python in the RoboDK software. The practice aims to familiarize the user with the Python language in RoboDK, learn how to program actions of a Kawasaki RS03N robot, and perform a pick and place using Python functions. The document explains how to set up the robot, the RoboDK interface, and details the functions of the Python code to simulate the pick and place, including the acquisition of user parameters, configuration of objects, and movements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Practice 5 - RoboDk - Python - Functions

This document presents a programming practice for a pick and place using Python in the RoboDK software. The practice aims to familiarize the user with the Python language in RoboDK, learn how to program actions of a Kawasaki RS03N robot, and perform a pick and place using Python functions. The document explains how to set up the robot, the RoboDK interface, and details the functions of the Python code to simulate the pick and place, including the acquisition of user parameters, configuration of objects, and movements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Faculty of Electrical Engineering and Industrial Robotics Laboratory

Computing

PRACTICE #5

TOPIC: PICK AND PLACE PROGRAMMING IN ROBODK WITH


PYTHON PROGRAMMING LANGUAGE

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.

•Perform a pick and place using Python functions.


Interpret functions provided by the Robodk software.

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.

3.1 Select a Robot

New robots can be added from a local disk or from the online library.

3. Open. The robot should automatically appear at the station in a few


seconds.

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. Select Download. The robot should appear automatically at the station.


in a few seconds.
4. The online library can be closed once the robot is loaded.

Alternatively, it is also possible to download the robot files (.robot extension)


from the websitehttps://robodk.com/library and abdragging them in RoboDK and
dropping the file in the main window or by selecting File➔ Open.

3.2 Interface

• Themain menuiffind at the top. All actions and


available options are available in this menu.
The toolbar contains graphic icons that allow for quick access.
to the actions frequently used in the menu. More information available
in the section ofthe toolbar.
The station tree lists all the components (elements) that are
present in the station. These elements can be robots, tools,
objects, objectives or specific configurations for manufacturing purposes or
calibration. The tree allows us to understand and modify the dependency that exists
in the real environment. For example, a target can be attached to a frame of
specific reference, this framework can be attached to the base framework
of the robot, the robot's tools are generally attached to the robot, etc.
The status bar is located at the bottom and can display tips.
useful for certain operations.
The 3D view (Main screen) shows the view in a 3D virtual environment and
reproduce el Árbol de estaciones con su jerarquía.
By double-clicking an element (in the tree or in the 3D view), a will be displayed
new window with the properties of the element. For example, by double-clicking
it will be shown in a robottheBreadlof theftThese windows can be closed.
selecting the cross in the upper right corner of the secondary window.
Faculty of Electrical Engineering and Robotics Laboratory
Industrial
Computing

Figure 1: Robodk 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.

Observation: The mbox command allows the appearance of a window in the


main screen of RoboDK where the user will be able to enter the information that
as requested.
Faculty of Electrical Engineering and Industrial Robotics Laboratory
Computing

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.

Figure 3: Data acquisition from the SetSimulationParams section

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

Figure 4: Function box_calc

Figure 5 details the function 'parts_setup' responsible for the configuration


of the objects.
This section has as input parameters the reference system of
where the boxes are located, the positions of the boxes and their
dimensions.
As can be seen, based on the parameter positions (which is the array of
the sizes are calculated in the previous function so that,
define how many boxes the production batch has.
A for loop is executed to modify the parameters of each box in
function of the number that was previously calculated.
The last line of code is to set the color of the boxes based on
of the RGB code (Red-Green-Blue). The parameter A represents visibility.
from the boxes.

Figure 5: Function - parts_setup

• 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)

Figure 6: Assignment of elements associated with the procedure.


Faculty of Electrical Engineering and Industrial Robotics Laboratory
Computing

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 7: TCP_On and TCP_Off functions

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.

Figure 8: Main Code - RobotA_GetParts


Faculty of Electrical Engineering and Robotics Laboratory
Industrial
Computing

• 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

Figure 9: Function - WaitSensor

You might also like