Home Programming


Left ArrowBack to discussions page
james77james77 Posts: 10 Apprentice
I was disassembling functions in polyscope to understand URscripts.
Whild I was looking into the Direction, I found this:
    $ 1 "Robot Program"
    $ 2 "MoveL"
    $ 3 "Direction: Base Z+"
    global move_thread_flag_3=0
    thread move_thread_3():
      move_thread_flag_3 = 1
      local towardsPos=calculate_point_to_move_towards(p[0.0,0.0,0.0,0.0,0.0,0.0], [0.0,0.0,1.0], 1000.0)
      movel(towardsPos, a=1.2, v=0.25)
      move_thread_flag_3 = 2
    move_thread_flag_3 = 0
    move_thread_han_3 = run move_thread_3()
    while (True):
      if (get_standard_digital_in(0) == True):
        kill move_thread_han_3
        $ 4 "Until (io)"

I couldn't find the what the "calculate_point_to_move_towards(variables)" do, it's not on the manual that I found.
Also, why the enter_critical and exit_critical are matter?

Thank you for answers

Best Answers


  • james77james77 Posts: 10 Apprentice
    So the critical flags allow that thread to have the main execution meaning no other thread can prevent that thread from executing. If there is not enough physical time to execute all threads this one gets priority. 

    Looks like you are using some of the new functions in the e-series where you can move in a direction until something happens like touching a surface. So the function is calculating the waypoint to move to.  You will find other script functions that are not listed in the manual. These are generally functions that UR has not exposed to the URScript community but as you’ve found they are always discoverable but you would have to do the work to understand what the arguments mean. 

    Also, always make sure you are using the script manual that corresponds to the Polyscope version because as they introduce new stuff in Polyscope sometimes they update the manual to match and give an API reference. 
    Thank you for the answers.
    This may irrelevant to current thread, but what sync() does? 
    I looked up the manual, and it says
    "Uses up the remaining "physical" time a thread has in the current frame"
    and I'm not quite sure what is exact role of the sync() function.
  • james77james77 Posts: 10 Apprentice
    Basically it keeps your thread in sync with the robot cycles  

    Say I have a thread that uses 1 millisecond of physical time performing calculations. Sync would then “sleep” for 1 millisecond to have the thread consume the 2 milliseconds of clock time each cycle lasts (assuming e-series, CB3 is 8ms clock cycle)

    . Make sense?
    That makes a lot of sense! Thank you!!
Sign In or Register to comment.
Left ArrowBack to discussions page