07-21-2016, 01:19 PM
Hi!
So I made a simple robot program which goes through 3 points with joint movement. I then generated this program to script code (in my case URscript). Then I created a new pyhton program and copied this generated code, but then I get errors that lines are not defined. This is the simple code and I , am not very skilled with python programming, so is there any example of a working python script with UR5 robot or maybe can somebody repair this code to make it work.
def Prog1():
#程序生成的RoboDK 2.2.9 for UR5 serie 3 on 21/07/2016 15:06:56
# Using nominal kinematics.
# default parameters:
speed_ms = 0.3
speed_rads = 0.75
accel_mss = 3
accel_radss = 1.2
blend_radius_m = 0.001
# set_reference(p[0.000000, -1.000000, 0.000000, 0.000000, 0.000000, 0.000000])
set_tcp(p[0.000000, -0.020000, 0.130000, 0.000000, 0.000000, 0.000000])
movej([-0.964392, -1.597788, -1.488417, -1.592133, 1.568830, 0.518872],accel_radss,speed_rads,0,blend_radius_m)
movej([-1.513582, -1.579018, -1.517266, -1.586032, 1.586891, -0.030042],accel_radss,speed_rads,0,blend_radius_m)
movej([-1.508372, -1.649491, -1.858695, -1.174046, 1.586735, -0.024833],accel_radss,speed_rads,0,blend_radius_m)
end
Prog1()
So I made a simple robot program which goes through 3 points with joint movement. I then generated this program to script code (in my case URscript). Then I created a new pyhton program and copied this generated code, but then I get errors that lines are not defined. This is the simple code and I , am not very skilled with python programming, so is there any example of a working python script with UR5 robot or maybe can somebody repair this code to make it work.
def Prog1():
#程序生成的RoboDK 2.2.9 for UR5 serie 3 on 21/07/2016 15:06:56
# Using nominal kinematics.
# default parameters:
speed_ms = 0.3
speed_rads = 0.75
accel_mss = 3
accel_radss = 1.2
blend_radius_m = 0.001
# set_reference(p[0.000000, -1.000000, 0.000000, 0.000000, 0.000000, 0.000000])
set_tcp(p[0.000000, -0.020000, 0.130000, 0.000000, 0.000000, 0.000000])
movej([-0.964392, -1.597788, -1.488417, -1.592133, 1.568830, 0.518872],accel_radss,speed_rads,0,blend_radius_m)
movej([-1.513582, -1.579018, -1.517266, -1.586032, 1.586891, -0.030042],accel_radss,speed_rads,0,blend_radius_m)
movej([-1.508372, -1.649491, -1.858695, -1.174046, 1.586735, -0.024833],accel_radss,speed_rads,0,blend_radius_m)
end
Prog1()