50     """Converts a pose target to a string"""    52     c = 
angle3(pose.VX(),[1,0,0])*180/pi 
    53     return (
'TRANS(%.3f,%.3f,%.3f,%.3f)' % (x,y,z,c))
    56     """Converts a pose target to a string"""    58     c = 
angle3(pose.VX(),[1,0,0])*180/pi 
    64     return (
'POINT(%.3f,%.3f,%.3f,%.3f, %.1f, %i)' % (x,y,z,c,t,config))
    67     """Contverts a joint target to a string"""    68     return '{%s}' % (
','.join(format(ji, 
".5f") 
for ji 
in angles))
    73     """Robot post object"""    87     def __init__(self, robotpost=None, robotname=None, robot_axes = 6, **kwargs):
    95         self.
addline(
'PROGRAM %s' % progname)
   102     def ProgSave(self, folder, progname, ask_user = False, show_result = False):
   103         progname = progname + 
'.' + self.
PROG_EXT   105             filesave = 
getSaveFile(folder, progname, 
'Save program as...')
   106             if filesave 
is not None:
   107                 filesave = filesave.name
   111             filesave = folder + 
'/' + progname
   112         fid = open(filesave, 
"w")
   115         print(
'SAVED: %s\n' % filesave) 
   120             if type(show_result) 
is str:
   123                 p = subprocess.Popen([show_result, filesave])
   124             elif type(show_result) 
is list:
   126                 p = subprocess.Popen(show_result + [filesave])   
   130                 os.startfile(filesave)
   131             if len(self.
LOG) > 0:
   132                 mbox(
'Program generation LOG:\n\n' + self.
LOG)
   135         """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".   136         The connection parameters must be provided in the robot connection menu of RoboDK"""   139     def MoveJ(self, pose, joints, conf_RLF=None):
   140         """Add a joint movement"""   143     def MoveL(self, pose, joints, conf_RLF=None):
   144         """Add a linear movement"""   147     def MoveC(self, pose1, joints1, pose2, joints2, conf_RLF_1=None, conf_RLF_2=None):
   148         """Add a circular movement"""   151     def setFrame(self, pose, frame_id=None, frame_name=None):
   152         """Change the robot reference frame"""   155     def setTool(self, pose, tool_id=None, tool_name=None):
   156         """Change the robot TCP"""   160         """Pause the robot program"""   164             self.
addline(
'DELAY %.3f' % (time_ms*0.001))
   167         """Changes the robot speed (in mm/s)"""   168         speed_percent = max(100*speed_mms/5000,100)
   169         self.
addline(
'SPEED=%.0f' % (speed_percent))
   172         """Changes the robot acceleration (in mm/s2)"""   178         """Changes the robot joint speed (in deg/s)"""   182         """Changes the robot joint acceleration (in deg/s2)"""   186         """Changes the zone data approach (makes the movement more smooth)"""   190         """Sets a variable (output) to a given value"""   191         if type(io_var) != str:  
   192             io_var = 
'OUT[%s]' % str(io_var)        
   193         if type(io_value) != str: 
   200         self.addline(
'%s=%s' % (io_var, io_value))
   202     def waitDI(self, io_var, io_value, timeout_ms=-1):
   203         """Waits for an input io_var to attain a given value io_value. Optionally, a timeout can be provided."""   204         if type(io_var) != str:  
   205             io_var = 
'IN[%s]' % str(io_var)        
   206         if type(io_value) != str: 
   214             self.
addline(
'WAIT FOR %s==%s' % (io_var, io_value))
   216             self.
addline(
'WAIT FOR %s==%s TIMEOUT=%.1f' % (io_var, io_value, timeout_ms))   
   218     def RunCode(self, code, is_function_call = False):
   219         """Adds code or a function call"""   221             code.replace(
' ',
'_')
   222             if code.find(
'(') < 0:
   229         """Add a joint movement"""   231             self.
addline(
'REMARK %s' % message)
   233             self.
addline(
'REMARK %s' % message)
   237         """Add a program line"""   241         """Add a log message"""   242         self.
LOG = self.
LOG + newline + 
'\n'   247     [x,y,z,r,p,w] = xyzrpw
   257     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]])
   260     """Test the post with a basic program"""   262     robot = 
