KUKA_KRC4_DAT.py
Go to the documentation of this file.
1 # Copyright 2017 - RoboDK Software S.L. - http://www.robodk.com/
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 # http://www.apache.org/licenses/LICENSE-2.0
6 # Unless required by applicable law or agreed to in writing, software
7 # distributed under the License is distributed on an "AS IS" BASIS,
8 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 # See the License for the specific language governing permissions and
10 # limitations under the License.
11 
12 # ----------------------------------------------------
13 # This file is a POST PROCESSOR for Robot Offline Programming to generate programs
14 # for a Kuka robot with RoboDK
15 #
16 # To edit/test this POST PROCESSOR script file:
17 # Select "Program"->"Add/Edit Post Processor", then select your post or create a new one.
18 # You can edit this file using any text editor or Python editor. Using a Python editor allows to quickly evaluate a sample program at the end of this file.
19 # Python should be automatically installed with RoboDK
20 #
21 # You can also edit the POST PROCESSOR manually:
22 # 1- Open the *.py file with Python IDLE (right click -> Edit with IDLE)
23 # 2- Make the necessary changes
24 # 3- Run the file to open Python Shell: Run -> Run module (F5 by default)
25 # 4- The "test_post()" function is called automatically
26 # Alternatively, you can edit this file using a text editor and run it with Python
27 #
28 # To use a POST PROCESSOR file you must place the *.py file in "C:/RoboDK/Posts/"
29 # To select one POST PROCESSOR for your robot in RoboDK you must follow these steps:
30 # 1- Open the robot panel (double click a robot)
31 # 2- Select "Parameters"
32 # 3- Select "Unlock advanced options"
33 # 4- Select your post as the file name in the "Robot brand" box
34 #
35 # To delete an existing POST PROCESSOR script, simply delete this file (.py file)
36 #
37 # ----------------------------------------------------
38 # More information about RoboDK Post Processors and Offline Programming here:
39 # http://www.robodk.com/help#PostProcessor
40 # http://www.robodk.com/doc/en/PythonAPI/postprocessor.html
41 # ----------------------------------------------------
42 
43 
44 # ----------------------------------------------------
45 # Import RoboDK tools
46 from robodk import *
47 
48 
49 HEADER = ''';FOLD INI
50 BAS (#INITMOV,0 )
51 ;ENDFOLD (INI)
52 
53 ;FOLD STARTPOS
54 $BWDSTART = FALSE
55 PDAT_ACT = {VEL 50,ACC 100,APO_DIST 10}
56 BAS(#PTP_DAT)
57 FDAT_ACT = {TOOL_NO 0,BASE_NO 0,IPO_FRAME #BASE}
58 BAS (#FRAMES)
59 BAS (#VEL_PTP,50)
60 ;ENDFOLD
61 
62 
63 ;FOLD SET DEFAULT SPEED
64 $VEL.CP=0.2
65 BAS(#VEL_PTP,50)
66 BAS(#TOOL,0)
67 BAS(#BASE,0)
68 ;ENDFOLD
69 
70 ;FOLD PTP FIRST POSITION
71 $BWDSTART = FALSE
72 PDAT_ACT = {VEL 50,ACC 100,APO_DIST 10}
73 FDAT_ACT = {TOOL_NO 0,BASE_NO 0,IPO_FRAME #BASE}
74 BAS(#FRAMES)
75 $ADVANCE = 5
76 ;ENDFOLD
77 
78 PTP $AXIS_ACT ; skip BCO quickly
79 '''
80 
81 # ----------------------------------------------------
82 def pose_2_str(pose):
83  """Converts a pose target to a string"""
84  #[x,y,z,w,p,r] = Pose_2_KUKA(pose)
85  #return ('X %.3f, Y %.3f, Z %.3f, A %.3f, B %.3f, C %.3f' % (x,y,z,r,p,w)) # old version had to be switched
86  [x,y,z,r,p,w] = pose_2_xyzrpw(pose)
87  return ('X %.3f,Y %.3f,Z %.3f,A %.3f,B %.3f,C %.3f' % (x,y,z,w,p,r))
88 
89 def pose_2_str_ext(pose,joints):
90  njoints = len(joints)
91  if njoints <= 6:
92  return pose_2_str(pose)
93  else:
94  extaxes = ''
95  for i in range(njoints-6):
96  extaxes = extaxes + (',E%i %.5f' % (i+1, joints[i+6]))
97  return pose_2_str(pose) + extaxes
98 
99 def angles_2_str(angles):
100  """Prints a joint target"""
101  str = 'AXIS: '
102  data = ['A1','A2','A3','A4','A5','A6','E1','E2','E3','E4','E5','E6']
103  for i in range(len(angles)):
104  str = str + ('%s %.5f,' % (data[i], angles[i]))
105  str = str[:-1]
106  return str
107 
108 def conf_2_str(confRLF):
109  if confRLF is None:
110  return "'B010'"
111  strconf = ""
112  if confRLF[2] > 0:
113  strconf = strconf + '1'
114  else:
115  strconf = strconf + '0'
116 
117  if confRLF[1] == 0:
118  strconf = strconf + '1'
119  else:
120  strconf = strconf + '0'
121 
122  if confRLF[0] > 0:
123  strconf = strconf + '1'
124  else:
125  strconf = strconf + '0'
126 
127  return "'B%s'" % strconf
128 
129 def joints_2_turn_str(joints):
130  if joints is None:
131  return "'B000000'"
132 
133  strturn = ""
134  for i in range(len(joints)):
135  if joints[i] < 0:
136  strturn = '1' + strturn
137  else:
138  strturn = '0' + strturn
139  return "'B%s'" % strturn
140 
141 
142 # ----------------------------------------------------
143 # Object class that handles the robot instructions/syntax
144 class RobotPost(object):
145  """Robot post object"""
146  PROG_EXT = 'src' # set the program extension
147 
148  # other variables
149  ROBOT_POST = ''
150  ROBOT_NAME = ''
151  PROG_FILES = []
152  PROG_NAME = 'unknown'
153  PROG_COUNT = 0
154 
155  BASE_ID = 1
156  TOOL_ID = 1
157  speed_ms = 1
158  speed_degs = 180
159  accel_mss = 1
160  accel_degss = 200
161  VEL_PTP = 100 # speed in percentage
162 
163  PROG = ''
164  PROG_DAT = ''
165  nPosDat = 0
166  LOG = ''
167  nAxes = 6
168  APO_VALUE = -1 # set to one for smooth path
169  C_DIS = ' C_DIS'
170  C_PTP = ' C_PTP'
171 
172  def __init__(self, robotpost=None, robotname=None, robot_axes = 6, **kwargs):
173  self.ROBOT_POST = robotpost
174  self.ROBOT_NAME = robotname
175  self.PROG = ''
176  self.LOG = ''
177  self.nAxes = robot_axes
178 
179  def ProgStart(self, progname):
180  self.PROG_COUNT = self.PROG_COUNT + 1
181  self.addline('DEF %s ( )' % progname)
182  if self.PROG_COUNT == 1:
183  self.PROG = self.PROG + HEADER
184  self.PROG_NAME = progname
185  #if self.nAxes > 6:
186  #self.addline('$ACT_EX_AX = %i' % (self.nAxes-6))
187 
188  def ProgFinish(self, progname):
189  self.addline('END')
190 
191  def ProgSave(self, folder, progname, ask_user = False, show_result = False):
192  progname = progname + '.' + self.PROG_EXT
193  if ask_user or not DirExists(folder):
194  filesave = getSaveFile(folder, progname, 'Save program as...')
195  if filesave is not None:
196  filesave = filesave.name
197  else:
198  return
199  else:
200  filesave = folder + '/' + progname
201  fid = open(filesave, "w")
202  fid.write("&ACCESS RVP\n")
203  fid.write("&REL 1\n")
204  fid.write("&COMMENT Generated by RoboDK\n")
205  fid.write("&PARAM TEMPLATE = C:\\KRC\\Roboter\\Template\\vorgabe\n")
206  fid.write("&PARAM EDITMASK = *\n")
207  fid.write(self.PROG)
208  fid.close()
209  print('SAVED: %s\n' % filesave) # tell RoboDK the path of the saved file
210  filesave_dat = filesave[:-3] + 'dat'
211  fid2 = open(filesave_dat, "w")
212  fid2.write("&ACCESS RVP\n")
213  fid2.write("&REL 1\n")
214  fid2.write("&COMMENT Generated by RoboDK\n")
215  fid2.write("&PARAM TEMPLATE = C:\\KRC\\Roboter\\Template\\vorgabe\n")
216  fid2.write("&PARAM EDITMASK = *\n")
217  fid2.write('DEFDAT %s\n\n' % self.PROG_NAME)
218  fid2.write(self.PROG_DAT)
219  fid2.write('\nENDDAT\n\n')
220  fid2.close()
221  print('SAVED: %s\n' % filesave_dat) # tell RoboDK the path of the saved file
222  self.PROG_FILES = [filesave, filesave_dat]
223  # open file with default application
224  if show_result:
225  if type(show_result) is str:
226  # Open file with provided application
227  import subprocess
228  p = subprocess.Popen([show_result, filesave_dat, filesave])
229  elif type(show_result) is list:
230  import subprocess
231  p = subprocess.Popen(show_result + [filesave])
232  else:
233  # open file with default application
234  import os
235  os.startfile(filesave)
236  os.startfile(filesave_dat)
237  if len(self.LOG) > 0:
238  mbox('Program generation LOG:\n\n' + self.LOG)
239 
240  def ProgSendRobot(self, robot_ip, remote_path, ftp_user, ftp_pass):
241  """Send a program to the robot using the provided parameters. This method is executed right after ProgSave if we selected the option "Send Program to Robot".
242  The connection parameters must be provided in the robot connection menu of RoboDK"""
243  UploadFTP(self.PROG_FILES, robot_ip, remote_path, ftp_user, ftp_pass)
244 
245  def MoveJ(self, pose, joints, conf_RLF=None):
246  """Add a joint movement"""
247  self.nPosDat = self.nPosDat + 1
248  vname = '%i' % self.nPosDat
249 
250  # Write SRC information ---------------------------
251  #;FOLD PTP P1 Vel=70 % PDAT1 Tool[1]:graco_negra Base[0];%{PE}%R 8.3.42,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P1, 3:, 5:70, 7:PDAT1
252  #;FOLD PTP P1 Vel=70 % PDAT1 Tool[1]:graco_negra Base[0];%{PE}%R 8.3.32,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:P1, 3:, 5:70, 7:PDAT1
253  #$BWDSTART=FALSE
254  #PDAT_ACT=PPDAT1
255  #FDAT_ACT=FP1
256  #BAS(#PTP_PARAMS,70)
257  #PTP XP1
258  str_cont = ''
259  str_cdis = ''
260  if self.APO_VALUE >= 0:
261  str_cdis = 'C_PTP'
262  str_cont = 'CONT '
263  self.addline(';FOLD PTP P%s %sVel=%.0f %% PDAT%s Tool[%i] Base[%i];%%{PE}%%R 8.3.42,%%MKUKATPBASIS,%%CMOVE,%%VPTP,%%P 1:PTP, 2:P%s, 3:%s, 5:%.0f, 7:PDAT%s' % (vname, str_cont, self.VEL_PTP, vname, self.TOOL_ID, self.BASE_ID, vname, str_cdis, self.VEL_PTP, vname))
264  self.addline('$BWDSTART=FALSE')
265  self.addline('PDAT_ACT=PPDAT%s' % vname)
266  self.addline('FDAT_ACT=FP%s' % vname)
267  self.addline('BAS(#PTP_PARAMS,%.0f)' % self.VEL_PTP)
268  self.addline('PTP XP%s%s' % (vname,self.C_PTP))
269  self.addline(';ENDFOLD')
270 
271  # Write DAT information ---------------------------
272  #DECL E6POS XP1={X 27.0236969,Y 1220.23962,Z 669.846619,A -90.0563354,B 53.4202652,C -178.565933,S 2,T 35,E1 0.0,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}
273  #DECL FDAT FP1={TOOL_NO 1,BASE_NO 0,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}
274  #DECL PDAT PPDAT1={VEL 100.000,ACC 100.000,APO_DIST 100.000,GEAR_JERK 50.0000,EXAX_IGN 0}
275  self.addDAT('DECL E6AXIS XP%s={%s}' % (vname, angles_2_str(joints)))
276  self.addDAT('DECL FDAT FP%s={TOOL_NO %i,BASE_NO %i,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}' % (vname, self.TOOL_ID, self.BASE_ID))
277  self.addDAT('DECL PDAT PPDAT%s={VEL %.3f,ACC 100.000,APO_DIST %.3f,GEAR_JERK 50.0000,EXAX_IGN 0}' % (vname, self.VEL_PTP, max(self.APO_VALUE,1)))
278 
279  def MoveL(self, pose, joints, conf_RLF=None):
280  """Add a linear movement"""
281  self.nPosDat = self.nPosDat + 1
282  vname = '%i' % self.nPosDat
283 
284  # Write SRC information ---------------------------
285  #;FOLD LIN P56 Vel=2 m/s CPDAT37 Tool[1]:graco_negra Base[1]:vol1;%{PE}%R 8.3.42,%MKUKATPBASIS,%CMOVE,%VLIN,%P 1:LIN, 2:P56, 3:, 5:2, 7:CPDAT37
286  #$BWDSTART=FALSE
287  #LDAT_ACT=LCPDAT37
288  #FDAT_ACT=FP56
289  #BAS(#CP_PARAMS,2)
290  #LIN XP56
291  str_cont = ''
292  str_cdis = ''
293  if self.APO_VALUE >= 0:
294  str_cdis = 'C_DIS'
295  str_cont = 'CONT '
296 
297  self.addline(';FOLD LIN P%s %sVel=%.0f m/s CPDAT%s Tool[%i] Base[%i];%%{PE}%%R 8.3.42,%%MKUKATPBASIS,%%CMOVE,%%VLIN,%%P 1:LIN, 2:P%s, 3:%s, 5:%.0f, 7:CPDAT%s' % (vname, str_cont, self.speed_ms, vname, self.TOOL_ID, self.BASE_ID, vname, str_cdis, self.speed_ms, vname))
298  self.addline('$BWDSTART=FALSE')
299  self.addline('LDAT_ACT=LCPDAT%s' % vname)
300  self.addline('FDAT_ACT=FP%s' % vname)
301  self.addline('BAS(#CP_PARAMS,%.0f)' % self.speed_ms)
302  self.addline('LIN XP%s%s' % (vname,self.C_DIS))
303  self.addline(';ENDFOLD')
304 
305  # Write DAT information ---------------------------
306  #DECL E6POS XP56={X -293.060028,Y 165.117493,Z 18.0715256,A -64.8358612,B 39.9032936,C -161.694565,S 2,T 3,E1 0.0,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}
307  #DECL FDAT FP56={TOOL_NO 1,BASE_NO 1,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}
308  #DECL LDAT LCPDAT37={VEL 2.00000,ACC 100.000,APO_DIST 100.000,APO_FAC 50.0000,AXIS_VEL 100.000,AXIS_ACC 100.000,ORI_TYP #VAR,CIRC_TYP #BASE,JERK_FAC 50.0000,GEAR_JERK 50.0000,EXAX_IGN 0}
309  self.addDAT('DECL E6POS XP%s={%s}' % (vname, pose_2_str_ext(pose,joints)))
310  #self.addDAT('DECL E6POS XP%s={%s, S %s, T %s}' % (vname,pose_2_str_ext(pose,joints),conf_2_str(conf_RLF),joints_2_turn_str(joints)))
311  self.addDAT('DECL FDAT FP%s={TOOL_NO %i,BASE_NO %i,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}' % (vname, self.TOOL_ID, self.BASE_ID))
312  self.addDAT('DECL LDAT LCPDAT%s={VEL %.5f,ACC 100.000,APO_DIST %.3f,APO_FAC 50.0000,AXIS_VEL 100.000,AXIS_ACC 100.000,ORI_TYP #VAR,CIRC_TYP #BASE,JERK_FAC 50.0000,GEAR_JERK 50.0000,EXAX_IGN 0}' % (vname, self.speed_ms, max(self.APO_VALUE,1)))
313 
314  def MoveC(self, pose1, joints1, pose2, joints2, conf_RLF_1=None, conf_RLF_2=None):
315  """Add a circular movement"""
316  self.addline('CIRC {' + pose_2_str_ext(pose1,joints1) + '},{' + pose_2_str_ext(pose2,joints2) + '}' + self.C_DIS)
317 
318  def setFrame(self, pose, frame_id=None, frame_name=None):
319  """Change the robot reference frame"""
320  if frame_name is not None and frame_name.endswith("Base"): # robot base frame
321  frame_id = 0
322  self.BASE_ID = frame_id
323  self.addline('BASE_DATA[%i] = {FRAME: %s}' % (self.BASE_ID, pose_2_str(pose)))
324  elif frame_id is not None and frame_id >= 0: # specified ID reference frame
325  self.BASE_ID = frame_id
326  self.addline('BASE_DATA[%i] = {FRAME: %s}' % (self.BASE_ID, pose_2_str(pose)))
327  else: # unspecified ID reference frame
328  self.BASE_ID = 1
329  self.addline('BASE_DATA[%i] = {FRAME: %s}' % (self.BASE_ID, pose_2_str(pose)))
330 
331  def setTool(self, pose, tool_id=None, tool_name=None):
332  """Change the robot TCP"""
333  if tool_id is not None and tool_id >= 0:
334  self.TOOL_ID = tool_id
335  self.addline('TOOL_DATA[%i] = {FRAME: %s}' % (self.TOOL_ID, pose_2_str(pose)))
336  else:
337  self.TOOL_ID = 1
338  self.addline('TOOL_DATA[%i] = {FRAME: %s}' % (self.TOOL_ID, pose_2_str(pose)))
339  #self.addline('$TOOL = {FRAME: ' + pose_2_str(pose) + '}')
340 
341  def Pause(self, time_ms):
342  """Pause the robot program"""
343  if time_ms <= 0:
344  self.addline('HALT')
345  else:
346  self.addline('WAIT SEC %.3f' % (time_ms*0.001))
347 
348  def setSpeed(self, speed_mms):
349  """Changes the robot speed (in mm/s)"""
350  self.speed_ms = speed_mms/1000.0
351  self.addline('$VEL.CP = %.5f' % (self.speed_ms))
352 
353  def setAcceleration(self, accel_mmss):
354  """Changes the current robot acceleration"""
355  self.accel_mss = accel_mmss/1000.0
356  self.addline('$ACC.CP = %.5f' % (self.accel_mss))
357 
358  def setSpeedJoints(self, speed_degs):
359  """Changes the robot joint speed (in deg/s)"""
360  self.speed_degs = speed_degs
361  self.addline('$VEL.ORI1 = %.5f' % speed_degs)
362  self.addline('$VEL.ORI2 = %.5f' % speed_degs)
363 
364  def setAccelerationJoints(self, accel_degss):
365  """Changes the robot joint acceleration (in deg/s2)"""
366  self.accel_degss = accel_degss
367  self.addline('$ACC.ORI1 = %.5f' % accel_degss)
368  self.addline('$ACC.ORI2 = %.5f' % accel_degss)
369 
370  def setZoneData(self, zone_mm):
371  """Changes the zone data approach (makes the movement more smooth)"""
372  self.APO_VALUE = zone_mm
373  if zone_mm >= 0:
374  self.addline('$APO.CPTP = %.3f' % zone_mm)
375  self.addline('$APO.CDIS = %.3f' % zone_mm)
376  C_DIS = ' C_DIS'
377  C_PTP = ' C_PTP'
378  else:
379  C_DIS = ''
380  C_PTP = ''
381 
382  def setDO(self, io_var, io_value):
383  """Sets a variable (output) to a given value"""
384  if type(io_var) != str: # set default variable name if io_var is a number
385  io_var = '$OUT[%s]' % str(io_var)
386  if type(io_value) != str: # set default variable value if io_value is a number
387  if io_value > 0:
388  io_value = 'TRUE'
389  else:
390  io_value = 'FALSE'
391 
392  # at this point, io_var and io_value must be string values
393  self.addline('%s=%s' % (io_var, io_value))
394 
395  def waitDI(self, io_var, io_value, timeout_ms=-1):
396  """Waits for an input io_var to attain a given value io_value. Optionally, a timeout can be provided."""
397  if type(io_var) != str: # set default variable name if io_var is a number
398  io_var = '$IN[%s]' % str(io_var)
399  if type(io_value) != str: # set default variable value if io_value is a number
400  if io_value > 0:
401  io_value = 'TRUE'
402  else:
403  io_value = 'FALSE'
404 
405  # at this point, io_var and io_value must be string values
406  if timeout_ms < 0:
407  self.addline('WAIT FOR (%s==%s)' % (io_var, io_value))
408  else:
409  self.addline('START_TIMER:')
410  self.addline('$TIMER_STOP[1]=TRUE')
411  self.addline('$TIMER_FLAG[1]=FALSE')
412  self.addline('$TIMER[1]=%.3f' % (float(timeout_ms)*0.001))
413  self.addline('$TIMER_STOP[1]=FALSE')
414  self.addline('WAIT FOR (%s==%s OR $TIMER_FLAG[1])' % (io_var, io_value))
415  self.addline('$TIMER_STOP[1]=TRUE')
416  self.addline('IF $TIMER_FLAG[1]== TRUE THEN')
417  self.addline(' HALT ; Timed out!')
418  self.addline(' GOTO START_TIMER')
419  self.addline('ENDIF')
420 
421  def RunCode(self, code, is_function_call = False):
422  """Adds code or a function call"""
423  if is_function_call:
424  code.replace(' ','_')
425  if not code.endswith(')'):
426  code = code + '()'
427  self.addline(code)
428  else:
429  self.addline(code)
430 
431  def RunMessage(self, message, iscomment = False):
432  """Add a joint movement"""
433  if iscomment:
434  self.addline('; ' + message)
435  else:
436  self.addline('Wait for StrClear($LOOP_MSG[])')
437  self.addline('$LOOP_CONT = TRUE')
438  self.addline('$LOOP_MSG[] = "%s"' % message)
439 
440 # ------------------ private ----------------------
441  def addline(self, newline):
442  """Add a program line"""
443  self.PROG = self.PROG + newline + '\n'
444 
445  def addDAT(self, newline):
446  self.PROG_DAT = self.PROG_DAT + newline + '\n'
447 
448  def addlog(self, newline):
449  """Add a log message"""
450  self.LOG = self.LOG + newline + '\n'
451 
452 # -------------------------------------------------
453 # ------------ For testing purposes ---------------
454 def Pose(xyzrpw):
455  [x,y,z,r,p,w] = xyzrpw
456  a = r*math.pi/180
457  b = p*math.pi/180
458  c = w*math.pi/180
459  ca = math.cos(a)
460  sa = math.sin(a)
461  cb = math.cos(b)
462  sb = math.sin(b)
463  cc = math.cos(c)
464  sc = math.sin(c)
465  return Mat([[cb*ca, ca*sc*sb - cc*sa, sc*sa + cc*ca*sb, x],[cb*sa, cc*ca + sc*sb*sa, cc*sb*sa - ca*sc, y],[-sb, cb*sc, cc*cb, z],[0,0,0,1]])
466 
467 def test_post():
468  """Test the post with a basic program"""
469 
470  robot = RobotPost('Kuka_custom', 'Generic Kuka')
471 
472  robot.ProgStart("Program")
473  robot.RunMessage("Program generated by RoboDK", True)
474  robot.setFrame(Pose([807.766544, -963.699898, 41.478944, 0, 0, 0]))
475  robot.setTool(Pose([62.5, -108.253175, 100, -60, 90, 0]))
476  robot.MoveJ(Pose([200, 200, 500, 180, 0, 180]), [-46.18419, -6.77518, -20.54925, 71.38674, 49.58727, -302.54752] )
477  robot.MoveL(Pose([200, 250, 348.734575, 180, 0, -150]), [-41.62707, -8.89064, -30.01809, 60.62329, 49.66749, -258.98418] )
478  robot.MoveL(Pose([200, 200, 262.132034, 180, 0, -150]), [-43.73892, -3.91728, -35.77935, 58.57566, 54.11615, -253.81122] )
479  robot.RunMessage("Setting air valve 1 on")
480  robot.RunCode("TCP_On", True)
481  robot.Pause(1000)
482  robot.MoveL(Pose([200, 250, 348.734575, 180, 0, -150]), [-41.62707, -8.89064, -30.01809, 60.62329, 49.66749, -258.98418] )
483  robot.MoveL(Pose([250, 300, 278.023897, 180, 0, -150]), [-37.52588, -6.32628, -34.59693, 53.52525, 49.24426, -251.44677] )
484  robot.MoveL(Pose([250, 250, 191.421356, 180, 0, -150]), [-39.75778, -1.04537, -40.37883, 52.09118, 54.15317, -246.94403] )
485  robot.RunMessage("Setting air valve off")
486  robot.RunCode("TCP_Off", True)
487  robot.Pause(1000)
488  robot.MoveL(Pose([250, 300, 278.023897, 180, 0, -150]), [-37.52588, -6.32628, -34.59693, 53.52525, 49.24426, -251.44677] )
489  robot.MoveL(Pose([250, 200, 278.023897, 180, 0, -150]), [-41.85389, -1.95619, -34.89154, 57.43912, 52.34162, -253.73403] )
490  robot.MoveL(Pose([250, 150, 191.421356, 180, 0, -150]), [-43.82111, 3.29703, -40.29493, 56.02402, 56.61169, -249.23532] )
491  robot.ProgFinish("Program")
492  # robot.ProgSave(".","Program",True)
493  print(robot.PROG)
494  if len(robot.LOG) > 0:
495  mbox('Program generation LOG:\n\n' + robot.LOG)
496 
497  input("Press Enter to close...")
498 
499 if __name__ == "__main__":
500  """Function to call when the module is executed by itself: test"""
501  test_post()
def RunMessage(self, message, iscomment=False)
def MoveL(self, pose, joints, conf_RLF=None)
def MoveJ(self, pose, joints, conf_RLF=None)
def UploadFTP(program, robot_ip, remote_path, ftp_user, ftp_pass)
Definition: robodk.py:1312
def __init__(self, robotpost=None, robotname=None, robot_axes=6, kwargs)
def ProgSendRobot(self, robot_ip, remote_path, ftp_user, ftp_pass)
def MoveC(self, pose1, joints1, pose2, joints2, conf_RLF_1=None, conf_RLF_2=None)
def mbox(msg, b1='OK', b2='Cancel', frame=True, t=False, entry=None)
Definition: robodk.py:1458
def RunCode(self, code, is_function_call=False)
def setTool(self, pose, tool_id=None, tool_name=None)
def ProgSave(self, folder, progname, ask_user=False, show_result=False)
def waitDI(self, io_var, io_value, timeout_ms=-1)
def getSaveFile(strdir='C:\\', strfile='file.txt', strtitle='Save file as ...')
Definition: robodk.py:1354
def setFrame(self, pose, frame_id=None, frame_name=None)


ros_robodk_post_processors
Author(s): Victor Lamoine - Institut Maupertuis
autogenerated on Sun Jun 7 2020 03:50:22