Home› Programming
Discussion
Back to discussions page
Jstewart
Posts: 54 Apprentice
Questions about URScript |
18 views
|
Answered | |
/ Most recent by Jstewart
in Programming
|
6 comments |

in Programming
Hello,
Attached is a URscript that was generated from the sim software. Im new to script programming and im trying to understand more on how to use this to get more out of my UR.
the questions i have are:
Off topic but has anyone used an automatic tool changer with a UR and can give me some in-site on how they did it as far as the programming goes?
Thanks in advanced
Attached is a URscript that was generated from the sim software. Im new to script programming and im trying to understand more on how to use this to get more out of my UR.
the questions i have are:
- The program created a variable called "step_count_7679db51_583c_48aa_afeb_a37e29d0d27f" and it is being used in the thread "Step_Counter_Thread_1f0542e5_48a9_4cd4_8e00_e9bb9f64c151". is this created to tell the thread to run only once?
- If i wanted to run this code on my UR, would i just call the "Step_Counter_Thread_1f0542e5_48a9_4cd4_8e00_e9bb9f64c151()"?
Off topic but has anyone used an automatic tool changer with a UR and can give me some in-site on how they did it as far as the programming goes?
Thanks in advanced
From what I understand the thread inside the script is counting the number of time the thread have been executed.
The robot execute program command with a pace of 0.008s for eSerie and 0.1s for CB. As there is nothing else than a step counter in the thread is behave like a time counter.
If you use eSerie, Step_Counter_Thread_1f0542e5_48a9_4cd4_8e00_e9bb9f64c151*0.008 will give you program execution time.
The variable is not used outside of the thread. It looks like it is not used.
Side remark: it is good practice to add a sync() command at the end of a each thread to avoid having interference with program execution pace.
If you want to run the complete code you can save your script file on the robot via FTP for example or with USB stick. Create a program, import the script and call it with the script command:
I don't see so much things in this program. It is probably better to redo it on the teach pendent of the robot without using script.
Thread definition
at some time later or on some condition being met
Looking at the generated script file is a really good way to learn URScript as it will show you how UR is converting the GUI Polyscope commands into the actual script that is being executed by the robot
@matthewd92 so if I created a script file it would be placed say in the before program sequence? And then whenever I need that code I would do a script line command with the “run scriptcodefilename()” or would it just be “scriptcodefilename()”
The first part of the script are some variables and functions used by the system to run the program. It is automatically added to the script by URCAP or polyscope. You don't need to dive into it.
The second portion is the main program.