Script Command Examples - Technote 19001 PDF
Script Command Examples - Technote 19001 PDF
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.
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.
Example command
Parameters in example
Example command
Parameters in example
t = 0 – the time (seconds) to make move is not specified. If it were specified the
command would ignore the a and v values.
Example Command
Example Parameters
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.
Example Command
Example Parameters
position_deviation_warning(enabled, threshold)
Example Command
Position_deviation_warning(True,0.8)
Example Parameters
Example Command
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.
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.
Example Commands
or
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
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
Set_pos(q)
Example Command
set_pos([0.0,1.57,-1.57,0,0,3.14])
speedj(qd, a, t)
This is the equivalent of a joint jog command. Robot moves as directed for time t.
Example Command
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
speedl(xd, a, t, aRot=’a’)
This is the equivalent of a linear jog command. Robot moves as directed for time t.
Example Command
speedl([0.5,0.4,0.0,0.,1.57,0,0], 0.5, 0.5)
qd - Tool speeds of – x = 500 mm/s, y = 400 mm/s, rx=90 deg/s, ry and rz= 0
mm/s
Example Command
stopj(a)
Example Command
Stopj(2)
stopl(a, aRot=’a’)
Example Command
Stopj(20)
aRot: tool deceleration [rad/sˆ2] (optional), if not defined a, position acceleration, is used. i.e. it
supersedes the “a” deceleration.
Example Command
ticks per revolution = 500.0 – the number of ticks the encoder sees when the
conveyor moves one revolution.
rotate tool = false - the tool should not rotate with the conveyor, but stay in the
orientation specified by the trajectory (movel() etc.).
track conveyor linear(direction, ticks per meter)
Example Command
direction = p[1,0,0,0,0,0] - Pose vector that determines the direction of the conveyor in
the base coordinate system of the robot
ticks per meter = 1000. - How many ticks the encoder sees when the conveyor moves
one meter.
Part 2 – Module Internals
Example Command
get_inverse_kin(p[.1,.2,.2,0,3.14,0], [0.,3.14,1.57,.785,0,0])
qnear solution should be near to joint angles of j0=0 deg, j1=360 deg, j2=180 deg,
j3=90 deg, j4=0 deg, j5=90 deg.
maxPositionError is 1e-10 m
is_within_safety_limits(pose)
Example Command
is_within_safety_limits(p[.1,.2,.2,0,3.14,0])
pose target pose with position of x=100mm, y=200mm, z=200mm and rotation vector
of rx=0 deg., ry=360 deg, rz=0 deg.
Example Command
blocking is True so the popup must be cleared before other actions will be
performed.
set_gravity(d)
Example Command
set_gravity(0,9.82,0)
set_payload(m,CoG)
Example Command
set_payload(3., [0,0,.3])
set_payload_cog(CoG)
Example Command
set_payload([0,0,.3])
CoG is set to x=0 mm, y=0 mm, z=300mm from the center of the tool mount in tool
coordinates
set_payload_mass(m)
Example Command
set_payload(3.)
set_tcp(pose)
Example Command
set_tcp(p[0.,.2,.3,0.,3.14,0.])
sleep(t)
Example Command
sleep(3.)
textmsg(s1, s2=’ ’)
Example Command
textmsg(“value = “, 3)
acos(f)
Example Command
acos(0.707)
Returns .785
asin(f)
Example Command
asin(0.707)
Returns .785
atan(f)
Example Command
atan(1.)
Returns .785
atan2(x,y)
Example Command
atan2(.5,.5)
binary_list_to_integer(l)
Example Command
binary_list_to_integer([True,False,False,True])
l represents the binary values 1001
Returns 9
ceil(f)
Example Command
ceil(1.43)
Returns 2
cos(f)
Example Command
cos(1.57)
Returns 0.0
d2r(d)
Example Command
d2r(90)
d angle in degrees
floor(f)
Example Command
floor(1.53)
returns 1
get_list_length(v)
Example Command
get_list_length([1,3,3,6,2])
integer_to_binary_list(i)
Example Command
integer_to_binary_list(57)
I integer 57
interpolate_pose(p_from,p_to, alpha)
Example Command
interpolate_pose(p[.2,.2,.4,0,0,0],p[.2,.2,.6,0,0,0],.5)
p_from p[.2,.2,.3,0,0,0]
p_to p[.2,.2,.5,0,0,0]
alpha .5 is 50% of the way in between p_from and p_to
Returns p[.2,.2,.4,0,0,0]
length(v)
Example Command
length(“here I am”)
Returns 9
log(b,f)
Example Command
log(10.,4.)
b base 10
f log of 4
Returns 0.60206
norm(a)
Examples of Command
norm(-5.3) Returns 5.3
norm(-8) Returns 8
point_dist(p_from,p_to)
Example Command
point_dist(p[.2,.5,.1,1.57,0,3.14], p[.2,.5,.6,0,1.57,3.14])
pose_add(p_1,p_2)
Example Command
pose_add(p[.2,.5,.1,1.57,0,0], p[.2,.5,.6,1.57,0,0])
Returns p[0.4,1.0,0.7,3.14,0,0]
pose_dist(p_from,p_to)
Example Command
pose_dist(p[.2,.5,.1,1.57,0,3.14], p[.2,.5,.6,0,1.57,3.14])
pose_inv(p_from)
Example Command
pose_inv(p[.2,.5,.1,1.57,0,3.14])
Returns p[0.19324,0.41794,-0.29662,1.23993,0.0,2.47985]
pose_sub(p_1,p_2)
Example Command
pose_sub(p[.2,.5,.1,1.57,0,0], p[.2,.5,.6,1.57,0,0])
Returns p[0.0,0.0,-0.5,0.0,.0.,0.0]
pose_trans(p_1,p_2)
Example Command
pose_trans(p[.2,.5,.1,1.57,0,0], p[.2,.5,.6,1.57,0,0])
Returns p[0.4,-0.0996,0.60048,3.14,0.0,0.0]
pow(base,exponent)
Example Command
pow(5.,3)
base 5
exponent 3
Returns 125.
r2d(r)
Example Command
r2d(1.57)
r 1.5707 rad
Returns 90 deg
rotvec2rpy(rotation_vector)
Example Command
rotvec2rpy([3.14,1.57,0])
rotation_vector [3.14,1.57,0] rx=3.14, ry=1.57, rz=0
rpy2rotvec(rpy_vector)
Example Command
rpy2rotvec([3.14,1.57,0])
sin(f)
Example Command
sin(1.57)
Returns 1.0
sqrt(f)
Example Command
sqrt(9)
f 9
Returns 3
tan(f)
Example Command
tan(.7854)
Returns 1.0
Part 4 – Module interfaces
Example Command
get_analog_in(1)
n analog input 1
Example Command
get_analog_out(1)
n analog output 1
get_configurable_digital_in(n)
Example Command
get_configurable_digital_in(1)
get_configurable_digital_out(n)
Example Command
get_configurable_digital_out(1)
get_digital_in(n)
Example Command
get_digital_in(1)
n digital input 1
get_digital_out(n)
Example Command
get_digital_out(1)
n digital output 1
get_euromap_input(port_number)
Example Command
get_euromap_input(1)
get_euromap_output(n)
Example Command
get_euromap_output(1)
get_configurable_digital_in(n)
Example Command
get_configurable_digital_in(1)
get_flag(n)
Example Command
get_flag(1)
n value of flag 1
get_standard_analog_in(n)
Example Command
get_standard_analog_in(1)
get_standard_analog_out(n)
Example Command
get_standard_analog_out(1)
get_standard_digital_in(n)
Example Command
get_standard_digital_in(1)
get_standard_digital_out(n)
Example Command
get_standard_digital_out(1)
get_tool_analog_in(n)
Example Command
get_tool_analog_in(1)
get_tool_digital_in(n)
Example Command
get_tool_digital_in(1)
get_tool_digital_out(n)
Example Command
get_tool_digital_out(1)
Example Command
modbus_add_signal(“172.140.17.11”, 255,5,1,”output1”)
IP IP address 172.140.17.11
Slave number 255
Signal address 5
Signal type 1 digital output
Signal name output1
modbus_delete_signal(signal name))
Example Command
modbus_delete_signal(”output1”)
Example Command
modbus_get_signal_status(”output1”,False)
Example Command
IP IP address 172.140.17.11
Slave number 103
Function code 6
Data [17,32,2,88]
Function code and data are specified by the manufacturer of the slave Modbus device
connected to the UR controller
Example Command
Example Command
Example Command
modbus_set_runstate_dependent_choice(”output2”, 1)
Signal name output2
Runstate dependent choice 1 set low when a program is not running
Example Command
modbus_set_signal_update_frequency(”output2”, 20)
read_input_boolean_register(address)
Example Command
read_input_float_register(address)
Example Command
read_input_integer_register(address)
Example Command
read_output_boolean_register(address)
Example Command
read_output_float_register(address)
Example Command
read output float register(3)
read_output_integer_register(address)
Example Command
read_port_bit(address)
Example Command
read_port_register(address)
Example Command
rpc_factory(type,url)
Example Command
type xmlrpc
url http://127.0.0.1:8080/RPC2
Example Command
set_analog_inputrange(1,0)
Example Command
set_analog_out(1,2)
set_analog_output_domain(port,domain)
Example Command
set_analog_output_domain(1,1)
set_configurable_digital_out(n,b)
Example Command
set_configurable_digital_out(1,True)
set_digital_out(n,b)
Example Command
set_digital_out(1,True)
n digital output 1
b True
set_euromap_output(port_number, signal_value)
Example Command
set_euromap_output(1,True)
port_number euromap digital output on port 1
signal_value True
set_euromap_runstate_dependent_choice(port_number, runstate_choice)
Example Command
set_euromap_runstate_dependent_choice(1,1)
set_flag(n,b)
Example Command
set_flag(1,True)
n value of flag 1
set_runstate_configurable_digital_output_to_value(outputid, state)
Example Command
Set_runstate_configurable_digital_output_to_value(5, 2)
set_runstate_gp_boolean_output_to_value(outputid, state)
Example Command
set_runstate_gp_boolean_output_to_value(5, 2)
set_runstate_standard_analog_output_to_value(outputid, state)
Example Command
set_runstate_standard_analog_output_to_value(1, 2)
Example Command
Set_runstate_standard_digital_output_to_value(5, 2)
set_runstate_tool_digital_output_to_value(outputid, state)
Example Command
Set_runstate_tool_digital_output_to_value(1, 2)
set_standard_analog_input_domain(port, domain)
Example Command
set_standard_analog_input_domain(1,0)
set_standard_analog_out(n,f)
Example Command
set_standard_analog_out(1,4)
set_standard_digital_out(n,f)
Example Command
set_standard_digital_out(1,True)
set_tool_analog_input_domain(port,domain)
Example Command
set_tool_analog_input_domain(1,1)
set_tool_digital_out(n,b)
Example Command
set_tool_digital_out(1,True)
set_tool_voltage(voltage)
Example Command
set_tool_voltage(24)
voltage 24 volts
socket_close(socket_name=’socket_0’)
Example Command
socket_close(socket_name=”socket_0”)
socket_name socket_0
socket_get_var(name, socket_name=’socket_0’)
Example Command
socket_get_var(“POS.X”, socket_name=”socket_0”)
socket_name socket_0
Example Command
address 192.168.5.1
socket 50000
socket_name socket_10
socket_read_ascii_float(number, socket_name=’socket_0’)
Example Command
socket_read_ascii_float(4,”socket10”)
socket_read_binary_integer(number, socket_name=’socket_0’)
Example Command
socket_read_ascii_float(4,”socket10”)
socket_read_byte_list(number, socket_name=’socket_0’)
Example Command
socket_read_ascii_float(4,”socket10”)
socket_read_line(socket_name=’socket_0’)
Example Command
socket_read_line(”socket10”)
socket_name socket_10
socket_read_string(socket_name=’socket_0’,prefix=’ ‘, suffix=’ ’)
Example Command
socket_read_string(”socket10”,prefix=”>”,suffix=”<”)
socket_name socket_10
socket_send_byte(value,socket_name=’socket_0’)
Example Command
socket_send_byte(2,”socket10”)
value 2
socket_name socket_10
Returns True or False (sent or not sent)
socket_send_int(value,socket_name=’socket_0’)
Example Command
socket_send_int(2,”socket10”)
value 2
socket_name socket_10
socket_send_line(str,socket_name=’socket_0’)
Example Command
socket_send_int(“hello”,”socket10”)
str hello
socket_name socket_10
socket_send_string(str,socket_name=’socket_0’)
Example Command
socket_send_int(“hello”,”socket10”)
str hello
socket_name socket_10
socket_set_var_name(name,value,socket_name=’socket_0’)
Example Command
socket_set_var_name(”POS_Y”,2200,”socket10”)
name POS_Y
value 2
socket_name socket_10
write_output_boolean_register(address, value)
Example Command
write_output_boolean_register(3,True)
address 3
value True
write_output_float_register(address, value)
Example Command
write_output_float_register(3,37.68)
address 3
value 37.68
write_output_integer_register(address, value)
Example Command
write_output_integer_register(3,12)
address 3
value 12
write_port_bit(address, value)
Example Command
write_port_bit(3,True)
address 3
value True
write_port_register(address, value)
Example Command
write_port_bit(3,100)
address 3
value 100