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

Generated robot program

#1
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():
# Program generated by 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()
#2
(07-21-2016, 01:19 PM)Tomo Wrote: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():
# Program generated by 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()

There is not robolink API import.
'end' is not defined in Python.
Pay attention to case sensitive Python language.

Try this similar example:

from robolink import *

RL = Robolink()
robot = RL.Item('UR5 serie 3')

def Prog1():
speed_ms = 0.3
accel_radss = 1.2
RL.setSimulationSpeed(speed_ms)
robot.MoveJ([-0.964392, -1.597788, -1.488417, -1.592133, 1.568830, 0.518872],accel_radss)
robot.MoveJ([-1.513582, -1.579018, -1.517266, -1.586032, 1.586891, -0.030042],accel_radss)
robot.MoveJ([-1.508372, -1.649491, -1.858695, -1.174046, 1.586735, -0.024833],accel_radss)

Prog1()




Users browsing this thread:
1 Guest(s)