Home Programming


Left ArrowBack to discussions page
toto290toto290 Posts: 2 Recruit

I am working on a project with an UR5e right now and I have diffculties with the URScript basics. The Documentation seems to lack any hints regarding the very basic commands and classes.

For example, te URScript documentation gives you a function to measure the length of a list but does not contain explanations regarding the list-class.
How do I add elements to a list dynamically? (.add / .apend / ...), how does the Pose class look like? etc etc etc

Am I missing something here? Is URScript based on another script language and I have to use that documentation?
I'm looking forward to your replies since I am really stuck right now.



  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,020 Handy

    The thing you have to know about UR is they have static typing including list length. The first time you define a list you will need to define the length you want it to be with the initial assignment. Then to access elements within the list you will use bracket notation to either retrieve or set a list element

    local myList = [0,0,0,0]
    myList[2] = 3 #myList now equals [0,0,3,0]
    local listLength =length(myList) #4
    A pose is a special type of list and is used for storing a 6D pose of the robot position in x,y,z and rx,ry,rz 

    it looks like p[0,0,0,0,0,0]. They can only contain 6 elements, position in meters and rotations in radians. You can access the elements in a pose the same way you would in a list. 
  • toto290toto290 Posts: 2 Recruit
    Thank you very much for your answer Matthew!

    But where are those things documented?
    Is there any pdf or website with the basics, or is URScript based on another laguage with an own documentation?
    Or does everybody has to find out tose things on their own?
    Without your help I would have never known the answers to my examplary questions above.
  • AdisharrAdisharr Posts: 4 Apprentice
    UR does a poor job documenting the scripting system. They really need to release a document showing examples of various things. I've found the Zacobria site to be useful but the examples on there are from a very old OS version. The first thing I do when go over the Polyscope system is to sway new users far away from trying to do any programming in script other than simple one line script functions.
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,020 Handy
    The easiest way I’ve found to learn the scripting language is to write a polyscope program. When you do this it is converted into a script file of the same name. Open that file and you can see how the Polyscope commands were converted to script. So when I don’t fully understand how to do something in script that I can do in polyscope I’ll make a small program and open the script file and look at it. This is how I learned the basics of scripting with UR. We actually now write all of our programs in script because it’s so much more powerful for what we are doing. We store those files in a version tracking system and so it makes reuse very easy as well as we have full source and version control of all our programs. 

    I agree that there are not any good tutorials out there for getting started with script. 
Sign In or Register to comment.
Left ArrowBack to discussions page