没有合适的资源?快使用搜索试试~ 我知道了~
首页UR的脚本编程语言及示例大全
资源详情
资源评论
资源推荐

Script Command Examples
Commands that have no arguments are not listed.
Part 1 – Module Motion
conveyor_pulse_decode(type, A, B)
Example command:
conveyor_pulse_decode(1, 2, 3)
Parameters in example
type = 1 - is quadrature encoder, input A and B must be square waves with 90 degree
offset. Direction of the conveyor can be determined.
A = 2 – Encoder output A is connected to digital input 2
B = 3 – Encoder output B is connected to digital input 3
force_mode(task frame, selection vector, wrench, type, limits)
Example command:
force_mode(p[0.1,0,0,0,0.785],[1,0,0,0,0,0],[20,0,40,0,0,0],2,[.2,.1,.1,.785,.785,1.57])
Parameters in example
Task frame = p[0.1,0,0,0,0.785] – This frame is offset from the base frame 100 mm in the
x direction and rotated 45 degrees in the rz direction
Selection Vector = [1,0,0,0,0,0] – The robot is compliant in the x direction of the Task
frame above.
Wrench = [20,0,40,0,0,0] – The robot apples 20N in the x direction. It also accounts for a
40N external force in the z direction.
Type = 2 – The force frame is not transformed.
Limits = [.1,.1,.1,.785,.785,1.57] – max x velocity is 100 mm/s, max y deviation is 100
mm, max z deviation is 100 mm, max rx deviation is 45 deg, max ry deviation is 45 deg,
max rz deviation is 90 deg.

movec(pose_via, pose_to, a=1.2, v=0.25, r=0)
Example command
movec(p[x,y,z,0,0,0], pose to, a=1.2, v=0.25, r=0.05)
Parameters in example
Note: first position on circle is previous waypoint.
pose_via = p[x,y,z,0,0,0] – second position on circle.
Note rotations are not used so they can be left as zeros.
Note: This position can also be represented as joint angles [j0,j1,j2,j3,j4,j5} then
forward kinematics is used to calculate the
corresponding pose
pose_to = p[x,y,z,rx,ry,rz] – third position on circle.
Note: This position can also be represented as joint angles [j0,j1,j2,j3,j4,j5} then
forward kinematics is used to calculate the corresponding pose
a = 1.2 – acceleration is 1.2 m/s/s
v = 0.25 – velocity is 250 mm/s
r = 0 – blend radius (at pose_to) is 50 mm.
movej(q, a=1.4, v=1.05, t=0, r=0)
Example command
movej([0,1.57,-1.57,3.14,-1.57,1.57], a=1.4, v=1.05, t=0, r=0)
Parameters in example
q = [0,1.57,-1.57,3.14,0,1.57] – base is at 0 deg rotation, shoulder is at 90 deg rotation,
elbow is at -90 deg rotation, wrist 1 is at 180 deg rotation, wrist 2 is at -90 deg rotation,
wrist 3 is at 90 deg rotation. Note: joint positions (q can also be specified as a pose, then
inverse kinematics is used to calculate the corresponding joint positions)
a = 1.4 – acceleration is 1.4 rad/s/s
v = 1.05 – velocity is 1.05 rad/s
t = 0 – the time (seconds) to make move is not specified. If it were specified the
command would ignore the a and v values.
r = 0 – the blend radius is zero meters.

