Priorize move in script

Hi,

I want to simplify our programs and create a script file with a movement to a safe position in BeforeStart which I can use for every program we use. I tried this:

set_standard_digital_out[0, False]


global Grundstellung_p=p[pose]
global Grundstellung_q=[pose]
movej(get_inverse_kin(Grundtstellung_p, qnear=Grundstellung_q), a, v)

and this:

def Grundstellung():
global Grundstellung_p=p[pose]
global Grundstellung_q=[pose]
movej(get_inverse_kin(Grundstellung_p, qnear=Grundstellung_q), a, v)
end

But with both it will not proceed at first after run the program. It will first move to first program step and after that to “Grundstellung”. If I define that position via GUI it will proceed first.
Is there any possibility to priorize it with script?

Thank you in advance

Hi @daigoro,

Welcome to the UR community!

From you description it sound like the tip you are missing is the following:
When first waypoint in program is either Variable or Relative, robot will start moving when “Play” is pressed, and no “Automove” is needed.

There is more guidance in this article:
https://www.universal-robots.com/articles/ur/programming/creating-a-safe-home-routine/

Best regards
Ebbe

Thank you for your answer, but unfortunately it seems not, what I’m looking for. We’re using UR5e for depalletizing bottles from a tray to a conveyor. Because of different kind of bottles and pieces per tray we have several programs, which are nearly equal. I set a waypoint around 10cm over the tray in BeforeStart as a safe position before program run. Now I wanted to put this in a script file, so that I don’t need to set this for each new program.

noscript
script

With script it always moves to the Startitem or Corneritem 1 before starting the program, and then to my waypoint in BeforeStart. I also tried the creating a safe home routine you suggested, but with the same result. My question is, is there a possibility to get the same result like using the Polyscope GUI?

Thanks for reading and best regards
Daigoro

Hi,

If you mean your first position is written in the script file and want to move robot to this point manually like the position defined by the GUI of polyscope, I think it is not possible. This is why your robot always take you to the first point taught by the GUI but not the pose you define inside the script file.

Okay, thank you for your reply. So I can stop trying it :sweat_smile:

Hi @daigoro,

As Polyscope is evaluating the first waypoint before program execution starts, then if you are targeting to have an Automove to a location you will define during program execution. Then you are challenged.
I see your options as:

  • Continue as today
  • Have one common safe position, and let you script calculated and move the robot to each
  • Make your script to put the robot into freedrive and instruct the operator to guide the robot around the dynamic safe position (I guess a sanity check is a good idea) let your script complete the movement to the exact position after the operator guidance

I hope you will achieve you goal!

Ebbe

Thanks a lot for the answers and suggestions. I will let my brain keep working on it; for now the way I did before (teach movement via Polyscope) seems the most practical for us. For later program steps it works fine with script files, so I wanted to try the same with the BeforeStart section.

Thanks again and there will surely coming more questions :sweat_smile: