Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How to automatically change targets for addMoveL

#1
so i have a program where UR robot creates a targets base on transl of one preplaced target...the program goes in a loop and adds as much targets as you need for a specific application...now i want to put those targets into a Move() inside a program but i need my python program to run through targets and know how many moveL() he needs to create, while for addTarget() i didnt have much problems for because i named targets after number of times the loop played out, meanwhile i cant seem to do the same thing for addMoveL()...here is a picture for better understanding of my problem.



from robodk import robolink    # RoboDK API
from robodk import robomath    # Robot toolbox
from robodk import *      # RoboDK API
from robolink import *    # Robot toolbox
RL = Robolink()

robot = RL.Item('UR10e' , robolink.ITEM_TYPE_ROBOT)
prog = RL.Item('PROGRAM' , robolink.ITEM_TYPE_PROGRAM)

for i in range(2):
    tt = f'{i+1}'
    T = RL.AddTarget(tt+'1')
    T = RL.AddTarget(tt+'2')
    T = RL.AddTarget(tt+'3')

for i in range(2): #HERE IS THE PROBLEM
    tt=(f'{i+1}1')
    prog.addMoveL(tt)
    prog.addMoveL(tt)
    prog.addMoveL(tt)
#2
I believe the sample code you shared is based on old examples. Where did you take these examples from? Make sure you update RoboDK to the latest version.

With the latest version of RoboDK and the API you can call MoveJ, MoveL and SearchL on a program directly:
Code:
prog.SearchL(target)
This will automatically add the right movement instruction to the corresponding program.
  




Users browsing this thread:
1 Guest(s)