Creating new script in URScript language

Hi,

I have a script that updates moves in real time and has the robot go to that waypoint. Is there a way to create a script (in my script) that populates with these updated moves, so that way I can go back to these moves again without rerunning my initial program? As of right now since it is updating in real time, these positions are not being saved so I have to rerun the initial program to send it to these points.

Thanks!

Audrey

I suppose you could use one of the interfaces or interpreter mode to update some global variables. How many separate poses do you need to update?

https://www.universal-robots.com/articles/ur/programming/interpreter-mode/

https://www.universal-robots.com/articles/ur/programming/secondary-program/

1 Like

The amount of poses I will need to update is arbitrary depending on the program that I am modifying the poses of.

Oh I see, you want to head back to those poses without having to run the program. Debugging I assume?

You might get some success on e-series by selecting the line you want to start on and click “run from here” or whatever it says.

Basically I have a script that has poses but modifies these poses line by line. I want to save each of these poses line by line, because if I rerun my script, it will re-modify the original poses and I won’t be able to go back to the first set of modified poses. I don’t think I can select to “run from here” in a script…

You could build an Array / Matrix to store your positions in.
Store_Pos[#] = real_time_pos

so Store Pos would look something like
Stopr_Pos = (p[#,#,#,#,#,#],p[#,#,#,#,#,#],p[#,#,#,#,#,#],p[#,#,#,#,#,#],p[#,#,#,#,#,#],p[#,#,#,#,#,#])

then when you want to reuse one of the stored positions
e.g. movej(Store_Pos[#], a= #,v=v#,t=0,r=#)

I did something similar to calculate X & Y positions and put them in an Array
then called them as i needed them.

hope this helps

2 Likes

With this option, do you not have to initialize the Store_Pos array as the empty set?

I tried this method, but it is not working for me. I would have to be able to create an array of a certain size from the beginning, and there is not a way to do this without knowing the elements…

audrey.vasquez,
Yes you would need to create the Array first with some arbitrary values. I generally make each element p[0,0,0,0,0,0].

if you don’t know how many positions you need to save, you would need to create an oversized array with more elements than you could ever possibly need.

that’s the beauty of storing in an array you only cherry pick the bits you need.

1 Like

Great thanks, I can see how this will work. Only hard part is that sometimes my scripts have over 2,000 waypoints, and I’m not sure I could easily create an array with this many poses.

2000 way points! Wow that’s a lot.
What kind of program is it? I can only think this is a a welding or gluing program with that many points.

Do you really need to save every position?

I don’t think there’s a size limit on an Array so it’s still doable.

I do agree that having an append and pop functions for an array would make it an easier task.

But who ever said programming would be easy :laughing:

Other ways would require extra hardware (i.e. a PC with TCP IP connection)

You can get live positional data through RTDE and set a trigger so as to record the data in some external form on that pc and when requested send it back.

Or socket send the positional data with a number to reference it to an external PC to organise it in a way where it can be returned easily.

Matt