Comau_C5G.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 Comau C5G robots
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 MACRO_MESSAGE_TP = '''-- Display message on the teach pendant:
45  WIN_DEL ('menu:')
46  -- popup window over window USR1
47  WIN_POPUP('POP1:', 'USR1:')
48  -- open a lun on window POP1
49  OPEN FILE lun ('POP1:', 'rw')
50  WRITE lun ('%s', NL)
51  CLOSE FILE lun
52  -- let user read the message
53  DELAY 5000
54  -- Remove and delete window POP1 from user screen
55  WIN_REMOVE('POP1:')
56  WIN_DEL('POP1:')
57  ------------------'''
58 
59 # ----------------------------------------------------
60 # Import RoboDK tools
61 from robodk import *
62 
63 # gearbox ratio for external axes
64 RATIO_EXTAX = [1,1,1,1,1,1] #[10.6/360.0, 1, 1, 1, 1, 1]
65 
66 
67 
68 # ----------------------------------------------------
69 # Object class that handles the robot instructions/syntax
70 class RobotPost(object):
71  """Robot post processor class"""
72  PROG_EXT = 'pdl' # set the program extension
73  MAX_LINES_X_PROG = 5000 # maximum number of lines per program. It will then generate multiple "pages (files)"
74  INCLUDE_SUB_PROGRAMS = True
75  #INCLUDE_SUB_PROGRAMS = False
76 
77  # other variables
78  ROBOT_POST = ''
79  ROBOT_NAME = ''
80 
81  # Multiple program files variables
82  PROG_NAME = 'unknown' # single program name
83  PROG_NAMES = []
84  PROG_FILES = []
85  PROG_LIST = []
86  PROG_VARS = []
87  SPEED_MMS = 1000
88  ACCEL_MMSS = 100
89  FLY_DIST = -1 # set to >0 to use MOVEFLY
90  IMPORTS = []
91  PROG = ''
92  ROUTINES = ''
93  nLines = 0
94  nProgs = 0
95  LOG = ''
96  nAxes = 6
97  TAB = ''
98  LAST_POSE = None
99  LAST_E_LENGTH = 0
100  NEW_E_LENGTH = 0
101 
102  # ---------------------------------------------------
103 
104  def joints_2_str(self, joints):
105  """Contverts a joint target to a string"""
106  if joints is not None and len(joints) > 6:
107  joints[6] = joints[6]*RATIO_EXTAX[0]
108  return '{%s}' % (','.join(format(ji, ".5f") for ji in joints))
109 
110  def pose_2_str(self, pose,joints=None,conf_RLF=None):
111  """Converts a pose target to a string"""
112  [x,y,z,w,p,r] = Pose_2_Comau(pose)
113  config = []
114  # WARNING: Config only available for SMART type of contollers
115  if conf_RLF is not None:
116  if conf_RLF[0] > 0:
117  config.append('S')
118 
119  if conf_RLF[1] > 0:
120  config.append('E')
121 
122  if joints is not None:
123  #self.addline('cnfg_str := POS_GET_CNFG(%s)' % self.joints_2_str(joints))
124  #config = 'cnfg_str'
125  if len(joints) >= 5 and joints[4] < 0:
126  config.append('W')
127 
128  if len(joints) >= 4:
129  t1 = round((joints[3]+180) // 360)
130  config.append('T1:%i' % t1)
131 
132  if len(joints) >= 6:
133  t2 = round((joints[5]+180) // 360)
134  config.append('T2:%i' % t2)
135  t3 = round((joints[2]+180) // 360)
136  config.append('T3:%i' % t3)
137 
138  pos_str = "POS(%.4f, %.4f, %.4f, %.4f, %.4f, %.4f, '%s')" % (x,y,z,w,p,r, ' '.join(config))
139  if joints is None or len(joints) <= 6:
140  return pos_str
141  #return ('XTNDPOS(POS(%.4f,%.4f,%.4f,%.4f,%.4f,%.4f), , , (%.4f))' % (x,y,z,w,p,r,j7))
142  else:
143  self.addline('pxtn.POS := ' + pos_str)
144  for i in range(6,len(joints)):
145  self.addline('pxtn.AUX[%i] := %.5f' % (i-6+1, joints[i]*RATIO_EXTAX[i-6]))
146 
147  return 'pxtn'
148 
149  def __init__(self, robotpost=None, robotname=None, robot_axes = 6, **kwargs):
150  self.ROBOT_POST = robotpost
151  self.ROBOT_NAME = robotname
152  self.PROG = ''
153  self.LOG = ''
154  self.nAxes = robot_axes
155  for k,v in kwargs.items():
156  if k == 'lines_x_prog':
158 
159  def ProgStart(self, progname, new_page = False):
160  progname_i = progname
161  if new_page:
162  if self.INCLUDE_SUB_PROGRAMS:
163  raise Exception("Multiple pages per program is not supported when adding routines in the main program")
164  nPages = len(self.PROG_LIST)
165  if nPages == 0:
166  progname_i = progname
167  else:
168  progname_i = "%s%i" % (self.PROG_NAME, nPages)
169 
170  else:
171  self.PROG_NAME = progname
172  self.nProgs = self.nProgs + 1
173  self.PROG_NAMES = []
174  if self.nProgs > 1:
175  if not self.INCLUDE_SUB_PROGRAMS:
176  return
177  else:
178  if progname_i in self.IMPORTS:
179  self.IMPORTS.remove(progname_i)
180  self.addline('ROUTINE R_%s' % progname_i)
181  self.addline('VAR')
182  self.addline('BEGIN')
183  self.TAB = ' '
184  return
185 
186  self.PROG_NAMES.append(progname_i)
187  self.addline('PROGRAM %s' % progname_i)
188  self.addline('-- IMPORTS --')
189  #self.addline('CONST')
190  self.addline('VAR')
191  self.addline('ROUTINE R_%s EXPORTED FROM %s GLOBAL' % (progname_i, progname_i))
192  self.addline('')
193  self.addline('-- ROUTINES --')
194 
195  #self.addline('BEGIN R_%s' % progname_i)
196  self.addline('ROUTINE R_%s' % progname_i)
197  self.addline('VAR')
198  #self.addline(' cnfg_str: STRING') # PROG_VARS
199  if self.nAxes > 6:
200  self.addline(' pxtn: XTNDPOS')
201 
202  self.addline('-- VARIABLES --') # PROG_VARS
203  self.addline('BEGIN')
204  self.TAB = ' '
205  self.addline('$ORNT_TYPE := RS_WORLD')
206  self.addline('$MOVE_TYPE := JOINT')
207  self.addline('$JNT_MTURN := TRUE')
208  self.addline('$CNFG_CARE := TRUE')
209  self.addline('$TURN_CARE := TRUE')
210  self.addline('$SING_CARE := FALSE')
211  self.addline('$TERM_TYPE := NOSETTLE')
212 
213  # Use MOVEFLY (rounding)
214  self.addline('$FLY_TYPE := FLY_CART')
215  self.addline('$FLY_TRAJ := FLY_PASS')
216  self.setZoneData(self.FLY_DIST)
217  #self.addline('$FLY_DIST := 1')
218  self.addline('$STRESS_PER:= 65')
219 
220  def ProgFinish(self, progname, new_page = False):
221  variables = ''
222  for line in self.PROG_VARS:
223  variables = ' %s\n' % line
224 
225  self.PROG = self.PROG.replace('-- VARIABLES --\n', variables,1)
226  self.PROG_VARS = []
227 
228  if self.nProgs > 1 and not self.INCLUDE_SUB_PROGRAMS:
229  return
230  self.TAB = ''
231  if self.nProgs <= 1:
232  self.PROG = self.PROG + "END R_%s\n\n" % progname
233  # Create a the main program which call the main routine
234  self.PROG = self.PROG + "BEGIN\n R_%s\nEND %s\n\n" % (progname, progname)
235  else:
236  self.ROUTINES = self.ROUTINES + "END R_%s\n\n" % progname
237 
238  if new_page:
239  self.PROG_LIST.append(self.PROG)
240  self.PROG = ''
241  self.nLines = 0
242 
243  def progsave(self, folder, progname, ask_user = False, show_result = False):
244  progname = progname + '.' + self.PROG_EXT
245  if ask_user or not DirExists(folder):
246  filesave = getSaveFile(folder, progname, 'Save program as...')
247  if filesave is not None:
248  filesave = filesave.name
249  else:
250  return
251  else:
252  filesave = folder + '/' + progname
253  self.FILE_SAVED = filesave
254  # save imports
255  imports = ''
256  for i in range(len(self.IMPORTS)):
257  imports = imports + "IMPORT '%s'\n" % self.IMPORTS[i]
258  self.PROG = self.PROG.replace("-- IMPORTS --\n", imports, 1)
259  # save routines
260  self.PROG = self.PROG.replace("-- ROUTINES --\n", self.ROUTINES, 1)
261 
262  fid = open(filesave, "w")
263  fid.write(self.PROG)
264  fid.close()
265  print('SAVED: %s\n' % filesave) # tell RoboDK the path of the saved file
266  self.PROG_FILES.append(filesave)
267 
268  # open file with default application
269  if show_result:
270  if type(show_result) is str:
271  # Open file with provided application
272  import subprocess
273  p = subprocess.Popen([show_result, filesave])
274  elif type(show_result) is list:
275  import subprocess
276  p = subprocess.Popen(show_result + [filesave])
277  else:
278  # open file with default application
279  import os
280  os.startfile(filesave)
281  if len(self.LOG) > 0:
282  mbox('Program generation LOG:\n\n' + self.LOG)
283 
284  def ProgSave(self, folder, progname, ask_user = False, show_result = False):
285  if len(self.PROG_LIST) >= 1:
286  if self.nLines > 0:
287  self.PROG_LIST.append(self.PROG)
288  self.PROG = ''
289  self.nLines = 0
290 
291  npages = len(self.PROG_LIST)
292  progname_main = progname + "Main"
293  mainprog = "PROGRAM %s\n" % progname_main
294  for i in range(npages):
295  mainprog += "IMPORT '%s'\n" % self.PROG_NAMES[i]
296 
297  mainprog += "CONST\nVAR\n"
298  mainprog += "BEGIN\n"
299  for i in range(npages):
300  mainprog += " R_%s()\n" % self.PROG_NAMES[i]
301 
302  mainprog += "END %s\n" % progname_main
303  self.PROG = mainprog
304  self.progsave(folder, progname_main, ask_user, show_result)
305  self.LOG = ''
306  folder_user = getFileDir(self.FILE_SAVED)
307  # progname_user = getFileName(self.FILE_SAVED)
308 
309  for i in range(npages):
310  self.PROG = self.PROG_LIST[i]
311  self.progsave(folder_user, self.PROG_NAMES[i], False, show_result)
312 
313  else:
314  self.progsave(folder, progname, ask_user, show_result)
315 
316 
317  def ProgSendRobot(self, robot_ip, remote_path, ftp_user, ftp_pass):
318  """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".
319  The connection parameters must be provided in the robot connection menu of RoboDK"""
320  UploadFTP(self.PROG_FILES, robot_ip, remote_path, ftp_user, ftp_pass)
321 
322  def MoveJ(self, pose, joints, conf_RLF=None):
323  """Add a joint movement"""
324  #self.addline('MOVE JOINT TO ' + joints_2_str(joints))# MOVE JOINT TO: won't use absolute axis position
325  self.addline('MOVE TO ' + self.joints_2_str(joints)) # MOVE TO: absolute axis position
326 
327  def new_move(self, pose1, pose2):
328  if pose1 is None:
329  return
330 
331  def Calculate_Time(Dist, Vmax, Amax):
332  '''Calculate the time it takes to move a distance Dist at Amax acceleration and Vmax speed'''
333  tacc = Vmax/Amax;
334  Xacc = 0.5*Amax*tacc*tacc;
335  if Dist <= 2*Xacc:
336  # Vmax is not reached
337  tacc = sqrt(Dist/Amax)
338  Ttot = tacc*2
339  else:
340  # Vmax is reached
341  Xvmax = Dist - 2*Xacc
342  Tvmax = Xvmax/Vmax
343  Ttot = 2*tacc + Tvmax
344  return Ttot
345 
346  add_material = self.NEW_E_LENGTH - self.LAST_E_LENGTH
348 
349  if add_material > 0:
350  distance_mm = norm(subs3(pose1.Pos(), pose2.Pos()))
351  # calculate movement time in seconds
352  time_s = Calculate_Time(distance_mm, self.SPEED_MMS, self.ACCEL_MMSS)
353  # add material
354  self.addline("$AOUT[5] := %.3f" % (add_material/time_s))
355  else:
356  # DO not add material
357  self.addline("$AOUT[5] := 0")
358 
359  def new_movec(self, pose1, pose2, pose3):
360  return
361 
362  def MoveL(self, pose, joints, conf_RLF=None):
363  """Add a linear movement"""
364  # Filter sending the same movement twice
365  if self.LAST_POSE is not None and pose is not None:
366  # Skip adding a new movement if the new position is the same as the last one
367  if distance(pose.Pos(), self.LAST_POSE.Pos()) < 0.001 and pose_angle_between(pose, self.LAST_POSE) < 0.01:
368  return
369 
370  target = ''
371  if pose is None:
372  target = self.joints_2_str(joints)
373  else:
374  target = self.pose_2_str(pose,joints)
375 
376  #self.new_move(self.LAST_POSE, pose) #used for 3D printing
377  if self.FLY_DIST > 0:
378  self.addline('MOVEFLY LINEAR TO %s ADVANCE' % target)
379  else:
380  self.addline('MOVE LINEAR TO ' + target)
381 
382  self.LAST_POSE = pose
383 
384  def MoveC(self, pose1, joints1, pose2, joints2, conf_RLF_1=None, conf_RLF_2=None):
385  """Add a circular movement"""
386  #self.new_movec(self.LAST_POSE, pose1, pose2) #used for 3D printing
387  if self.FLY_DIST > 0:
388  self.addline('MOVEFLY CIRCULAR TO %s VIA %s ADVANCE' % (self.pose_2_str(pose2,joints2), self.pose_2_str(pose1,joints1)))
389  else:
390  self.addline('MOVE CIRCULAR TO %s VIA %s' % (self.pose_2_str(pose2,joints2), self.pose_2_str(pose1,joints1)))
391 
392  self.LAST_POSE = pose2
393 
394  def setFrame(self, pose, frame_id=None, frame_name=None):
395  """Change the robot reference frame"""
396  self.addline('$UFRAME := ' + self.pose_2_str(pose))
397 
398  def setTool(self, pose, tool_id=None, tool_name=None):
399  """Change the robot TCP"""
400  self.addline('$TOOL := ' + self.pose_2_str(pose))
401 
402  def Pause(self, time_ms):
403  """Pause the robot program"""
404  if time_ms <= 0:
405  self.addline('PAUSE')
406  else:
407  self.addline('DELAY %.0f' % (time_ms))
408 
409  def setSpeed(self, speed_mms):
410  """Changes the robot speed (in mm/s)"""
411  self.SPEED_MMS = speed_mms
412  self.addline('$SPD_OPT := SPD_LIN')
413  self.addline('$LIN_SPD := %.3f' % (speed_mms*0.001))
414 
415  def setAcceleration(self, accel_mmss):
416  """Changes the robot acceleration (in mm/s2)"""
417  self.ACCEL_MMSS = accel_mmss
418  self.addlog('setAcceleration not defined')
419 
420  def setSpeedJoints(self, speed_degs):
421  """Changes the robot joint speed (in deg/s)"""
422  self.addline('$ROT_SPD := %.3f' % (speed_degs*pi/180.0))
423 
424  def setAccelerationJoints(self, accel_degss):
425  """Changes the robot joint acceleration (in deg/s2)"""
426  self.addlog('setAccelerationJoints not defined')
427 
428  def setZoneData(self, zone_mm):
429  """Changes the zone data approach (makes the movement more smooth)"""
430  #self.addlog('setZoneData not defined (%.1f mm)' % zone_mm)
431  self.FLY_DIST = zone_mm
432  self.addline('$FLY_DIST := %.3f' % zone_mm)
433 
434  def setDO(self, io_var, io_value):
435  """Sets a variable (output) to a given value"""
436  if type(io_var) != str: # set default variable name if io_var is a number
437  io_var = '$DOUT[%s]' % str(io_var)
438  if type(io_value) != str: # set default variable value if io_value is a number
439  if io_value > 0:
440  io_value = 'ON'
441  else:
442  io_value = 'OFF'
443 
444  # at this point, io_var and io_value must be string values
445  self.addline('%s := %s' % (io_var, io_value))
446 
447  def waitDI(self, io_var, io_value, timeout_ms=-1):
448  """Waits for an input io_var to attain a given value io_value. Optionally, a timeout can be provided."""
449  if type(io_var) != str: # set default variable name if io_var is a number
450  io_var = '$DIN[%s]' % str(io_var)
451  if type(io_value) != str: # set default variable value if io_value is a number
452  if io_value > 0:
453  io_value = 'ON'
454  else:
455  io_value = 'OFF'
456 
457  # at this point, io_var and io_value must be string values
458  if timeout_ms < 0:
459  #self.addline('WAIT FOR %s==%s' % (io_var, io_value))
460  self.addline('$TIMER[1] := 0')
461  self.addline('REPEAT')
462  self.addline(' DELAY 1')
463  self.addline('UNTIL (%s = %s)' % (io_var, io_value))
464  else:
465  self.addline('$TIMER[1] := 0')
466  self.addline('REPEAT')
467  self.addline(' DELAY 1')
468  self.addline('UNTIL (%s = %s) OR ($TIMER[1] > %.1f)' % (io_var, io_value, timeout_ms))
469  self.addline('IF $TIMER[1] > %.1f THEN' % timeout_ms)
470  self.addline('-- TIMED OUT! Important: This section must be updated accordingly')
471  self.addline(' DELAY 2000')
472  #self.addline(' PAUSE')#Important, this must be updated to perform a specific action
473  self.addline('ENDIF')
474 
475  def RunCode(self, code, is_function_call = False):
476  """Adds code or a function call"""
477  if self.nProgs > 1 and not self.INCLUDE_SUB_PROGRAMS:
478  return
479 
480  if is_function_call:
481  if code.startswith("Extruder("):
482  # if the program call is Extruder(123.56), we extract the number as a string and convert it to a number
483  self.NEW_E_LENGTH = float(code[9:-1]) # it needs to retrieve the extruder length from the program call
484  # Do not generate program call
485  return
486 
487  code.replace(' ','_')
488  bracket_id = code.find('(')
489  import_prog = None
490  if bracket_id < 0:
491  # no brackets
492  import_prog = code
493  #code = code + '()'
494  else:
495  # brackets
496  import_prog = code[:bracket_id]
497 
498  # Add import directive only if we have not added it before
499  if not import_prog in self.IMPORTS:
500  self.IMPORTS.append(import_prog)
501 
502  self.addline('R_' + code)
503  else:
504  self.addline(code)
505 
506  def RunMessage(self, message, iscomment = False):
507  """Add a joint movement"""
508  if iscomment:
509  self.addline('-- ' + message)
510  else:
511  #self.addline('TYPE "' + message + '"')
512  #-------- Option 1: Show message on the teach pendant: Important! Fails if there is no teach pendant
513  #self.PROG_VARS.append('lun: INTEGER')
514  #self.addline(MACRO_MESSAGE_TP % message)
515  #-------- Option 2: Just comment the message
516  self.addline('-- ' + message)
517 
518 
519 # ------------------ private ----------------------
520  def addline(self, newline):
521  """Add a program line"""
522  if self.nProgs > 1 and not self.INCLUDE_SUB_PROGRAMS:
523  return
524 
525  if not self.INCLUDE_SUB_PROGRAMS and self.nLines > self.MAX_LINES_X_PROG:
526  self.nLines = 0
527  self.ProgFinish(self.PROG_NAME, True)
528  self.ProgStart(self.PROG_NAME, True)
529 
530  if self.nProgs > 1:
531  self.ROUTINES = self.ROUTINES + self.TAB + newline + '\n'
532  else:
533  self.PROG = self.PROG + self.TAB + newline + '\n'
534 
535  self.nLines = self.nLines + 1
536 
537  def addlog(self, newline):
538  """Add a log message"""
539  if self.nProgs > 1 and not self.INCLUDE_SUB_PROGRAMS:
540  return
541 
542  self.LOG = self.LOG + newline + '\n'
543 
544 # -------------------------------------------------
545 # ------------ For testing purposes ---------------
546 def Pose(xyzrpw):
547  [x,y,z,r,p,w] = xyzrpw
548  a = r*math.pi/180
549  b = p*math.pi/180
550  c = w*math.pi/180
551  ca = math.cos(a)
552  sa = math.sin(a)
553  cb = math.cos(b)
554  sb = math.sin(b)
555  cc = math.cos(c)
556  sc = math.sin(c)
557  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]])
558 
559 def test_post():
560  """Test the post with a basic program"""
561 
562  robot = RobotPost('Comau_custom', 'Generic Comau robot')
563 
564  robot.ProgStart("Program")
565  robot.RunMessage("Program generated by RoboDK", True)
566  robot.setFrame(Pose([807.766544, -963.699898, 41.478944, 0, 0, 0]))
567  robot.setTool(Pose([62.5, -108.253175, 100, -60, 90, 0]))
568  robot.MoveJ(Pose([200, 200, 500, 180, 0, 180]), [-46.18419, -6.77518, -20.54925, 71.38674, 49.58727, -302.54752] )
569  robot.MoveL(Pose([200, 250, 348.734575, 180, 0, -150]), [-41.62707, -8.89064, -30.01809, 60.62329, 49.66749, -258.98418] )
570  robot.MoveL(Pose([200, 200, 262.132034, 180, 0, -150]), [-43.73892, -3.91728, -35.77935, 58.57566, 54.11615, -253.81122] )
571  robot.RunMessage("Setting air valve 1 on")
572  robot.RunCode("TCP_On", True)
573  robot.Pause(1000)
574  robot.MoveL(Pose([200, 250, 348.734575, 180, 0, -150]), [-41.62707, -8.89064, -30.01809, 60.62329, 49.66749, -258.98418] )
575  robot.MoveL(Pose([250, 300, 278.023897, 180, 0, -150]), [-37.52588, -6.32628, -34.59693, 53.52525, 49.24426, -251.44677] )
576  robot.MoveL(Pose([250, 250, 191.421356, 180, 0, -150]), [-39.75778, -1.04537, -40.37883, 52.09118, 54.15317, -246.94403] )
577  robot.RunMessage("Setting air valve off")
578  robot.RunCode("TCP_Off(55)", True)
579  robot.Pause(1000)
580  robot.MoveL(Pose([250, 300, 278.023897, 180, 0, -150]), [-37.52588, -6.32628, -34.59693, 53.52525, 49.24426, -251.44677] )
581  robot.MoveL(Pose([250, 200, 278.023897, 180, 0, -150]), [-41.85389, -1.95619, -34.89154, 57.43912, 52.34162, -253.73403] )
582  robot.MoveL(Pose([250, 150, 191.421356, 180, 0, -150]), [-43.82111, 3.29703, -40.29493, 56.02402, 56.61169, -249.23532] )
583  robot.ProgFinish("Program")
584  # robot.ProgSave(".","Program",True)
585  print(robot.PROG)
586  if len(robot.LOG) > 0:
587  mbox('Program generation LOG:\n\n' + robot.LOG)
588 
589  input("Press Enter to close...")
590 
591 if __name__ == "__main__":
592  """Function to call when the module is executed by itself: test"""
593  test_post()
def pose_2_str(self, pose, joints=None, conf_RLF=None)
Definition: Comau_C5G.py:110
def MoveC(self, pose1, joints1, pose2, joints2, conf_RLF_1=None, conf_RLF_2=None)
Definition: Comau_C5G.py:384
def ProgStart(self, progname, new_page=False)
Definition: Comau_C5G.py:159
def ProgSendRobot(self, robot_ip, remote_path, ftp_user, ftp_pass)
Definition: Comau_C5G.py:317
def setFrame(self, pose, frame_id=None, frame_name=None)
Definition: Comau_C5G.py:394
def MoveJ(self, pose, joints, conf_RLF=None)
Definition: Comau_C5G.py:322
def __init__(self, robotpost=None, robotname=None, robot_axes=6, kwargs)
Definition: Comau_C5G.py:149
def ProgFinish(self, progname, new_page=False)
Definition: Comau_C5G.py:220
def UploadFTP(program, robot_ip, remote_path, ftp_user, ftp_pass)
Definition: robodk.py:1312
def progsave(self, folder, progname, ask_user=False, show_result=False)
Definition: Comau_C5G.py:243
def pose_angle_between(pose1, pose2)
Definition: robodk.py:741
def setTool(self, pose, tool_id=None, tool_name=None)
Definition: Comau_C5G.py:398
def mbox(msg, b1='OK', b2='Cancel', frame=True, t=False, entry=None)
Definition: robodk.py:1458
def waitDI(self, io_var, io_value, timeout_ms=-1)
Definition: Comau_C5G.py:447
def MoveL(self, pose, joints, conf_RLF=None)
Definition: Comau_C5G.py:362
def RunMessage(self, message, iscomment=False)
Definition: Comau_C5G.py:506
def new_movec(self, pose1, pose2, pose3)
Definition: Comau_C5G.py:359
def getSaveFile(strdir='C:\\', strfile='file.txt', strtitle='Save file as ...')
Definition: robodk.py:1354
def ProgSave(self, folder, progname, ask_user=False, show_result=False)
Definition: Comau_C5G.py:284
def RunCode(self, code, is_function_call=False)
Definition: Comau_C5G.py:475


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