movel(pose, a=1.2, v=0.25, t=0, r=0)
Example Command
movel(pose, a=1.2, v=0.25, t=0, r=0)
Example Parameters
pose = p[0.2,0.3,0.5,0,0,3.14] – position in base frame of x = 200 mm, y = 300 mm, z =
500 mm, rx = 0, ry = 0, rz = 180 deg.
a = 1.2 – acceleration of 1.2 m/s^2
v = 0.25 – velocity of 250 mm/s
t = 0 – the time (seconds) to make the move is not specified. If it were specified the
command would ignore the a and v values.
r = 0 – the blend radius is zero meters.
movep(pose, a=1.2, v=0.25, t=0, r=0)
Example Command
movel(pose, a=1.2, v=0.25, t=0, r=0)
Example Parameters
pose = p[0.2,0.3,0.5,0,0,3.14] – position in base frame of x = 200 mm, y = 300 mm, z =
500 mm, rx = 0, ry = 0, rz = 180 deg.
a = 1.2 – acceleration of 1.2 m/s^2
v = 0.25 – velocity of 250 mm/s
r = 0 – the blend radius is zero meters.
position_deviation_warning(enabled, threshold)
Example Command
Position_deviation_warning(True,0.8)
Example Parameters
Enabled = True – Logging of warning is turned on

Threshhold = 0.8 – 80% of deviation that causes a protective stop causes a warning to be
logged in the log history file.
reset_revolution_counter(qNear=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
Example Command
reset_revolution_counter(qNear=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
Example Parameters
qNear = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] – Optional parameter, resets the revolution counter
of wrist 3 to zero on UR3 robots to the nearest zero location to joint rotations
represented by qNear.
servoc(pose, a=1.2, v=0.25, r=0)
Example Command
Servoc(p[0.2,0.3,0.5,0,0,3.14],a=1.2,v=0.25,r=0)
pose = p[0.2,0.3,0.5,0,0,3.14] – position in base frame of x = 200 mm, y = 300 mm, z = 500 mm,
rx = 0, ry = 0, rz = 180 deg.
a = 1.2 – acceleration of 1.2 m/s^2
v = 0.25 – velocity of 250 mm/s
r = 0 – the blend radius at the target position is zero meters.
servoj(q, a, v, t=0.008, lookahead_time=0.1, gain=300)
Example Commands
servoj([0.0,1.57,-1.57,0,0,3.14], t=0.1, lookahead_time=0.1, gain=300)
or
servoj([0.0,1.57,-1.57,0,0,3.14], 0, 0, 0.1, 0.1, 300)
q = [0.0,1.57,-1.57,0,0,3.14] – joint angles in radians representing rotations of base=0°,
shoulder=90°, elbow=-90°, wrist1=0°, wrist2=0°, wrist3= 180°
a = 0 not used in current version
v = 0 not used in current version
t=.1 time where the command is controlling the robot. The function
is blocking for time t [S]

lookahead time=.1 time [S], range [0.03,0.2] smoothens the trajectory with this
lookahead time
gain=300 proportional gain for following target position, range [100,2000]
set conveyor tick count(tick count, absolute encoder resolution=0)
Example Command
Set_conveyor_tick_count(24543,0)
Tick count = 24543 which is a value read from a MODBUS register being updated by the
absolute encoder
Absolute encoder resolution = 0. 0 is a 32 bit signed encoder, range [-2147483648 ;
2147483647] (default)
Set_pos(q)
Example Command
set_pos([0.0,1.57,-1.57,0,0,3.14])
q = [0.0,1.57,-1.57,0,0,3.14] –the position of the simulated robot with joint angles in
radians representing rotations of base=0°, shoulder=90°, elbow=-90°, wrist1=0°,
wrist2=0°, wrist3= 180°
speedj(qd, a, t)
This is the equivalent of a joint jog command. Robot moves as directed for time t.
Example Command
speedj([0.2,0.3,0.1,0.05,0,0], 0.5, 0.5)
qd - Joint speeds of – base = 0.2 rad/s, shoulder = 0.3 rad/s, elbow=0.1 rad/s,
wrist1=0.05 rad/s, wrist2 and wrist 3 = 0 rad/s
a acceleration of 0.5 rad/s
2
of the leading axis (shoulder is this case)
t time of 0.5 s – time before the function returns
speedl(xd, a, t, aRot=’a’)
This is the equivalent of a linear jog command. Robot moves as directed for time t.
Example Command
剩余29页未读,继续阅读
















安全验证
文档复制为VIP权益,开通VIP直接复制

评论1