RobotPost(
'Vplus_custom', 
'Generic Adept Robot')
   264     robot.ProgStart(
"Program")
   265     robot.RunMessage(
"Program generated by RoboDK", 
True)
   266     robot.setFrame(
Pose([807.766544, -963.699898, 41.478944, 0, 0, 0]))
   267     robot.setTool(
Pose([62.5, -108.253175, 100, -60, 90, 0]))
   268     robot.MoveJ(
Pose([200, 200, 500, 180, 0, 180]), [-46.18419, -6.77518, -20.54925, 71.38674, 49.58727, -302.54752] )
   269     robot.MoveL(
Pose([200, 250, 348.734575, 180, 0, -150]), [-41.62707, -8.89064, -30.01809, 60.62329, 49.66749, -258.98418] )
   270     robot.MoveL(
Pose([200, 200, 262.132034, 180, 0, -150]), [-43.73892, -3.91728, -35.77935, 58.57566, 54.11615, -253.81122] )
   271     robot.RunMessage(
"Setting air valve 1 on")
   272     robot.RunCode(
"TCP_On", 
True)
   274     robot.MoveL(
Pose([200, 250, 348.734575, 180, 0, -150]), [-41.62707, -8.89064, -30.01809, 60.62329, 49.66749, -258.98418] )
   275     robot.MoveL(
Pose([250, 300, 278.023897, 180, 0, -150]), [-37.52588, -6.32628, -34.59693, 53.52525, 49.24426, -251.44677] )
   276     robot.MoveL(
Pose([250, 250, 191.421356, 180, 0, -150]), [-39.75778, -1.04537, -40.37883, 52.09118, 54.15317, -246.94403] )
   277     robot.RunMessage(
"Setting air valve off")
   278     robot.RunCode(
"TCP_Off(55)", 
True)
   280     robot.MoveL(
Pose([250, 300, 278.023897, 180, 0, -150]), [-37.52588, -6.32628, -34.59693, 53.52525, 49.24426, -251.44677] )
   281     robot.MoveL(
Pose([250, 200, 278.023897, 180, 0, -150]), [-41.85389, -1.95619, -34.89154, 57.43912, 52.34162, -253.73403] )
   282     robot.MoveL(
Pose([250, 150, 191.421356, 180, 0, -150]), [-43.82111, 3.29703, -40.29493, 56.02402, 56.61169, -249.23532] )
   283     robot.ProgFinish(
"Program")
   286     if len(robot.LOG) > 0:
   287         mbox(
'Program generation LOG:\n\n' + robot.LOG)
   289     input(
"Press Enter to close...")
   291 if __name__ == 
"__main__":
   292     """Function to call when the module is executed by itself: test""" def ProgSave(self, folder, progname, ask_user=False, show_result=False)
def ProgStart(self, progname)
def setSpeedJoints(self, speed_degs)
def target_2_str(pose, joints)
def setAcceleration(self, accel_mmss)
def ProgFinish(self, progname)
def ProgSendRobot(self, robot_ip, remote_path, ftp_user, ftp_pass)
def MoveL(self, pose, joints, conf_RLF=None)
def waitDI(self, io_var, io_value, timeout_ms=-1)
def setAccelerationJoints(self, accel_degss)
def MoveJ(self, pose, joints, conf_RLF=None)
def MoveC(self, pose1, joints1, pose2, joints2, conf_RLF_1=None, conf_RLF_2=None)
def UploadFTP(program, robot_ip, remote_path, ftp_user, ftp_pass)
def addlog(self, newline)
def RunCode(self, code, is_function_call=False)
def mbox(msg, b1='OK', b2='Cancel', frame=True, t=False, entry=None)
def setZoneData(self, zone_mm)
def setFrame(self, pose, frame_id=None, frame_name=None)
def addline(self, newline)
def getSaveFile(strdir='C:\\', strfile='file.txt', strtitle='Save file as ...')
def setDO(self, io_var, io_value)
def setSpeed(self, speed_mms)
def RunMessage(self, message, iscomment=False)
def __init__(self, robotpost=None, robotname=None, robot_axes=6, kwargs)
def setTool(self, pose, tool_id=None, tool_name=None)