Doosan Robotics Programming Manual v1.0 Eng
Doosan Robotics Programming Manual v1.0 Eng
3
2.28 amovec ..............................................................................................................101
2.29 amovesj .............................................................................................................104
2.30 amovesx ............................................................................................................107
2.31 amoveb..............................................................................................................110
2.32 amove_spiral ....................................................................................................114
2.33 amove_periodic ...............................................................................................117
2.34 mwait(time=0) ...................................................................................................121
2.35 begin_blend(radius=0)....................................................................................123
2.36 end_blend().......................................................................................................125
2.37 check_motion() ................................................................................................127
2.38 stop(st_mode) ..................................................................................................129
2.39 change_operation_speed(speed) ................................................................131
2.40 wait_manual_guide().......................................................................................133
5
5.15 check_orientation_condition ........................................................................189
5.16 check_orientation_condition ........................................................................192
6.2 TP Interface.......................................................................................................230
6.3 Thread................................................................................................................236
6.3.1 thread_run(th_func_name, loop=False).............................................................................................................236
6.3.2 thread_stop(th_id)......................................................................................................................................................238
6.3.3 thread_pause(th_id)..................................................................................................................................................239
6.3.4 thread_resume(th_id)...............................................................................................................................................240
6.3.5 thread_state(th_id).....................................................................................................................................................241
6.3.6 Integrated example...................................................................................................................................................241
7
7.15 norm(x) ..............................................................................................................260
7.16 random()............................................................................................................261
7.17 rotx(angle) .........................................................................................................262
7.18 roty(angle) .........................................................................................................263
7.19 rotz(angle) .........................................................................................................264
7.20 rotm2eul(rotm) .................................................................................................265
7.21 rotm2rotvec(rotm) ...........................................................................................266
7.22 eul2rotm([alpha,beta,gamma]) ......................................................................267
7.23 eul2rotvec([alpha,beta,gamma]) ...................................................................268
7.24 rotvec2eul([rx,ry,rz]) ........................................................................................269
7.25 rotvec2rotm([rx,ry,rz]) .....................................................................................270
7.26 htrans(posx1,posx2) .......................................................................................271
7.27 get_intermediate_pose(posx1,posx2,alpha) ..............................................272
7.28 get_distance(posx1, posx2) ..........................................................................273
7.29 get_normal(x1, x2, x3).....................................................................................274
7.30 add_pose(posx1,posx2).................................................................................275
7.31 subtract_pose(posx1,posx2).........................................................................276
7.32 inverse_pose(posx1) ......................................................................................277
7.33 dot_pose(posx1, posx2).................................................................................278
7.34 cross_pose(posx1, posx2) ............................................................................279
7.35 unit_pose(posx1).............................................................................................280
8.3 Tcp/Server.........................................................................................................298
8.3.1 server_socket_open(port).......................................................................................................................................298
8.3.2 server_socket_close(sock).....................................................................................................................................299
8.3.3 server_socket_state(sock)......................................................................................................................................300
8.3.4 server_socket_write(sock, tx_data).......................................................................................................................301
8.3.5 server_socket_read(sock, length=-1, timeout=-1) ...........................................................................................302
8.3.6 Integrated example...................................................................................................................................................304
9
DRL Basic Syntax
No. Function Description
This function means the end of the code and is used to separate
1.3 Semicolon
syntaxes when multiple syntaxes are used in a line.
This function is used to express the data value and can consist of
1.4 Variable name letters, numbers, and underscores (_). (The first character cannot be
a number.)
1.7 list This function lists the result values and recognizes the sequence.
This function lists the result values in list form but does not
1.8 set
recognize the sequence.
1.10 dictionary This function specifies the keys and values and lists the values.
1.19 generator This function is used to generate an iterator using a “yield” syntax
This function is a conditional function that can use “elif” and “else”
1.20
If according to whether the condition of the “if” syntax is true or false.
The “else” block is executed when the loop is executed until the end
1.25 Else in a loop without being terminated by the “break” function in the middle of
executing a loop.
Motion-related Commands
No. Function Description
posj(q1=0, q2=0,
2.1 q3=0, q4=0, q5=0, This function designates the joint space angle in coordinate values.
q6=0)
2.2 posx(x=0, y=0, z=0, This function designates the task space in coordinate values.
w=0, p=0, r=0)
11
No. Function Description
among 8 joints.
addto(pos, This function creates a new posj object by adding add_val to each
2.7
add_val=None) joint value of posj.
This function sets the global velocity in joint motion (movej, movejx,
2.8
set_velj(vel) amovej, or amovejx) after using this command.
This function sets the global velocity in joint motion (movej, movejx,
2.9
set_accj(acc) amovej, or amovejx) after using this command.
2.10 This function sets the velocity of the task space motion globally.
set_velx(vel1, vel2)
2.11 set_accx(acc1, acc2) This function sets the acceleration of the task space motion globally.
This function calls the name of the TCP registered in the Teach
2.12 set_accx(acc)
Pendant and sets it as the current TCP.
The robot moves to the target joint position (pos) from the current
2.14 movej
joint position.
The robot moves along the straight line to the target position (pos)
2.15 movel
within the task space.
2.16 movejx The robot moves to the target position (pos) within the joint space.
The robot moves along an arc to the target pos (pos2) via a
2.17 movec waypoint (pos1) or to a specified angle from the current position in
the task space.
The robot moves along a spline curve path that connects the
2.18 movesj current position to the target position (the last waypoint in pos_list)
via the waypoints of the joint space input in pos_list.
The robot moves along a spline curve path that connects the
2.19 movesx current position to the target position (the last waypoint in pos_list)
via the waypoints of the task space input in pos_list.
This function takes a list that has one or more path segments (line
2.20 moveb or circle) as arguments and moves at a constant velocity by
blending each segment into the specified radius.
This function performs the cyclic motion based on the sine function
2.22 move_periodic
of each axis (parallel and rotation) of the reference coordinate (ref)
This function sets the waiting time between the previous motion
2.32 mwait(time=0)
command and the motion command in the next line.
2.35 check_motion() This function checks the status of the currently active motion.
This function stops the currently active motion. This function stops
differently according to the st_mode received as an argument. All
2.36 stop(st_mode)
stop modes except Estop stop the motion in the currently active
section.
change_operation_spe
2.37 This function adjusts the operation velocity.
ed(speed)
13
Auxiliary Control Commands
No. Function Description
3.5 get_desired_posj() This function returns the current target joint angle.
3.6 get_desired_velj() This function returns the current target joint velocity.
3.8 get_current_tool_flange_posx() This function returns the pose of the current tool flange.
3.10 get_desired_posx(ref) This function returns the target pose of the current tool.
3.11 get_desired_velx() This function returns the target velocity of the current tool.
3.12 get_current_solution_space() This function returns the current solution space value.
get_orientation_error(xd, xc, This function returns the orientation error value between
3.18
axis) the arbitrary poses xd and xc of the axis.
set_workpiece_weight(w This function sets the weight and the center of gravity of the
4.3
eight, cog) workpiece.
4.4 get_workpiece_weight() This function measures and returns the weight of the workpiece.
reset_workpiece_weight This function initializes the weight data of the material to initialize
4.5
() the algorithm before measuring the weight of the material.
This function estimates and returns the weight and the center of
4.6 estimate_load()
gravity at the edge of the flange.
15
Force/Stiffness Control and Other User-Friendly Features
No. Function Description
The user can set the new rectangular coordinate system using
5.9 set_user_cart_coord
x1, x2, and x3.
The user can set the new rectangular coordinate system using
5.10 set_user_cart_coord
u1 and v1.
This function sets the force control target value, force control
5.11 set_desired_force
direction, force target value, and variation time.
5.13 check_position_condition This function checks the status of the given position.
5.16 check_orientation_condition This function checks the difference between the current pose
17
System Commands
No. Function Description
set_digital_output(index, val This function sends a signal at the digital contact point of
6.1.1
=None) the controller.
wait_digital_input(index, val, This function waits until the signal value of the digital input
6.1.7
timeout=None) register of the controller becomes val (ON or OFF).
set_tool_digital_output(index, This function sends the signal of the robot tool from the
6.1.8
val=None) digital contact point.
This function sends the signal of the robot tool from the
set_tool_digital_outputs(bit_list
6.1.9 digital contact point. The digital signals of the contact
)
points defined in bit_list are output at one.
This function sends the signal of the robot tool from the
set_tool_digital_outputs(bit_sta digital contact point. The multiple signals from the first
6.1.10
rt, bit_end, val) contact point (bit_start) to the last contact point (bit_end)
are output at one.
This function reads the signal of the robot tool from the
6.1.11 get_tool_digital_input(index)
digital contact point.
This function reads the signal of the robot tool from the
6.1.12 get_tool_digital_inputs(bit_list) digital contact point. The digital signals of the contact
points defined in bit_list are input at one.
This function reads the signal of the robot tool from the
get_tool_digital_inputs(bit_start digital contact point. The multiple signals from the first
6.1.13
, bit_end) contact point (start_index) to the last contact point
(end_index) are input at one.
wait_tool_digital_input(index, This function waits until the digital input signal value of the
6.1.14
val, timeout=None) robot tool becomes val (ON or OFF).
set_mode_analog_output(ch, This function sets the channel mode of the controller analog
6.1.15
mod ) output.
set_mode_analog_input(ch, This function sets the channel mode of the controller analog
6.1.16
mod ) input.
6.1.20 del_modbus_signal (name) This function deletes the registered Modbus signal.
6.1.23 get_modbus_input(iobus) This function reads the signal from the Modbus system.
wait_modbus_input(iobus, val, This function waits until the specified signal contact point
6.1.25
timeout=None) value of the Modbus digital I/O becomes val (ON or OFF).
tp_get_user_input(message, This function receives the user input data through the Teach
6.2.4
input_type) Pendant.
19
No. Function Description
7.4 asin(x) This function returns the arc sine value of x radians.
7.5 acos(x) This function returns the arc cosine value of x radians.
7.6 atan(x) This function returns the arc tangent value of x radians.
7.7 atan2(y, x) This function returns the arc tangent value of y/x radians.
21
No. Function Description
rotation matrix.
7.31 subtract_pose(posx1,posx2) This function obtains the difference between two poses.
serial_open(port=None,
baudrate=115200,
8.1.1 bytesize=DR_EIGHTBITS, This function opens a serial communication port.
parity=DR_PARITY_NONE,
stopbits=DR_STOPBITS_ONE)
serial_set_inter_byte_timeout(s This function sets the timeout between the bytes (inter-
8.1.4
er, timeout=None) byte) when reading and writing to the port.
serial_set_inter_byte_timeout(ser
8.1.5 This function records the data (tx_data) to a serial port.
, timeout=None)
serial_read(ser, length=-1,
8.1.6 This function reads the data from a serial port.
timeout=-1)
client_socket_write(sock,
8.2.4 This function transmits data to the server.
tx_data)
client_socket_read(sock,
8.2.5 This function reads data from the server.
length=-1, timeout=-1)
server_socket_write(sock,
8.3.4 This function transmits data to the client.
tx_data)
server_socket_read(sock,
8.3.5 This function reads data from the client.
length=-1, timeout=-1)
23
Indent
Example
1.1.1.3
1.1.1.4 Example)
1.1.1.5 if x == 3:
1.1.1.6 y += 1
1.2 Comment
Features
This function is used to provide an additional description of the code. The comments do not
affect the source code since they are excluded from code processing.
A statement following “#” is recognized as a comment. A block that begins with ’’’ and ends
with ’’’ is recognized as a comment.
Example
1.1.1.8 ’’’
’’’
1.3 Semicolon
Features
• This function means the end of the code and is used to separate syntaxes when multiple sy
ntaxes are used in a line.
• No syntax error occurs if a statement is not completed even when it is not indented.
Example
a = 1; b = 2
a = (1 +
2)
Example
friend = 10
Friend = 1
_myFriend = None
Example
1.1.1.10 10, 0x10, 0o10, 0b10
x = 3-4j
25
Character
1.6 Character
1.6.1 String
Features
All character strings are in Unicode.
Example
"string1"
‘string1’
Example
1.6.3 +, *
Example
"py"+ "tyon" "python"
"py"* 3 "pypypy"
Example
"python" [0] "p"
"python" [1:4] "yth"
1.7 list
Features
• The items in a list can be changed and ordered.
Example
colors = ["red", "green", "blue"]
numbers = [1, 3, 5, 7, 9]
1.8 set
Features
• This function lists the result values in list form but does not recognize the sequence.
Example
colors = {"red", "green", "blue"}
numbers = {1, 3, 5, 7, 9}
1.9 tuple
Features
This function is similar to a list but is faster at processing since it is read-only.
Example
colors = ("red", "green", "blue")
numbers = (1, 3, 5, 7, 9)
27
dictionary
1.10 dictionary
Features
This function specifies the keys and values and lists the values.
d = dict(a = 1, b = 3, c = 5)
colors["cherry"] = "red"
1.11 Function
Features
• Declaration: A function begins with def and ends with colon (:).
• An error occurs if the function name is the same as a reserved word or interpreter internal
function name.
To avoid this, use the function name as using the prefix "fn_", if possible.
• The interface and implementation are not separated. However, they must have been defined
before they are used.
Example)
def Times(a, b):
return a * b
Times(10, 10)
- Built-in scope: The domain related to the contents defined by Python and an internal do
main
- LGB rule: The order of finding a variable name. local global built-in
fn_Times(5)
fn_Times(a=5, b=5)
def fn_myUnion(*ar)
…….
29
lambda
1.14 lambda
Features
This function indicates a one-line function without a name.
Example
lambda parameter: <syntax>
Example)
g = lambda x, y : x * y
g(2, 3)
1.15 pass
Features
This function is used when an operation is not executed.
Example
while True:
pass
1.16 __doc__
Features
This function is used when an additional description of a function is needed.
Example
myFunc.__doc__ = "description…"
1.17 help()
Features
This function is used to describe a function.
Example
help(myFunc)
1.18 iterator
Features
This function provides a way to access the elements of a cyclic object in order.
Example
s = "abc"
it = iter(s)
next(it)
…
1.19 generator
Features
This function is used to generate an iterator using a yield syntax instead of a function return.
Example
def fn_everse(data):
for index in range(len(data) -1, -1, -1):
yield data[index]
31
If
1.20 If
Features
This function is a conditional function that can use “elif” and “else” according to whether the
condition of the “if” syntax is true or false.
Example - if
if <conditional statement>:
<syntax>
1.21 While
Features
This function is a conditional function that repeats an operation according to whether the con
dition is true or false.
Example
while <conditional statement>:
<syntax>
1.22 for
Features
This function repeats an operation within the specified repeating “range”.
Example
for <item> in <sequential object S>:
<syntax>
1.23 break
Features
This function exits the internal block of a loop.
Example
while True:
x = x + 1
if x > 10:
break
1.24 continue
Features
This function stops further executing the internal block of a loop and returns to the beginning
point of the loop.
Example
while True:
x = x + 1
if x > 10:
continue
y += 100
33
Else in a loop
Example
L = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
for i in L:
if i % 2 == 0:
continue
else:
print("exit without break")
2. Motion-related Commands
2.1 posj(q1=0, q2=0, q3=0, q4=0, q5=0, q6=0)
Features
This function designates the joint space angle in coordinate values.
Parameters
Default
No. Data Type Description
Value
Return
posj
Exception
Exception Description
Example
q1 = posj() # q1=posj(0,0,0,0,0,0)
q2 = posj(0, 0, 90, 0, 90, 0)
q3 = posj([0, 30, 60, 0, 90, 0]) # q3=posj(0,30,60,0,90,0)
Related commands
movej()/amovej()/movesj()/amovesj()
35
posx(x=0, y=0, z=0, w=0, p=0, r=0)
Parameters
Parameter Default
Data Type Description
Name Value
float z position or
x list 0 position list or
posx posx
y float 0 y position
z float 0 z position
Return
posx
Exception
Exception Description
Example
movej([0,0,90,0,90,0], v=10, a=20)
x2 = posx(400, 300, 500, 0, 180, 0)
x3 = posx([350, 350, 450, 0, 180, 0]) #x3=posx(350, 350, 450, 0, 180, 0)
x4 = posx(x2) #x4=posx(400, 300, 500, 0, 180, 0)
movel(x2, v=100, a=200)
Related commands
movel()/movec()/movejx()/amovel()/amovec()/amovejx()
• Ref refers to the reference coordinate system of pos and delta, and the reference coordinate
system of output is always the base coordinate.
• However, pos is the base coordinate if the reference coordinate system is the tool coordinat
e.
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
pos -
list (float[6]) position list
posx posx or
delta -
list (float[6]) position list
reference coordinate
DR_BASE : base coordinate
ref int None
DR_TOOL : tool coordinate
user coordinate: user defined
Return
Value Description
Exception
Exception Description
37
trans(pos, delta, ref)
Example
x1 = posx(200, 200, 200, 0, 180, 0)
delta = [100, 100, 100, 0, 0, 0]
x2 = trans(x1, delta, DR_BASE) #x2=posx(300,300,300,0,1
80,0)
uu1 = [-1, 1, 0]
vv1 = [1, 1, 0]
pos = posx(100, 0, 0, 0, 0, 0)
DR_userTC1 = set_user_cart_coord(uu1, vv1, pos) #user defined coordinate system
x1_userTC1 = posx(30, 20, 100, 0, 180, 0) #posx on user coordinate
system
x9 = trans(x1_ userTC1, [0, 0, 50, 0, 0, 0], DR_userTC1)
#x9=posx(92.93,35.36,-150,135,0,-180)
movel(x9, ref=DR_BASE)
Related commands
posx()/addto()
• Only posx1 is inputted if seg_type is a line (DR_LINE), and posx2 is also inputted if seg_type
is a circle (DR_CIRCLE). Radius sets the blending radius with the continued segment.
Parameters
Parameter Default
Data Type Description
Name Value
DR_LINE
seg_type Int -
DR_CIRCLE
Return
posb
Exception
Exception Description
39
posb(seg_type, posx1, posx2=None, radius=0)
Example
q0 = posj(0, 0, 90, 0, 90, 0)
movej(q0,vel=30,acc=60)
x0 = posx(564, 34, 690, 0, 180, 0)
movel(x0, vel=200, acc=400) # Moves to the start position.
# If not 0, it is processed as 0.
Related commands
posx()/moveb()/amoveb()
2.5 fkin(pos)
Features
This function receives the input data of points or equivalent forms (float[6]) in joint
space and returns the coordinates of the TCP (objects in the task space).
Parameters
Parameter Default
Data Type Description
Name Value
posj posj or
pos -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
Example
q1 = posj(0, 0, 90, 0, 90, 0)
movej(q1,v=10,a=20)
q2 = posj(30, 0, 90, 0, 90, 0)
x2 = fkin(q2) # x2: Space coordinate at the edge of the robot (TC
P) corresponding to joint value q2
movel(x2,v=100,a=200) # Linear motion to x2
Related commands
set_tcp() # The tcp data of the name registered in the teach pendant
(TP) is reflected during an fkin operation.
posj()/posx()
41
ikin(pos, sol_space)
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
pos -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
Example
x1 = posx(370.9, 719.7, 651.5, 90, -180, 0)
q1 = ikin(x1, 2) # Joint angle q1 where the coordinate of the robot edg
e is x1 (second of 8 cases)
# q1=posj(60.3, 81.0, -60.4, -0.0, 159.4, -29.7) (M1013, tcp=(0,0,
0))
movej(q1,v=10,a=20)
Related commands
set_tcp()/posj()/posx()
43
addto(pos, add_val=None)
Parameters
Parameter Default
Data Type Description
Name Value
posj posj or
pos -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
Example
q1 = posj(10, 20, 30, 40, 50, 60)
movej (q1, v=10, a=20)
q2 = addto(q1, [0, 0, 0, 0, 45, 0])
movej (q2, v=10, a=20) # The robot moves to the joint (10, 20, 30, 40, 9
5, 60).
q3 = addto(q2, [])
q4 = addto(q3)
Related commands
posj()
2.8 set_velj(vel)
Features
This function sets the global velocity in joint motion (movej, movejx, amovej, or am
ovejx) after using this command. The default velocity is applied to the globally set
vel if movej() is called without the explicit input of the velocity argument.
Parameters
Parameter Default
Data Type Description
Name Value
float velocity (same to all axes) or
vel -
list (float[6]) velocity (to an axis)
Return
Value Description
0 Success
Exception
Exception Description
Example
#1
Q1 = posj(0,0,90,0,90,0)
Q2 = posj(0,0,0,0,90,0)
movej(Q1, vel=10, acc=20)
set_velj(30) # The global joint velocity is set to 30 (deg/sec).
set_accj(60) # The global joint acceleration is set to 60 (deg/sec2). [See set_accj().]
movej(Q2) # The joint motion velocity to Q2 is 30 (deg/sec) which is the global vel
ocity.
movej(Q1, vel=20, acc=40) # The joint motion velocity to Q1 is 20 (deg/sec) whic
h is the specified velocity.
#2
set_velj(20.5) # Decimal point input is possible.
set_velj([10, 10, 20, 20, 30, 10]) # The global velocity can be specified to each axis.
Related commands
set_accx()/movej()/movejx()/movesj()amovej()/amovejx()/amovesj()
45
set_accj(acc)
2.9 set_accj(acc)
Features
This function sets the global velocity in joint motion (movej, movejx, amovej, or am
ovejx) after using this command. The globally set acceleration is applied as the def
ault acceleration if movej() is called without the explicit input of the acceleration ar
gument.
Parameters
Parameter Default
Data Type Description
Name Value
float acceleration (same to all axes) or
acc -
list (float[6]) acceleration (acceleration to an axis)
Return
Value Description
0 Success
Exception
Exception Description
Example
#1
Q1 = posj(0,0,90,0,90,0)
Q2 = posj(0,0,0,0,90,0)
movej(Q1, vel=10, acc=20)
set_velj(30) # The global joint velocity is set to 30 (deg/sec). [See set_velj().]
set_accj(60) # The global joint acceleration is set to 60 (deg/sec 2).
movej(Q2) # The joint motion acceleration to Q2 is 60(deg/sec2) which is the global acceleration.
movej(Q1, vel=20, acc=40) # The joint motion acceleration to Q1 is 40(deg/sec 2) which is the specifie
d acceleration.
#2
set_accj(30.55)
Related commands
set_velj()/movej()/movejx()/movesj()/amovej()/amovejx()amovesj()
Parameters
Parameter Default
Data Type Description
Name Value
vel1 float - velocity 1
Return
Value Description
0 Success
Exception
Exception Description
Example
<#1>
P0 = posj(0,0,90,0,90,0)
movej(P0)
P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
movel(P1, vel=10, acc=20)
set_velx(30,20) # The global task velocity is set to 30(mm/sec) and 20(deg/sec).
set_accx(60,40) # The global task acceleration is set to 60(mm/sec 2) and 40(de
g/sec2).
movel(P2) # The task motion velocity to P2 is 30(mm/sec) a
nd 20(deg/sec) which are the global velocity.
movel(P1, vel=20, acc=40) # The task motion velocity to P1 is 20(mm/sec) a
47
set_velx(vel1, vel2)
Related commands
set_accx()/movel()/movec()/movesx()/moveb()/move_spiral()/amovel()/amovec()/
amovesx()/amoveb()/amove_spiral()
2.11 set_velx(vel)
Features
This function sets the linear velocity of the task space motion globally. The globally
set velocity vel is applied as the default velocity if the task motion such as movel
(), amovel(), movec(), movesx() is called without the explicit input of the velocity val
ue. The set value vel defines the linear velocity of the TCP while the rotating veloci
ty of the TCP is determined proportionally to the linear velocity.
Parameters
Parameter Default
Data Type Description
Name Value
vel float - velocity
Return
Value Description
0 Success
Exception
Exception Description
Example
#1
p0 = posj(0,0,90,0,90,0)
movej(p0)
P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
movel(P1, vel=10, acc=20)
set_velx(30) # The global task velocity is set to 30 (mm/sec). The global task
angular velocity is automatically determined.
set_accx(60) # The global task acceleration is set to 60 (mm/sec 2). The global t
ask angular acceleration is automatically determined.
movel(P2) # The task motion linear velocity to P2 is 30(mm/sec) which is the
global velocity.
49
set_velx(vel)
Related commands
set_accx()/movel()/movec()/movesx()/moveb()/move_spiral()/amovel()/amovec()/
amovesx()/amoveb()/amove_spiral()
Parameters
Parameter Default
Data Type Description
Name Value
acc1 float - acceleration 1
Return
Value Description
0 Success
Exception
Exception Description
Example
P0 = posj(0,0,90,0,90,0)
movej(P0)
P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
movel(P1, vel=10, acc=20)
set_velx(30,20) # The global task velocity is set to 30(mm/sec) and 20(deg/sec).
set_accx(60,40) # The global task acceleration is set to 60(mm/sec 2) and 40(deg
/sec2).
movel(P2) # The task motion acceleration to P2 is 60(mm/sec 2) and 40(deg/s
ec2) which is the global acceleration.
movel(P1, vel=20, acc=40) # The task motion acceleration to P1 is 40(mm/se
c) and 40(deg/sec2) which is the specified acceleration.
51
set_accx(acc1, acc2)
Related commands
set_velx()/movel()/movec()movesx()/moveb()/move_spiral()/amovel()/amovec()/amov
esx()/amoveb()/amove_spiral()
2.13 set_accx(acc)
Features
This function sets the linear acceleration of the task space motion globally. The glo
bally set acceleration acc is applied as the default acceleration if the task motion s
uch as movel(), amovel(), movec(), movesx() is called without the explicit input of th
e acceleration value. The set value acc defines the linear acceleration of the TCP wh
ile the rotating acceleration of the TCP is determined proportionally to the linear ac
celeration.
Parameters
Parameter Default
Data Type Description
Name Value
acc float - acceleration
Return
Value Description
0 Success
Exception
Exception Description
Example
P0 = posj(0,0,90,0,90,0)
movej(P0)
P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
movej(P0, vel=10, acc=20)
movel(P1, vel=10, acc=20)
set_velx(30) # The global task velocity is set to 30 (mm/sec). The global task angular velocity is
automatically determined.
set_accx(60) # The global task acceleration is set to 60 (mm/sec2). The global task angular accel
eration is automatically determined.
movel(P2) # The task motion linear acceleration to P2 is 60(mm/sec 2) which is the global acc
eleration.
movel(P1, vel=20, acc=40) # The task motion linear acceleration to P1 is 40(mm/sec2) which is the
specified acceleration.
53
set_accx(acc)
Related commands
set_velx()/movel()/movec()movesx()/moveb()/move_spiral()/amovel()/amovec()/amov
esx()/amoveb()/amove_spiral()
2.14 set_tcp(name)
Features
This function calls the name of the TCP registered in the Teach Pendant and sets it
as the current TCP.
Parameters
Parameter Default
Data Type Description
Name Value
name string - Name of the TCP registered in the TP.
Return
Value Description
0 Success
Exception
Exception Description
Example
P0 = posj(0,0,90,0,90,0)
movej(P0)
set_tcp("tcp1") # The TCP data registered as tcp1 in the TP is called and set to t
he current TCP value.
P1 = posx(400,500,800,0,180,0)
movel(P1, vel=10, acc=20) # Moves the recognized center of the tool to the
P1 position.
Related commands
fkin()/ikin()/movel()/movejx()/movec()/movesx()/moveb()/amovel()/amovejx()/
amovec()/amovesx()/amoveb()
55
set_ref_coord(coord)
2.15 set_ref_coord(coord)
Features
This function sets the reference coordinate system.
Parameters
Parameter Default
Data Type Description
Name Value
Reference coordinate system
DR_BASE: Base Coordinate
coord int -
DR_TOOL: Tool Coordinate
user Coordinate: User defined
Return
Value Description
0 Success
Exception
Exception Description
Example
p0 = posj(0,0,90,0,90,0)
movej(p0, v=30, a=30)
x1 = posx(370.9, 419.7, 651.5, 90,-180,0)
movel(x1, v=100, a=100) # Base Coordinate basis
uu1 = [-1, 1, 0] # x-axis vector of the user coordinate system (base coordi
nate basis)
vv1 = [1, 1, 0] # y-axis vector of the user coordinate system (base coordi
nate basis)
pos = posx(370.9, -419.7, 651.5, 0, 0, 0) # Origin point of the user coordinate s
ystem
DR_USER1 = set_user_cart_coord(uu1, vv1, pos) # Sets the user coordinate syst
em.
set_ref_coord(DR_USER1) # Sets DR_USER1 of the user coordinate system t
o the global coordinate system.
movel([0,0,0,0,0,0],v=100,a=100) # The global coordinate system is used if the ref
erence coordinate system is not specified.
# Moves to the origin point and direction of the
DR_USER1 coordinate system.
movel([0,200,0,0,0,0],v=100,a=100) # Moves to the (0,200,0) point of the DR_USE
R1 coordinate system.
Related commands
fkin()/ikin()/movel()/movejx()/movec()/movesx()/moveb()/amovel()/amovejx()/
amovec()/amovesx()/amoveb()
57
movej
2.16 movej
Features
The robot moves to the target joint position (pos) from the current joint position.
Parameters
Parameter
Data Type Default Value Description
Name
posj posj or
pos -
list (float[6]) joint angle list
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
Caution
Return
Value Description
0 Success
59
movej
Exception
Exception Description
Example
Q1 = posj(0,0,90,0,90,0)
Q2 = posj(0,0,0,0,90,0)
movej(Q1, vel=10, acc=20)
# Moves to the Q1 joint angle at the velocity of 10(deg/sec) and accele
ration of 20(deg/sec2).
movej(Q2, time=5)
# Moves to the Q2 joint angle with a reach time of 5 sec.
movej(Q1, v=30, a=60, r=200)
# Moves to the Q1 joint angle and is set to execute the next motion
# when the distance from the Q1 space position is 200mm.
movej(Q2, v=30, a=60, ra= DR_MV_RA_OVERRIDE)
# Immediately terminates the last motion and blends it to move to the Q
2 joint angle.
Related commands
posj()/set_velj()/set_accj()/amovej()
2.17 movel
Features
The robot moves along the straight line to the target position (pos) within the task space.
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
pos -
list (float[6]) position list
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
61
movel
_global_accx is applied if acc is None. (The initial value of _global_accx is 0.0 and can be set
by set_accx.)
If an argument is inputted to vel (e.g., vel=30), the input argument corresponds to the linear
velocity of the motion while the angular velocity is determined proportionally to the linear
velocity.
If an argument is inputted to acc (e.g., acc=60), the input argument corresponds to the linear
acceleration of the motion while the angular acceleration is determined proportionally to the
linear acceleration.
If the time is specified, values are processed based on time, ignoring vel and acc.
If the time is None, it is set to 0.
If the radius is None, it is set to the blending radius in the blending section and 0 otherwise.
_g_coord is applied if the ref is None. (The initial value of _g_coord is DR_BASE, and it can be
set by the set_ref_coord command.)
Caution
Return
Value Description
0 Success
Exception
Exception Description
63
movel
Example
P0 = posj(0,0,90,0,90,0)
movej(P0, v=30, a=30)
P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
P3 = posx(30,30,30,0,0,0)
movel(P1, vel=30, acc=100)
# Moves to the P1 position with a velocity of 30(mm/sec) and acceleratio
n of 100(mm/sec2).
movel(P2, time=5)
# Moves to the P2 position with a reach time of 5 sec.
movel(P3, time=5, ref=DR_TOOL, mod=DR_MV_MOD_REL)
# Moves the robot from the start position to the relative position of P3 i
n the tool coordinate system
# with a reach time of 5 sec.
movel(P2, time=5, r=10)
# Moves the robot to the P2 position with a reach time of 5 seconds,
# and the next motion is executed when the distance from the P2 positio
n is 10mm.
Related commands
posx()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/amovel()
2.18 movejx
Features
The robot moves to the target position (pos) within the joint space.
Since the target position is inputted as a posx form in the task space, it moves in the same
way as movel. However, since this robot motion is performed in the joint space, it does not g
uarantee a linear path to the target position. In addition, one of 8 types of joint combination
(robot configurations) corresponding to the task space coordinate system (posx) must be speci
fied in sol (solution space).
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
pos -
list (float[6]) position list
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
65
movejx
Note
Return
Value Description
0 Success
Exception
Exception Description
Example
P0 = posj(0,0,90,0,90,0)
movej(P0, v=30, a=30)
P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
movel(P2, vel=100, acc=200) # Linear movement to P2
X_tmp, sol_init = get_current_posx() # Obtains the current solution space from the P2 p
osition
movejx(P1, vel=30, acc=60, sol=sol_init)
# Moves to the joint angle with a velocity and acceleration of 30(deg/sec) and 60
(deg/sec2), respectively,
# when the TCP edge is the P1 position (maintaining the solution space in the las
t P2 position)
movejx(P2, time=5, sol=2)
# Moves to the joint angle with a reach time of 5 sec when the TCP edge is at t
he P2 position
# (forcefully sets a solution space to 2)
movejx(P1, vel=[10, 20, 30, 40, 50, 60], acc=[20, 20, 30, 30, 40, 40], radius=100, sol=2)
# Moves the robot to the joint angle when the TCP edge is at the P1 position,
# and the next motion is executed when the distance from the P2 position is 100
mm.
movejx(P2, v=30, a=60, ra= DR_MV_RA_OVERRIDE, sol=2)
# Immediately terminates the last motion and blends it to move to the joint angle
# when the TCP edge is at the P2 position.
Related commands
posx()/set_velj()/set_accj()/get_current_posx()/amovejx()
67
movec
2.19 movec
Features
The robot moves along an arc to the target pos (pos2) via a waypoint (pos1) or to a specifie
d angle from the current position in the task space.
Parameters
Parameter
Data Type Default Value Description
Name
posj posx or
pos -
list (float[6]) position list
posx posx or
pos2
list (float[6] position list
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
float angle or
angle (an) None
list (float[2]) angle1, angle2
Note
Abbreviated parameter names are supported. (v:vel, a:acc, t:time, r:radius, angle:an)
_global_velx is applied if vel is None. (The initial value of _global_velx is 0.0 and can be set by
set_velx.)
_global_accx is applied if acc is None. (The initial value of _global_accx is 0.0 and can be set
by set_accx.)
If an argument is inputted to vel (e.g., vel=30), the input argument corresponds to the linear
velocity of the motion while the angular velocity is determined proportionally to the linear
velocity.
If an argument is inputted to acc (e.g., acc=60), the input argument corresponds to the linear
acceleration of the motion while the angular acceleration is determined proportionally to the
linear acceleration.
If the time is specified, values are processed based on time, ignoring vel and acc.
If the time is None, it is set to 0.
If the radius is None, it is set to the blending radius in the blending section and 0 otherwise.
_g_coord is applied if the ref is None. (The initial value of _g_coord is DR_BASE, and it can be
set by the set_ref_coord command.)
If the mod is DR_MV_MOD_REL, pos1 and pos2 are defined in the relative coordinate system
of the previous pos. (pos1 is the relative coordinate from the starting point while pos2 is the
relative coordinate from pos1.)
If the angle is None, it is set to 0.
If only one angle is inputted, the total rotated angle on the circular path is applied to the
angle.
If two angle values are inputted, angle1 refers to the total rotating angle moving at a
constant velocity on the circular path while angle2 refers to the rotating angle in the rotating
section for acceleration and deceleration. In that case, the total moving angle angle1 + 2 X
angle2 moves along the circular path.
Caution
69
movec
Return
Value Description
0 Success
Exception
Exception Description
Example
#1
P0 = posj(0,0,90,0,90,0)
movej(P0)
set_velx(30,20) # Set the global task velocity to 30(mm/sec) and 20(deg/sec).
set_accx(60,40) # Set the global task acceleration to 60(mm/sec2) and 40(deg/sec2).
P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
P3 = posx(100, 300, 700, 45, 0, 0)
P4 = posx(500, 400, 800, 45, 45, 0)
Related commands
posx()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/amovec()
71
movesj
2.20 movesj
Features
The robot moves along a spline curve path that connects the current position to the target p
osition (the last waypoint in pos_list) via the waypoints of the joint space input in pos_list.
The input velocity/acceleration means the maximum velocity/acceleration in the path, and the
acceleration and deceleration during the motion are determined according to the position of t
he waypoint.
Parameters
Parameter
Data Type Default Value Description
Name
pos_list list (posj) - posj list
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
Return
Value Description
0 Success
Exception
Exception Description
Example
#CASE 1) Absolute angle input (mod= DR_MV_MOD_ABS)
q0 = posj(0,0,0,0,0,0)
movej(q0, vel=30, acc=60) # Moves in joint motion to the initial position (q
0).
q1 = posj(10, -10, 20, -30, 10, 20) # Defines the posj variable (joint angle) q
1.
q2 = posj(25, 0, 10, -50, 20, 40)
q3 = posj(50, 50, 50, 50, 50, 50)
q4 = posj(30, 10, 30, -20, 10, 60)
q5 = posj(20, 20, 40, 20, 0, 90)
qlist = [q1, q2, q3, q4, q5] # Defines the list (qlist) which is a set of q1-q5 a
s the waypoints.
73
movesj
Related commands
posj()/set_velj()/set_accj()/amovesj()
2.21 movesx
Features
The robot moves along a spline curve path that connects the current position to the target p
osition (the last waypoint in pos_list) via the waypoints of the task space input in pos_list.
The input velocity/acceleration means the maximum velocity/acceleration in the path and the c
onstant velocity motion is performed with the input velocity according to the condition if the
option for the constant speed motion is selected.
Parameters
Parameter
Data Type Default Value Description
Name
pos_list list (posx) - posx list
float velocity or
vel (v) None
list (float[2]) velocity1, velocity2
float acceleration or
acc (a) None
list (float[2]) acceleration1, acceleration2
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Velocity option
DR_MVS_VEL_NONE: None
vel_opt int DR_MVS_VEL_NONE
DR_MVS_VEL_CONST: Constant
velocity
75
movesx
Note
Caution
The constant velocity motion according to the distance and velocity between the waypoints
cannot be used if the “vel_opt= DR_MVS_VEL_CONST” option (constant velocity option) is
selected, and the motion is automatically switched to the variable velocity motion (vel_opt=
DR_MVS_VEL_NONE) in that case.
Return
Value Description
0 Success
Exception
Exception Description
Exception Description
Example
#CASE 1) Absolute coordinate input (mod= DR_MV_MOD_ABS)
P0 = posj(0,0,90,0,90,0)
movej(P0, v=30, a=30)
x0 = posx(600, 43, 500, 0, 180, 0) # Defines the posx variable (space coordi
nate/pose) x0.
movel(x0, vel=100, acc=200) # Linear movement to the initial position x0
x1 = posx(600, 600, 600, 0, 175, 0) # Defines the posx variable (space coordi
nate/pose) x1.
x2 = posx(600, 750, 600, 0, 175, 0)
x3 = posx(150, 600, 450, 0, 175, 0)
x4 = posx(-300, 300, 300, 0, 175, 0)
x5 = posx(-200, 700, 500, 0, 175, 0)
x6 = posx(600, 600, 400, 0, 175, 0)
xlist = [x1, x2, x3, x5, x6] # Defines the list (xlist) which is a set of x1-x6 as
the waypoints.
77
movesx
movej(P0)
x0 = posx(600, 43, 500, 0, 180, 0) # Defines the posx variable (space coordi
nate/pose) x0.
movel(x0, vel=100, acc=200) # Linear movement to the initial position x0
dx1 = posx(0, 557, 100, 0, -5, 0)
# Definition of relative coordinate dx1 to x0 (Homogeneous transformati
on of dx1 based in x1= x0)
dx2 = posx(0, 150, 0, 0, 0, 0)
# Definition of relative coordinate dx2 to x1 (Homogeneous transformation
of dx2 based in x2= x1)
dx3 = posx(-450, -150, -150, 0, 0, 0)
# Definition of relative coordinate dx3 to x2 (Homogeneous transformation
of dx3 based in x3= x2)
dx4 = posx(-450, -300, -150, 0, 0, 0)
# Definition of relative coordinate dx4 to x3 (Homogeneous transformation
of dx4 based in x4= x3)
dx5 = posx(100, 400, 200, 0, 0, 0)
# Definition of relative coordinate dx5 to x4 (Homogeneous transformation
of dx5 based in x5= x4)
dx6 = posx(800, -100, -100, 0, 0, 0)
# Definition of relative coordinate dx6 to x5 (Homogeneous transformation
of dx6 based in x6= x5)
Related commands
posx()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/amovesx()
79
moveb
2.22 moveb
Features
This function takes a list that has one or more path segments (line or circle) as arguments an
d moves at a constant velocity by blending each segment into the specified radius. Here, the
radius can be set through posb.
Parameters
Parameter
Data Type Default Value Description
Name
pos_list list (posb) - posb list
float velocity or
vel (v) None
list (float[2]) velocity1, velocity2
float acceleration or
acc (a) None
list (float[2]) acceleration1, acceleration2
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
Caution
Return
Value Description
0 Success
Exception
Exception Description
81
moveb
Exception Description
Example
# Init Pose @ Jx1
Jx1 = posj(45,0,90,0,90,45) # initial joint position
X0 = posx(370, 420, 650, 0, 180, 0) # initial task position
# CASE 1) ABSOLUTE
# Absolute Goal Poses
X1 = posx(370, 670, 650, 0, 180, 0)
X1a = posx(370, 670, 400, 0, 180, 0)
X1a2= posx(370, 545, 400, 0, 180, 0)
X1b = posx(370, 595, 400, 0, 180, 0)
X1b2= posx(370, 670, 400, 0, 180, 0)
X1c = posx(370, 420, 150, 0, 180, 0)
X1c2= posx(370, 545, 150, 0, 180, 0)
X1d = posx(370, 670, 275, 0, 180, 0)
X1d2= posx(370, 795, 150, 0, 180, 0)
# CASE 2) RELATIVE
# Relative Goal Poses
dX1 = posx(0, 250, 0, 0, 0, 0)
dX1a = posx(0, 0, -150, 0, 0, 0)
dX1a2= posx(0, -125, 0, 0, 0, 0)
dX1b = posx(0, 50, 0, 0, 0, 0)
dX1b2= posx(0, 75, 0, 0, 0, 0)
dX1c = posx(0, -250, -250, 0, 0, 0)
dX1c2= posx(0, 125, 0, 0, 0, 0)
dX1d = posx(0, 125, 125, 0, 0, 0)
dX1d2= posx(0, 125, -125, 0, 0, 0)
83
moveb
Related commands
posb()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/amoveb()
2.23 move_spiral
Features
The radius increases in a radial direction and the robot moves in parallel with the rotating spi
ral motion in an axial direction. It moves the robot along the spiral trajectory on the surface t
hat is perpendicular to the axis on the coordinate specified as ref and the linear trajectory in
the axis direction.
Parameters
Parameter Default
Data Type Range Description
Name Value
rev float 10 rev > 0 Total number of revolutions
axis
DR_AXIS_X: x-axis
axis int DR_AXIS_Z -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
reference coordinate
DR_BASE : base coordinate
ref Int DR_TOOL -
DR_TOOL : tool coordinate
user coordinate: user defined
85
move_spiral
Note
Caution
An error can be generated to ensure safe motion if the rotating acceleration calculated by
the spiral path is too great.
In this case, reduce the vel, acc, or time value.
Return
Value Description
0 Success
Exception
Exception Description
Example
# hole search
# (A motion that completes 9.5 revolutions (rev) to the 50 mm radius (rmax) fro
m 0 on the Tool-X/Y surface as the center of the rotation in the Tool-Z directio
n and the spiral trajectory that moves 50 mm (lmax) in the Tool-Z direction at t
he same time in 10 seconds from the initial position)
J00 = posj(0,0,90,0,60,0)
movej(J00,vel=30,acc=30) # Joint movement to the initial pose
move_spiral(rev=9.5,rmax=20.0,lmax=50.0,time=20.0,axis=DR_AXIS_Z,ref=DR_TOOL)
tool-Z tool-X
tool- tool-Z
Related commands
set_velx()/set_accx()/set_tcp()/set_ref_coord()/amove_spiral()
87
move_periodic
2.24 move_periodic
Features
This function performs the cyclic motion based on the sine function of each axis (parallel and
rotation) of the reference coordinate (ref) input as a relative motion that begins at the curren
t position. The attributes of the motion on each axis are determined by the amplitude and pe
riod, and the acceleration/deceleration time and the total motion time are set by the interval
and repetition count.
Parameters
Parameter Default
Data Type Range Description
Name Value
list Amplitude (motion between -amp
amp - 0≤amp
(float[6]) and +amp) [mm] or [deg]
float or
period list 0≤period Period (time for 1 cycle) [sec]
(float[6])
reference coordinate
DR_BASE : base coordinate
ref int DR_TOOL -
DR_TOOL : tool coordinate
user coordinate: user defined
Note
Amp refers to the amplitude. The input is a list of 6 elements which are the amp values for
the axes (x, y, z, rx, ry, and rz). The amp input on the axis that does not have a motion must
be 0.
Period refers to the time needed to complete a motion in the direction, the amplitude. The
input is a list of 6 elements which are the periods for the axes (x, y, z, rx, ry, and rz).
Atime refers to the acceleration and deceleration time at the beginning and end of the
periodic motion. The largest of the inputted acceleration/deceleration times and maximum
period*1/4 is applied. An error is generated when the inputted acceleration/deceleration time
exceeds 1/2 of the total motion time.
Repeat refers to the number of repetitions of the axis (reference axis) that has the largest
period value and determines the total motion time. The number of repetitions for each of the
remaining axes is determined automatically according to the motion time.
If the motion terminates normally, the motions for the remaining axes can be terminated
before the reference axis's motion terminates so that the end position matches the starting
position. The deceleration section will deviate from the previous path if the motions of all
axes are not terminated at the same time. Refer to the following image for more information.
89
move_periodic
Return
Value Description
0 Success
Exception
Exception Description
Example
P0 = posj(0,0,90,0,90,0)
movej(P0)
#1
move_periodic(amp =[10,0,0,0,30,0], period=1.0, atime=0.2, repeat=5, ref=DR_TOO
L)
# Repeats the x-axis (10mm amp and 1 sec. period) motion and rotating
y-axis (30deg amp and 1 sec. period) motion in the tool coordinate syste
m
# totally, repeat the motion 5 times.
#2
move_periodic(amp =[10,0,20,0,0.5,0], period=[1,0,1.5,0,0,0], atime=0.5, repeat=3, re
f=DR_BASE)
# Repeats the x-axis (10mm amp and 1 sec. period) motion and z-axis (20
mm amp and 1.5 sec. period) motion in the base coordinate system
# 3 times. The rotating y-axis motion is not performed since its period is
“0”.
# The total motion time is about 5.5 sec. (1.5 sec. * 3 times + 1 sec. for
acceleration/deceleration) since the period of the x-axis motion is greater.
# The x-axis motion is repeated 4.5 times.
Related commands
set_ref_coord()/amove_periodic()
91
amovej
2.25 amovej
Features
The asynchronous movej motion operates in the same way as movej except that it does not
have the radius parameter for blending. The command is the asynchronous motion command,
and the next command is executed at the same time the motion begins.
Note)
• movej(pos): The next command is executed after the robot starts from the current position
and reaches (stops at) pos.
• amovej(pos): The next command is executed regardless of whether the robot starts from the
current position and reaches (stops at) pos.
Parameters
Parameter
Data Type Default Value Description
Name
posj posj or
pos -
list (float[6]) joint angle list
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
Return
Value Description
0 Success
Exception
Exception Description
93
amovej
Example
#Example 1. The robot moves to q1 and stops the motion 3 seconds after it be
gins the motion at q0 and then moves to q99
q0 = posj(0, 0, 90, 0, 90, 0)
amovej (q0, vel=10, acc=20) # Moves to q0 and performs the next command
immediately after
wait(3) # Temporarily suspends the program execution for 3 seconds (whil
e the motion continues).
q1 = posj(0, 0, 0, 0, 90, 0)
amovej (q1, vel=10, acc=20)
# Maintains the q0 motion (DUPLICATE blending if the ra argument is omitted)
and iterates to q1.
# Performs the next command immediately after the blending motion.
mwait(0) # Temporarily suspends the program execution until the motion is
terminated.
q99 = posj(0, 0, 0, 0, 0, 0)
movej (q99, vel=10, acc=20) # Joint motion to q99
Related commands
posj()/set_velj()/set_accj()/mwait()/movej()
2.26 amovel
Features
The asynchronous movel motion operates in the same way as movel except that it does not
have the radius parameter for blending. The command is the asynchronous motion command,
and the next command is executed without waiting for the motion to terminate.
Note)
• movel(pos): The next command is executed after the robot starts from the current position
and reaches (stops at) pos.
• amovel(pos): The next command is executed regardless of whether the robot starts from the
current position and reaches (stops at) pos.
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
pos -
list (float[6]) position list
float velocity or
vel (v) None
list (float[2]) velocity1, velocity2
float acceleration or
acc (a) None
list (float[2]) acceleration1, acceleration2
reference coordinate
DR_BASE : base coordinate
ref int None
DR_TOOL : tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
95
amovel
Parameter
Data Type Default Value Description
Name
DR_MV_RA_OVERRIDE: override
Note
Return
Value Description
0 Success
Exception
Exception Description
Example
#Example 1. D-Out 2 seconds after the motion starts with x1
j0 = posj(-148,-33,-54,180,92,32)
movej(j0, v=30, a=30)
x1 = posx(784, 543, 570, 0, 180, 0)
amovel (x1, vel=100, acc=200) # Performs the next motion immediately after be
ginning a motion with x1.
wait(2) # Temporarily suspends the program execution fo
r 2 seconds (while the motion continues).
set_digital_output(1, 1) # D-Out (no. 1 channel) ON
mwait(0) # Temporarily suspends the program execution u
ntil the motion is terminated.
Related commands
posx()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/mwait()movel()
97
amovejx
2.27 amovejx
Features
The asynchronous movejx motion operates in the same way as movejx except that it does not
have the radius parameter for blending. The command is the asynchronous motion command,
and the next command is executed without waiting for the motion to terminate.
Note)
• movejx(pos): The next command is executed after the robot starts from the current position
and reaches (stops at) pos.
• amovejx(pos): The next command is executed regardless of whether the robot starts from th
e current position and reaches (stops at) pos.
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
pos -
list (float[6]) position list
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
Caution
The blending into current active motion is disabled in the case of input with relative motion
(mod=DR_MV_MOD_REL), and it is recommended to blend using movej() or movel().
Return
Value Description
0 Success
Exception
Exception Description
99
amovejx
Example
#Example 1. D-Out 2 seconds after the joint motion starts with x1
p0 = posj(-148,-33,-54,180,92,32)
movej(p0, v=30, a=30)
x1 = posx(784, 443, 770, 0, 180, 0)
amovejx (x1, vel=100, acc=200, sol=1) # Performs the next motion immediately
after beginning a joint motion with x1.
wait(2) # Temporarily suspends the program execution fo
r 2 seconds (while the motion continues).
set_digital_output(1, 1) # D-Out (no. 1 channel) ON
mwait(0) # Temporarily suspends the program execution u
ntil the motion is terminated.
Related commands
posx()/set_velj()/set_accj()/get_current_posx()/mwait()/movejx()
2.28 amovec
Features
The asynchronous movec motion operates in the same way as movec except that it does not
have the radius parameter for blending. The command is the asynchronous motion command,
and the next command is executed without waiting for the motion to terminate.
Note)
• movec(pos1. pos2): The next command is executed after the robot starts from the current p
osition and reaches (stops at) pos2.
• amovec(pos1. pos2): The next command is executed regardless of whether the robot starts fr
om the current position and reaches (stops at) pos2.
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
pos -
list (float[6]) position list
posx posx or
pos2 -
list (float[6] position list
float velocity or
vel (v) None
list (float[2]) velocity1, velocity2
float acceleration or
acc (a) None
list (float[2]) acceleration1, acceleration2
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
float angle or
angle (an) None
list (float[2]) angle1, angle2
101
amovec
Parameter
Data Type Default Value Description
Name
DR_MV_RA_DUPLICATE: duplicate
DR_MV_RA_OVERRIDE: override
Note
Return
Value Description
0 Success
Exception
Exception Description
Example
#Example 1. D-Out 3 seconds after the arc motion through x1 and x2 begins
p0 = posj(-148,-33,-54,180,92,32)
movej(p0, v=30, a=30)
x1 = posx(784, 443, 770, 0, 180, 0)
amovejx (x1, vel=100, acc=200, sol=2) # Performs the next motion immediately af
ter beginning a joint motion with x1.
wait(2) # Temporarily suspends the program execution for 2 seconds (whil
e the motion continues).
set_digital_output(1, 1) # D-Out (no. 1 channel) ON
mwait(0)
Related commands
posx()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/mwait()/movec()
103
amovesj
2.29 amovesj
Features
The asynchronous movesj motion operates in the same way as movesj() except for the asynchr
onous processing.
Generating a new command for the motion before the amovesj() motion results in an error fo
r safety reasons. Therefore, the termination of the amovesj() motion must be confirmed using
mwait() or check_motion() between amovesj() and the following motion command.
Note)
• movesj(pos_list): The next command is executed after the robot starts from the current positi
on and reaches (stops at) the end point of pos_list.
• amovesj(pos_list): The next command is executed regardless of whether the robot starts from
the current position and reaches (stops at) the end point of pos_list.
Parameters
Parameter
Data Type Default Value Description
Name
pos_list list (posj) - posj list
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
If the mod is DR_MV_MOD_REL, each pos in the pos_list is defined in the relative coordinate
of the previous pos. (If pos_list=[q1, q2, ...,q(n-1), q(n)], q1 is the relative angle of the starting
point while q(n) is the relative coordinate of q(n-1).)
This function does not support online blending of previous and subsequent motions.
Return
Value Description
0 Success
Exception
Exception Description
105
amovesj
Example
#Example 1. D-Out 3 seconds after the spline motion through q1 - q5 begins
q0 = posj(0,0,0,0,0,0)
movej(q0, vel=30, acc=60) # Moves in joint motion to the initial position (q0).
q1 = posj(10, -10, 20, -30, 10, 20) # Defines the posj variable (joint angle) q
1.
q2 = posj(25, 0, 10, -50, 20, 40)
q3 = posj(50, 50, 50, 50, 50, 50)
q4 = posj(30, 10, 30, -20, 10, 60)
q5 = posj(20, 20, 40, 20, 0, 90)
Related commands
posj()/set_velj()/set_accj()/mwait()/amovesj()
2.30 amovesx
Features
The asynchronous movesx motion operates in the same way as movesx() except for the async
hronous processing.
Generating a new command for the motion before the amovesj() motion results in an error fo
r safety reasons. Therefore, the termination of the amovesx() motion must be confirmed using
mwait() or check_motion() between amovesx() and the following motion command.
Note)
• movesx(pos_list): The next command is executed after the robot starts from the current posit
ion and reaches (stops at) the end point of pos_list.
• amovesx(pos_list): The next command is executed regardless of whether the robot starts fro
m the current position and reaches (stops at) the end point of pos_list.
Parameters
Parameter
Data Type Default Value Description
Name
pos_list list (posx) - posx list
float velocity or
vel (v) None
list (float[2]) velocity1, velocity2
float acceleration or
acc (a) None
list (float[2]) acceleration1, acceleration2
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Velocity option
DR_MVS_VEL_NONE: None
vel_opt int DR_MVS_VEL_NONE
DR_MVS_VEL_CONST: Constant
velocity
107
amovesx
Note
Caution
The constant velocity motion according to the distance and velocity between the waypoints
cannot be used if the “vel_opt= DR_MVS_VEL_CONST” option (constant velocity option) is
selected, and the motion is automatically switched to the variable velocity motion (vel_opt=
DR_MVS_VEL_NONE) in that case.
Return
Value Description
0 Success
Exception
Exception Description
Exception Description
Example
#Example 1. D-Out 3 seconds after the spline motion through x1 - x6 begins
P0 = posj(0,0,90,0,90,0)
movej(P0)
x0 = posx(600, 43, 500, 0, 180, 0) # Defines the posx variable (space coordi
nate/pose) x0.
movel(x0, vel=100, acc=200) # Linear movement to the initial position x0
x1 = posx(600, 600, 600, 0, 175, 0) # Defines the posx variable (space coordi
nate/pose) x1.
x2 = posx(600, 750, 600, 0, 175, 0)
x3 = posx(150, 600, 450, 0, 175, 0)
x4 = posx(-300, 300, 300, 0, 175, 0)
x5 = posx(-200, 700, 500, 0, 175, 0)
x6 = posx(600, 600, 400, 0, 175, 0)
xlist = [x1, x2, x3, x5, x6] # Defines the list (xlist) which is a set of x1-x6 as
the waypoints.
Related commands
posx()set_velx()/set_accx()/set_tcp()/set_ref_coord()/mwait()/movesx()
109
amoveb
2.31 amoveb
Features
The asynchronous moveb motion operates in the same way as moveb() except for the asynchr
onous processing and executes the next line after the command is executed.
Generating a new command for the motion before the amoveb() motion results in an error fo
r safety reasons. Therefore, the termination of the amoveb() motion must be confirmed using
mwait() or check_motion() between amoveb() and the following motion command.
Note)
• moveb(seg_list): The next command is executed after the robot starts from the current positi
on and reaches (stops at) the end point of seg_list.
• amoveb(seg_list): The next command is executed regardless of whether the robot starts from
the current position and reaches (stops at) the end point of seg_list.
Parameters
Parameter
Data Type Default Value Description
Name
pos_list list (posb) - posb list
float velocity or
vel (v) None
list (float[2]) velocity1, velocity2
float acceleration or
acc (a) None
list (float[2]) acceleration1, acceleration2
reference coordinate
DR_BASE: base coordinate
ref int None
DR_TOOL: tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
Note
Caution
Return
Value Description
0 Success
Exception
Exception Description
111
amoveb
Exception Description
Example
#Example 1. D-Out 3 seconds after the motion through the path of seg11 - seg
16 begins
# Init Pose @ Jx1
Jx1 = posj(45,0,90,0,90,45) # initial joint position
X0 = posx(370, 420, 650, 0, 180, 0) # initial task position
# CASE#1) ABSOLUTE
# Absolute Goal Poses
X1 = posx(370, 670, 650, 0, 180, 0)
X1a = posx(370, 670, 400, 0, 180, 0)
X1a2= posx(370, 545, 400, 0, 180, 0)
X1b = posx(370, 595, 400, 0, 180, 0)
X1b2= posx(370, 670, 400, 0, 180, 0)
X1c = posx(370, 420, 150, 0, 180, 0)
X1c2= posx(370, 545, 150, 0, 180, 0)
X1d = posx(370, 670, 275, 0, 180, 0)
X1d2= posx(370, 795, 150, 0, 180, 0)
Related commands
posb()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/mwait()/moveb()
113
amove_spiral
2.32 amove_spiral
Features
The asynchronous move_spiral motion operates in the same way as move_spiral() except for th
e asynchronous processing and executes the next line after the command is executed.
Generating a new command for the motion before the amove_spiral() motion results in an err
or for safety reasons. Therefore, the termination of the amove_spiral() motion must be confirm
ed using mwait() or check_motion() between amove_spiral() and the following motion comman
d.
The radius increases in a radial direction and the robot moves in parallel with the rotating spi
ral motion in an axial direction. It moves the robot along the spiral trajectory on the surface t
hat is perpendicular to the axis on the coordinate specified as ref and the linear trajectory in
the axis direction.
Note)
• move_spiral: The next command is executed after the robot starts from the current position
and reaches (stops at) the end point of the spiral trajectory.
• amove_spiral: The next command is executed after the robot starts from the current position
and regardless of whether it reaches (stops at) the end point of the spiral trajectory.
Parameters
Parameter Default
Data Type Range Description
Name Value
rev float 10 rev > 0 Total number of revolutions
axis
DR_AXIS_X: x-axis
axis int DR_AXIS_Z -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
Parameter Default
Data Type Range Description
Name Value
DR_BASE : base coordinate
DR_TOOL : tool coordinate
user coordinate: user defined
Note
Caution
An error can be generated to ensure safe motion if the rotating acceleration calculated by
the spiral path is too great.
In this case, reduce the vel, acc, or time value.
Return
Value Description
0 Success
Exception
Exception Description
115
amove_spiral
Exception Description
Example
## hole search
# (A motion that completes 9.5 revolutions (rev) to the 30 mm radius (rmax) fro
m 0 on the Tool-X/Y surface as the center of the rotation in the Tool-Z directio
n
# and the spiral trajectory that moves 50 mm (lmax) in the Tool-Z direction at t
he same time in 20 seconds
# from the initial position.
# D-Out (no. 1 channel) 3 seconds after the motion begins.)
J00 = posj(0,0,90,0,60,0)
movel(J00, vel=30, acc=30) # Joint moves to the beginning pose
amove_spiral(rev=9.5,rmax=50.0,lmax=50.0,time=10.0,axis=DR_AXIS_Z,ref=DR_TOOL)
wait(3)
set_digital_output(1, 1) # D-Out (no. 1 channel) ON
mwait(0) # Waits until the motion stops.
tool-Z tool-X
tool-X tool-Z
Related commands
set_velx()/set_accx()/set_tcp()/set_ref_coord()/mwait()/move_spiral()
2.33 amove_periodic
Features
The asynchronous move_periodic motion operates in the same way as move_periodic() except f
or the asynchronous processing and executes the next line after the command is executed.
Generating a new command for the motion before the amove_periodic() motion results in an
error for safety reasons. Therefore, the termination of the amove_periodic() motion must be co
nfirmed using mwait() or check_motion() between amove_periodic() and the following motion c
ommand.
This command performs a cyclic motion based on the sine function of each axis (parallel and
rotation) of the reference coordinate (ref) input as a relative motion that begins at the current
position. The attributes of the motion on each axis are determined by amp (amplitude) and
period, and the acceleration/deceleration time and the total motion time are set by the interv
al and repetition count.
Note)
• move_ periodic: The next command is executed after the robot starts from the current positi
on and reaches (stops at) the end point of the periodic trajectory.
• amove_ periodic: The next command is executed after the robot starts from the current posi
tion and regardless of whether it reaches (stops at) the end point of the periodic trajectory.
Parameters
Parameter Default
Data Type Range Description
Name Value
list Amplitude (motion between -amp
amp - 0≤amp
(float[6]) and +amp) [mm] or [deg]
float or
period list 0≤period Period (time for 1 cycle) [sec]
(float[6])
reference coordinate
DR_BASE : base coordinate
ref int DR_TOOL -
DR_TOOL : tool coordinate
user coordinate: user defined
117
amove_periodic
Note
Amp refers to the amplitude. The input is a list of 6 elements which are the amp values for
the axes (x, y, z, rx, ry, and rz). The amp input on the axis that does not have a motion must
be 0.
Period refers to the time needed to complete a motion in the direction, the amplitude. The
input is a list of 6 elements which are the periods for the axes (x, y, z, rx, ry, and rz).
Atime refers to the acceleration and deceleration time at the beginning and end of the
periodic motion. The largest of the inputted acceleration/deceleration times and maximum
period*1/4 is applied. An error is generated when the inputted acceleration/deceleration time
exceeds 1/2 of the total motion time.
Repeat refers to the number of repetitions of the axis (reference axis) that has the largest
period value and determines the total motion time. The number of repetitions for each of the
remaining axes is determined automatically according to the motion time.
If the motion terminates normally, the motions for the remaining axes can be terminated
before the reference axis's motion terminates so that the end position matches the starting
position. The deceleration section will deviate from the previous path if the motions of all
axes are not terminated at the same time. Refer to the following image for more information.
This function does not support online blending of previous and subsequent motions.
Return
Value Description
0 Success
Exception
Exception Description
Example
P0 = posj(0,0,90,0,90,0)
movej(P0)
amove_periodic(amp =[10,0,0,0,0.5,0], period=1, atime=0.5, repeat=5, ref=DR_TOO
L)
wait(1)
set_digital_output(1, 1)
mwait(0)
# Repeats the x-axis (10mm amp and 1 sec. period) motion and y rotating axis
(0.5deg amp and 1 sec. period) motion in the tool coordinate system
# 5 times.
# SET(1) the Digital_Output channel no. 1, 1 second after the periodic motion be
gins.
Related commands
set_ref_coord()/move_periodic()
119
amove_periodic
2.34 mwait(time=0)
Features
This function sets the waiting time between the previous motion command and the
motion command in the next line. The waiting time differs according to the time
[sec] input.
Parameters
Parameter
Data Type Default Value Description
Name
Waiting time after the motion ends
time float 0
[sec]
Return
Value Description
0 Success
Exception
Exception Description
121
mwait(time=0)
Example
#Example 1. The robot moves to q1 and stops the motion 3 seconds after it be
gins the motion at q0 and then moves to q99
q0 = posj(0, 0, 90, 0, 90, 0)
amovej (q0, vel=10, acc=20) # Moves to q0 and performs the next command
immediately after
wait(3) # Temporarily suspends the program exe
cution for 3 seconds (while the motion continues).
q1 = posj(0, 0, 0, 0, 90, 0)
amovej (q1, vel=10, acc=20)
# Maintains the q0 motion (DUPLICATE blending if the ra argument is om
itted) and iterates to q1.
# Performs the next command immediately after the blending motion.
mwait(0) # Temporarily suspends the program execution u
ntil the motion is terminated.
q99 = posj(0, 0, 0, 0, 0, 0)
movej (q99, vel=10, acc=20) # Joint motion to q99.
Related commands
wait()amovej()/amovel()/amovejx()/amovec()/amovesj()/amovesx()/amoveb()/
amove_spiral()/amove_periodic()
2.35 begin_blend(radius=0)
Features
This function begins the blending section. The following sync motion commands (m
ovej, movel, movec, and movejx) with the blending section argument radius are ble
nded using the radius set as the default argument. There is no actual blending effe
ct if the radius is 0. Moreover, if a blending radius that is different from the set ra
dius is needed, the blending radius can be changed as an exception by specifying
the blending radius to the motion argument.
Parameters
Parameter
Data Type Default Value Description
Name
radius float 0 Radius for blending
Return
Value Description
0 Success
Exception
Exception Description
123
begin_blend(radius=0)
Example
#1
begin_blend(radius=30)
# The motion commands with the following radius option sets
# the blending section to 30mm.
Q1 = posj(0,0,90,0,90,0)
Q2 = posj(0,0,0,0,90,0)
movej(Q1, vel=10, acc=20)
# Moves to the Q1 joint angle and is set to execute the next motion
# when the global distance from the Q1 space position is 30mm.
movej(Q2, time=5)
# Moves to the Q2 joint angle after the blend while maintaining the last
motion (motion iteration).
# It is set to execute the next motion
# when the global distance from the Q2 space position is 30mm.
movej(Q1, v=30, a=60, r=200)
# Moves to the Q1 joint angle after the blending while maintaining the la
st motion (motion iteration).
# It is set to execute the next motion
# when the distance from the Q1 space position is 200mm (the global set
ting is not applied).
movej(Q2, v=30, a=60, ra= DR_MV_RA_OVERRIDE)
# Immediately terminates the last motion and blends it to move to the Q
2 joint angle.
Related commands
end_blend()/movej()/movel()/movejx()/movec()
2.36 end_blend()
Features
This function ends the blending section. It means that the validity of the blending s
ection that began with begin_blend() ends.
Parameters
Not applicable
Return
Value Description
0 Success
Exception
Not applicable
Example
#1
begin_blend(radius=30)
# The motion commands that have the following radius option set the blen
ding section to 30mm.
Q1 = posj(0,0,90,0,90,0)
Q2 = posj(0,0,0,0,90,0)
movej(Q1, vel=10, acc=20)
# Moves to the Q1 joint angle and is set to execute the next motion
# when the global distance from the Q1 space position is 30mm.
movej(Q2, time=5)
# Immediately terminates the last motion and blends it to move to the Q2 j
oint angle (motion iteration).
# It is set to execute the next motion
# when the global distance from the Q2 space position is 30mm.
movej(Q1, v=30, a=60, r=200)
# Immediately terminates the last motion and blends it to move to the Q1 j
oint angle (motion iteration).
# It is set to execute the next motion
# when the distance from the Q1 space position is 200mm (the global setti
125
end_blend()
ng is not applied).
movej(Q2, v=30, a=60, ra= DR_MV_RA_OVERRIDE)
# Immediately terminates the last motion and blends it to move to the Q2 j
oint angle.
end_blend() # Ends the batch setting of the blending sections.
Related commands
begin_blend()/movej()/movel()/movejx()/movec()
2.37 check_motion()
Features
This function checks the status of the currently active motion.
Parameters
Not applicable
Return (TBD)
Value Description
Exception
Exception Description
Example
#1. The next motion (q99) is executed when an asynchronous motion to q0 begi
ns decelerating
q0 = posj(0, 0, 90, 0, 90, 0)
q99 = posj(0, 0, 0, 0, 0, 0)
amovej (q0, vel=10, acc=20) # Executes the next command immediately after t
he motion to q0.
while True:
if check_motion()==0: # A motion is completed.
amovej (q99, vel=10, acc=20) # Joint motion to q99.
break
if check_motion()==2: # In motion
pass
mwait(0) # Temporarily suspends the program execution u
ntil the motion is terminated.
127
check_motion()
Related commands
movej()/movel()/movejx()/movec()/movesj()/movesx()/moveb()/move_spiral()
/move_periodic()/amovej()/amovel()/amovejx()/amovec()/amovesj()/amovesx()/amov
eb()/amove_spiral()/amove_periodic()
2.38 stop(st_mode)
Features
This function stops the currently active motion. This function stops differently accor
ding to the st_mode received as an argument. All stop modes except Estop stop th
e motion in the currently active section.
Parameters
Parameter
Data Type Default Value Description
Name
stop mode
DR_QSTOP_STO: Stop Category 1
st_mode int - DR_QSTOP: Stop Category 2
DR_SSTO: Stop Category 2
DR_HOLD: emergency stop
Return
Value Description
0 Success
Exception
Exception Description
129
stop(st_mode)
Example
#1. The motion is terminated with a soft stop 2 seconds after moving to x1
p0 = posj(-148,-33,-54,180,92,32)
movej(p0, v=30, a=30)
x1 = posx(784, 543, 570, 0, 180, 0)
amovel (x1, vel=100, acc=200) # Executes the next command immediately after t
he motion with x1.
wait(2) # Temporarily suspends the program for 2 secon
ds.
stop(DR_SSTOP) # Stops the motion with a soft stop.
Related commands
movej()/movel()/movejx()/movec()/movesj()/movesx()/moveb()/move_spiral()
/move_periodic()/amovej()/amovel()/amovejx()/amovec()/amovesj()/amovesx()/amov
eb()/amove_spiral()/amove_periodic()
2.39 change_operation_speed(speed)
Features
This function adjusts the operation velocity. The argument is the relative velocity in
a percentage of the currently set velocity and has a value from 1 to 100. Therefore,
a value of 50 means that the velocity is reduced to 50% of the currently set veloc
ity.
Parameters
Parameter
Data Type Default Value Description
Name
speed int - operation speed(1~100)
Return
Value Description
0 Success
Exception
Exception Description
131
change_operation_speed(speed)
Example
change_operation_speed(10)
change_operation_speed(100)
#1. Motion with velocity specified to q0 and 20% of the specified velocity
q0 = posj(0, 0, 90, 0, 90, 0)
movej (q0, vel=10, acc=20) # Moves to q0 at a velocity of 10mm/sec
change_operation_velocity(10) # The velocities of all following motions executed
are 10% of the specified velocity.
q1 = posj(0, 0, 0, 0, 90, 0)
movej (q1, vel=10, acc=20) # Moves to q1 at a velocity of 10% of 10mm/
sec.
change_operation_speed(100) # The velocities of all following motions executed
are 100% of the specified velocity.
movej (q0, vel=10, acc=20) # Moves to q0 at a velocity 100% of 10mm/se
c
Related commands
movej()/movel()/movejx()/movec()/movesj()/movesx()/moveb()/move_spiral()/move_
periodic()/amovej()/amovel()/amovejx()/amovec()/amovesj()/amovesx()/amoveb()/a
move_spiral()/amove_periodic()
2.40 wait_manual_guide()
Features
This function enables the user to perform hand guiding (changing the position of t
he robot by pressing the Direct Teach button in the cockpit or the TP) during the
execution of the program. The user executes the next command in one of the follo
wing two ways after hand guiding is completed (unless the program is terminated,
it will wait at the command until one of the following is executed after the user pe
rforms hand guiding).
1) The user presses the “OK” or “Finish” button on the “Hand Guiding Execution”
popup window generated from the TP.
2) A signal is applied to the digital input channel specified for “Manual guide rel
ease” in the safety I/O settings.
The current TCP position and the TCP position of the hand guided robot must be i
n the collaborative workspace in order to execute this command properly. Run the
command after specifying the hand guiding area as the collaborative workspace an
d enabling it. An error is generated, and the program is terminated to ensure work
er safety if the current position or hand guiding deviates from the collaborative wo
rkspace.
Parameters
Not applicable
Return
Value Description
0 Success
Exception
Exception Description
133
wait_manual_guide()
Example
# Sets up the collaborative workspace before executing the program.
# Surface 1: Point-1(1000,1000), Point-2(0,0)
# Surface 2: Point-1(1000,-1000), Point-2(0,0)
# Activation of domain 1 - Point(1000,0)
j00 = posj(0,0,90,0,90,0)
movej(j00,vel=20,acc=40) # Enters the collaborative workspace.
wait_manual_guide() # Direct teaching until the “Finish” button on the popup wi
ndow generated by the TP is pressed.
pos1 = get_current_posx() # Stores the directly taught point in pos1.
dposa = posx(0,0,-100,0,0,0)
movel(dposa, vel=300, acc=600, ref=DR_TOOL)
# Retract 100 mm in the tool-Z direction from the taught
position.
Related commands
movej()/movel()/movejx()/movec()/movesj()/movesx()/moveb()/move_spiral()/move_
periodic()/amovej()/amovel()/amovejx()/amovec()/amovesj()/amovesx()/amoveb()/a
move_spiral()/amove_periodic()
Parameters
Not applicable
Return
Value Description
Control mode
int 3 : Position control mode
4 : Torque control mode
Exception
Exception Description
Example
mode = get_control_mode()
Related commands
Not applicable
135
get_control_space()
3.2 get_control_space()
Features
This function returns the current control space.
Parameters
Not applicable
Return
Value Description
Control mode
int 1 : Joint space control
2 : Task space control
Exception
Exception Description
Example
x1 = get_control_space()
Related commands
Not applicable
3.3 get_current_posj()
Features
This function returns the current joint angle.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
q1 = get_current_posj()
Related commands
get_desired_posj()
137
get_current_velj()
3.4 get_current_velj()
Features
This function returns the current joint velocity.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
velj1 = get_current_velj()
Related commands
get_desired_velj()
3.5 get_desired_posj()
Features
This function returns the current target joint angle. It cannot be used in the movel,
movec, movesx, moveb, move_spiral, or move_periodic command.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
jp1 = get_desired_posj()
Related commands
get_current_posj()
139
get_desired_velj()
3.6 get_desired_velj()
Features
This function returns the current target joint velocity. It cannot be used in the movel, movec,
movesx, moveb, move_spiral, or move_periodic command.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
velj1 = get_desired_velj()
Related commands
get_current_velj()
3.7 get_current_posx(ref)
Features
This function returns the pose and solution space of the current coordinate system. The pose
is based on the ref coordinate.
Parameters
Parameter
Data Type Default Value Description
Name
reference coordinate
ref Int DR_BASE DR_BASE : base coordinate
user coordinate: User defined
Note
Return
Value Description
Exception
Exception Description
Example
x1, sol = get_current_posx() #x1 w.r.t. DR_BASE
Related commands
get_desired_posx()
141
get_current_posx(ref)
3.8 get_current_tool_flange_posx()
Features
This function returns the pose of the current tool flange. In other words, it means the return t
o tcp=(0,0,0,0,0,0).
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
x1 = get_current_tool_flange_posx()
Related commands
Not applicable
143
get_current_velx()
3.9 get_current_velx()
Features
This function returns the current tool velocity.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
velx1 = get_current_velx()
Related commands
get_desired_velx()
3.10 get_desired_posx(ref)
Features
This function returns the target pose of the current tool. The pose is based on the ref coordi
nate.
Parameters
Parameter
Data Type Default Value Description
Name
reference coordinate
ref Int DR_BASE DR_BASE : base coordinate
user coordinate: User defined
Note
Return
Value Description
Exception
Exception Description
Example
x1 = get_desired_posx() #x1 w.r.t. DR_BASE
x2 = posx(100, 0, 0, 0, 0, 0)
x3 = posx(0, 0, 20, 20, 20, 20)
pos = x3
DR_USR1=set_user_cart_coord(x1, x2, x3, pos)
set_ref_coord(DR_USR1)
Related commands
get_desired_posx()
145
get_desired_velx()
3.11 get_desired_velx()
Features
This function returns the target velocity of the current tool. It cannot be used in the movej, m
ovejx, or movesj command.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
vel_x1 = get_desired_velx()
Related commands
get_current_velx()
3.12 get_current_solution_space()
Features
This function returns the current solution space value.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
sol = get_current_solution_space()
Related commands
get_solution_space()
147
get_current_rotm()
3.13 get_current_rotm()
Features
This function returns the direction and matrix of the current tool.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
rotm1 = get_current_rotm()
# The result value is stored in a 3x3 matrix.
rotm1[0][0] rotm1[0][1] rotm1[0][2]
rotm1=[rotm1[1][0] rotm1[1][1] rotm1[1][2]]
rotm1[2][0] rotm1[2][1] rotm1[2][2]
Related commands
Not applicable
3.14 get_joint_torque()
Features
This function returns the sensor torque value of the current joint.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
j_trq1 = get_joint_torque()
Related commands
get_external_torque()/get_tool_force()
149
get_external_torque()
3.15 get_external_torque()
Features
This function returns the torque value generated by the external force on each current joint.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
trq_ext=get_external_torque()
Related commands
get_joint_torque()/get_tool_force()
3.16 get_tool_force()
Features
This function returns the external force applied to the current tool. The force is based on the
base coordinate while the moment is based on the tool coordinate.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
force_ext = get_tool_force()
Related commands
get_joint_torque()/get_external_torque()
151
get_solution_space(pos)
3.17 get_solution_space(pos)
Features
This function obtains the solution space value.
Parameters
Parameter
Data Type Default Value Description
Name
posj posj or
pos -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
Example
q1 = posj(0, 0, 0, 0, 0, 0)
sol1 = get_solution_space(q1)
sol2 = get_solution_space([10, 20, 30, 40, 50, 60])
Related commands
get_current_solution_space()
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
xd -
list (float[6]) position list
posx posx or
xc -
list (float[6]) position list
axis
DR_AXIS_X: x-axis
axis int -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
Return
Value Description
Exception
Exception Description
Example
xd = posx(0, 0, 0, 0, 0, 0)
xc = posx(10, 20, 30, 40, 50, 60)
diff = get_orientation_error(xd, xc, DR_AXIS_X)
Related commands
get_current_rotm()
153
enable_virtual_wall()
Parameters
Not applicable
Return
Value Description
0 Success
Exception
Exception Description
Related commands
enable_virtual_wall()/disable_virtual_wall()
4.2 disable_virtual_wall()
Features
The virtual domain is disabled.
Parameters
Not applicable
Return
Value Description
0 Success
Exception
Exception Description
Related commands
enable_virtual_wall()/disable_virtual_wall()
155
set_workpiece_weight(weight, cog)
Parameters
Parameter
Data Type Default Value Description
Name
weight float - weight
Return
Value Description
0 Success
Exception
Exception Description
Example
set_workpiece_weight(4.0, [10.0, 20.0, 30.0])
Related commands
get_workpiece_weight()/reset_workpiece_weight()
4.4 get_workpiece_weight()
Features
This function measures and returns the weight of the workpiece.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
weight = get_workpiece_weight()
Related commands
set_workpiece_weight()/reset_workpiece_weight()
157
reset_workpiece_weight()
4.5 reset_workpiece_weight()
Features
This function initializes the weight data of the material to initialize the algorithm before measu
ring the weight of the material.
Parameters
Not applicable
Return
Value Description
0 Success
Exception
Exception Description
Example
reset_workpiece_weight()
Related commands
set_workpiece_weight()/get_workpiece_weight()
4.6 estimate_load()
Features
This function estimates and returns the weight and the center of gravity at the edge of the fl
ange. The value is used to estimate the tool weight and the center of gravity, and the returne
d center of gravity is calculated with the TCP coordinate in the flange.
Parameters
Not applicable
Return
Value Description
Exception
Exception Description
Example
movej([10,20,30,40,50,60])
weight, cog = estimate_load()
Related commands
set_tool()
159
set_tool(name)
4.7 set_tool(name)
Features
This function retrieves the tool data registered in the Teach Pendant by name.
Parameters
Parameter
Data Type Default Value Description
Name
Tool name registered in the Teach
name string -
Pendant
Return
Value Description
0 Success
Exception
Exception Description
Example
set_tool ("tool1") # Calls the "tool1" data registered in the TP and sets it as th
e tool.
Related commands
set_tcp()
4.8 set_singular_handling(mode)
Features
In case of path deviation due to the effect of singularity in task motion, user can select
the response policy. The mode can be set as follows.
Automatic avoidance mode(Default) : DR_AVOID
Path first mode : DR_TASK_STOP
The default setting is automatic avoidance mode, which reduces instability caused by
singularity, but reduces path tracking accuracy. In case of path first setting, if there is
possibility of instability due to singularity, a warning message is output after
deceleration and then the corresponding task is terminated.
Parameters
Parameter
Data Type Default Value Description
Name
DR_AVOID : 자동 회피 모드
mode int DR_AVOID DR__TASK_STOP : 감속/ Warning/ Task
종료
Return
Value Description
0 Success
Exception
Exception Description
Example
.P1 = posx(400,500,800,0,180,0)
P2 = posx(400,500,500,0,180,0)
set_singular_handling (DR_AVOID) # Automatic avoidance mode for singularity
161
set_singular_handling(mode)
Related commands
movel()/movec()/movesx()/moveb()/move_spiral()/amovel()/amovec()/
amovesx()/amoveb()/amove_spiral()
163
parallel_axis(x1, x2, x3, axis)
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
x1 -
list (float[6]) position list
posx posx or
x2 -
list (float[6]) position list
posx posx or
x3 -
list (float[6]) position list
axis
DR_AXIS_X: x-axis
axis int -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
Return
Value Description
0 Success
Exception
Exception Description
Exception Description
Example
x0 = posx(0, 0, 90, 0, 90, 0)
movej(x0)
x1 = posx(0, 500, 700, 30, 0, 90)
x2 = posx(500, 0, 700, 0, 0, 45)
x3 = posx(300, 100, 500, 45, 0, 45)
parallel_axis(x1, x2, x3, DR_AXIS_X).
Related commands
get_normal()/parallel_axis()/align_axis()/align_axis()
165
parallel_axis(vect, axis)
Parameters
Parameter
Data Type Default Value Description
Name
vect list (float[3]) - vector
axis
DR_AXIS_X: x-axis
axis int -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
Return
Value Description
0 Success
Exception
Exception Description
Example
x0 = posx(0, 0, 90, 0, 90, 0)
movej(x0)
parallel_axis([10, 20, 30], DR_AXIS_X)
Related commands
parallel_axis()/align_axis()/align_axis()
Parameters
Parameter
Data Type Default Value Description
Name
posx posx or
x1 -
list (float[6]) position list
posx posx or
x2 -
list (float[6]) position list
posx posx or
x3 -
list (float[6]) position list
posx posx or
pos -
list (float[6]) position list
axis
DR_AXIS_X: x-axis
axis int -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
Return
Value Description
0 Success
167
align_axis(x1, x2, x3, pos, axis)
Exception
Exception Description
Example
p0 = posj(0,0,45,0,90,0)
movej(p0, v=30, a=30)
Related commands
get_normal()/align_axis()/parallel_axis()/parallel_axis()
Parameters
Parameter
Data Type Default Value Description
Name
vect list (float[3]) - vector
posx posx or
pos -
list (float[6]) position list
axis
DR_AXIS_X: x-axis
axis int -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
Return
Value Description
0 Success
Exception
Exception Description
Example
p0 = posj(0,0,45,0,90,0)
movej(p0, v=30, a=30)
169
is_done_bolt_tightening(m=0, timeout=0, axis=None)
Related commands
align_axis()/parallel_axis()/parallel_axis()
Parameters
Parameter
Data Type Default Value Description
Name
m float 0 Target torque
axis
DR_AXIS_X: x-axis
axis int -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
Return
Value Description
0 Success
Exception
Exception Description
Example
p0 = posj(0,0,90,0,90,0)
movej(p0, v=30, a=30)
task_compliance_ctrl()
xd = posx(559, 34.5, 651.5, 0, 180.0, 60)
amovel(xd, vel=50, acc=50) # Bolt tightening motion
Related commands
amovel()
171
release_compliance_ctrl()
5.6 release_compliance_ctrl()
Features
This function terminates compliance control and begins position control at the current position.
Parameters
Not applicable
Return
Value Description
0 Success
Exception
Exception Description
Example
P0 = posj(0,0,90,0,90,0)
movej(P0)
task_compliance_ctrl()
set_stiffnessx([100, 100, 300, 100, 100, 100])
release_compliance_ctrl()
Related commands
task_compliance_ctrl()/set_stiffnessx()
5.7 task_compliance_ctrl
Features
This function begins task compliance control based on the preset reference coordinate system.
Return
Value Description
0 Success
Exception
Exception Description
173
task_compliance_ctrl
Example
P0 = posj(0,0,90,0,90,0)
movej(P0)
task_compliance_ctrl() # Begins with the default stiffness
set_stiffnessx([500, 500, 500, 100, 100, 100], time=0.5)
# Switches to the user-defined stiffness for 0.5 sec.
release_compliance_ctrl()
Related commands
set_stiffnessx()/elease_compliance_ctrl()
5.8 set_stiffnessx
Features
This function sets the stiffness value. The linear transition from the current or default stiffness
is performed during the time given as STX. The user-defined ranges of the translational stiffne
ss and rotational stiffness are 0-20000N/m and 0-400Nm/rad, respectively.
Parameters
Parameter
Data Type Default Value Description
Name
Return
Value Description
0 Success
Exception
Exception Description
Example
x0 = posx(0, 0, 90, 0, 90, 0)
movej(x0)
task_compliance_ctrl()
stx = [1, 2, 3, 4, 5, 6]
set_stiffnessx(stx) # Uses the current coordinate system.
release_compliance_ctrl()
175
set_stiffnessx
Related commands
task_compliance_ctrl()/release_compliance_ctrl()
5.9 set_user_cart_coord
Features
The user can set the new rectangular coordinate system using x1, x2, and x3. Creates a rectan
gular coordinate system with ux, uy, and uz as the vector for each axis and origin point in po
s assuming that ux is the unit vector of x1x2 and uy is the unit vector of the vector that repr
esents the shortest distance between x1x2 and x3. A maximum of 20 can be used, and the m
ost recent 20 values are used if there are more than 20.
Parameters
Parameter
Data Type Default Value Description
Name
Posx posx or
x1 -
list (float[6]) position list
Posx posx or
x2 -
list (float[6]) position list
Posx posx or
x3 -
list (float[6]) position list
Posx posx or
pos -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
177
set_user_cart_coord
Example
x1 = posx(0, 500, 700, 0, 0, 0) # Ignores the Euler angle.
x2 = posx(500, 0, 700, 0, 0, 0)
x3 = posx(300, 100, 500, 0, 0)
x4 = posx(300, 110, 510, 0, 0)
pos = posx(10, 20, 30, 0, 0, 0)
user_tc1 = set_user_cart_coord(x1, x2, x3, pos)
user_tc2 = set_user_cart_coord(x2, x3, x4, pos)
Related commands
set_ref_coord()
5.10 set_user_cart_coord
Features
The user can set the new rectangular coordinate system using u1 and v1. The origin point of
the rectangular coordinate system is pos while the x-axis and y-axis bases are given in the ve
ctors u1 and v1, respectively. Other directions are determined by u1 x v1. If u1 and v1 are no
t orthogonal, v1’, that is perpendicular to u1 on the surface spanned by u1 and v1, is set as
the vector in the y-axis direction.
Parameters
Parameter Default
Data Type Description
Name Value
u1 float[3] - X-axis unit vector
posx posx or
pos -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
Example
u1 = [1, 1, 0]
v1 = [-1, 1, 0]
pos = posx(10, 20, 30, 0, 0, 0)
user_tc1 = set_user_cart_coord(u1, v1, pos)
179
set_user_cart_coord
Related commands
set_ref_coord()
5.11 set_desired_force
Features
This function sets the force control target value, force control direction, force target value, and
variation time.
Parameters
Parameter
Data Type Default Value Description
Name
fd float[6] [0, 0, 0, 0, 0, 0] torque 1
Return
Value Description
0 Success
Exception
Exception Description
Example
x0 = posx(0, 0, 90, 0, 90, 0)
movej(x0)
task_compliance_ctrl(stx=[500, 500, 500, 100, 100, 100])
fd = [0, 0, 0, 0, 0, 10]
fctrl_dir= [0, 0, 1, 0, 0, 1]
181
set_desired_force
Related commands
release_force()/task_compliance_ctrl()/set_stiffnessx()/release_compliance_ctrl()
5.12 release_force(time=0)
Features
This function reduces the force control target value to 0 through the time value and returns t
he task space to adaptive control.
Parameters
Parameter
Data Type Default Value Description
Name
Time needed to reduce the force
time float 0
Range: 0 - 1.0
Return
Value Description
0 Success
Exception
Exception Description
Example
j0 = posj(0, 0, 90, 0, 90, 0)
x0 = posx(0, 0, 0, 0, 0, 0)
x1 = posx(0, 500, 700, 0, 180, 0)
x2 = posx(300, 100, 700, 0, 180, 0)
x3 = posx(300, 100, 500, 0, 180, 0)
set_velx(100,20)
set_accx(100,20)
movej(j0, vel=10, acc=10)
movel(x2)
task_compliance_ctrl(stx = [500, 500, 500, 100, 100, 100])
fd = [0, 0, 0, 0, 0, 10]
fctrl_dir= [0, 0, 1, 0, 0, 1]
set_desired_force(fd, dir=fctrl_dir, time=1.0)
183
release_force(time=0)
movel(x3, v=10)
release_force(0.5)
release_compliance_ctrl()
Related commands
set_desired_force()/task_compliance_ctrl()/set_stiffnessx()/release_compliance_ctrl()
5.13 check_position_condition
Features
This function checks the status of the given position. This condition can be repeated with the
while or if statement.
Parameters
Parameter
Data Type Default Value Description
Name
axis
DR_AXIS_X: x-axis
axis int -
DR_AXIS_Y: y-axis
DR_AXIS_Z: z-axis
reference coordinate
DR_BASE : base coordinate
ref int None
DR_TOOL : tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS DR_MV_MOD_ABS: Absolute
DR_MV_MOD_REL: Relative
posx posx or
pos -
list (float[6]) position list
Note
Return
Value Description
185
check_position_condition
Exception
Exception Description
Example
CON1= check_position_condition(DR_AXIS_X, min=-5, max=0)
CON2= check_position_condition(DR_AXIS_Y, max=700)
CON3= check_position_condition(DR_AXIS_Z, min=-10, max=-5) # −10 ≤ z ≤ −5
CON4= check_position_condition(DR_AXIS_Z, min=30) # 30 ≤ z
# −10 ≤ z ≤ −5
Related commands
check_force_condition()/check_orientation_condition()/set_ref_coord()
5.14 check_force_condition
Features
This function checks the status of the given force. It disregards the force direction and only c
ompares the sizes. This condition can be repeated with the while or if statement.
Parameters
Parameter
Data Type Default Value Description
Name
axis
DR_AXIS_X: x-axis
DR_AXIS_Y: y-axis
axis int - DR_AXIS_Z: z-axis
DR_AXIS_A: x-axis rotation
DR_AXIS_B: y-axis rotation
DR_AXIS_C: z-axis rotation
reference coordinate
DR_BASE : base coordinate
ref int None
DR_TOOL : tool coordinate
user coordinate: User defined
Return
Value Description
Exception
Exception Description
187
check_force_condition
Example
fcon1 = check_force_condition(DR_AXIS_Z, min=5, max=10) # 5
≤ fz ≤ 10
while (fcon1):
fcon2 = check_force_condition(DR_AXIS_C, min=30) # 30 ≤ mz
pcon1 = check_position_condition(DR_AXIS_X, min=0, max=0.1) # 0 ≤ x ≤ 0.1
Related commands
check_position_condition()/check_orientation_condition()/set_ref_coord()
5.15 check_orientation_condition
Features
This function checks the difference between the current pose and the specified pose of the ro
bot end effector. It returns the difference between the current pose and the specified pose in
rad with the algorithm that transforms it to a rotation matrix using the “AngleAxis” technique.
It returns True if the difference is positive (+) and False if the difference is negative (-). It is
used to check if the difference between the current pose and the rotating angle range is + o
r -. For example, the function can use the direct teaching position to check if the difference fr
om the current position is + or - and then create the condition for the orientation limit. This
condition can be repeated with the while or if statement.
• Setting Min and Max: True if the difference from min is - while the difference from max is
+ and False otherwise
• Setting Max only: True if the maximum difference is + and False otherwise
Parameters
Parameter
Data Type Default Value Description
Name
axis
DR_AXIS_A: x-axis rotation
axis int -
DR_AXIS_B: y-axis rotation
DR_AXIS_C: z-axis rotation
posx posx or
min -
list (float[6]) position list
posx posx or
max -
list (float[6]) position list
189
check_orientation_condition
Parameter
Data Type Default Value Description
Name
reference coordinate
DR_BASE : base coordinate
ref int None
DR_TOOL : tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS
DR_MV_MOD_ABS: Absolute
Return
Value Description
Exception
Exception Description
Example
posx1 = posx(400,500,800,0,180,30)
posx2 = posx(400,500,500,0,180,60)
# If the current task coordinate posxc = posx(400, 500, 500, 0, 180, 75)
# CON2=False since posx1 Rz=75 > posxc Rz=60
Related commands
check_position_condition()/check_force_condition()/check_orientation_condition()
/set_ref_coord()
191
check_orientation_condition
5.16 check_orientation_condition
Features
This function checks the difference between the current pose and the rotating angle range of
the robot end effector. It returns the difference (in rad) between the current pose and the rot
ating angle range with the algorithm that transforms it to a rotation matrix using the “AngleA
xis” technique. It returns True if the difference is positive (+) and False if the difference is neg
ative (-). It is used to check if the difference between the current pose and the rotating angle
range is + or -. For example, the function can be used to set the rotating angle range to m
in and max at any reference position, and then determine the orientation limit by checking if
the difference from the current position is + or -. This condition can be repeated with the wh
ile or if statement.
• Setting Min and Max: True if the difference from min is - while the difference from max is
+ and False if the opposite.
• Setting Max only: True if the maximum difference is + and False otherwise
Note
Range of rotating angle: This means the relative angle range (min, max) based on the specified
axis from a given position.
Parameters
Parameter
Data Type Default Value Description
Name
axis
DR_AXIS_X: x-axis rotation
axis int -
DR_AXIS_Y: y-axis rotation
DR_AXIS_Z: z-axis rotation
Parameter
Data Type Default Value Description
Name
min float DR_COND_NONE Minimum value
reference coordinate
DR_BASE : base coordinate
ref int None
DR_TOOL : tool coordinate
user coordinate: User defined
Movement basis
mod int DR_MV_MOD_ABS
DR_MV_MOD_REL: Relative
posx posx or
pos -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
Example
posx1 = posx(400,500,800,0,180,15)
CON1= check_orientation_condition(DR_AXIS_C, min=-5, mod=DR_MV_MOD_REL, p
os=posx1)
# If the current task coordinate posxc = posx(400, 500, 500, 0, 180, 40)
# CON1=True since posx1 Rz=15 – (min=5) < posxc Rz=40
193
check_orientation_condition
# If the current task coordinate posxc = posx(400, 500, 500, 0, 180, 40)
# CON1=False since posxc Rz=40 > posx1 Rz=15 + (max=5)
Related commands
check_position_condition()/check_force_condition()/check_orientation_condition()
/set_ref_coord()
6. System Commands
6.1 IO Related
Features
This function sends a signal at the digital contact point of the controller. A value saved in the
digital output register is output as a digital signal.
Parameters
Parameter
Data Type Default Value Description
Name
I/O contact number mounted on the contr
oller
Val argument existing: A number
between 1 and 16
index int -
No val argument: 1 ~ 16 , -1 ~ -16
I/O value
val int - ON: 1
OFF: 0
Note
If val is omitted, the positive number becomes ON and the negative number OFF according to
the sign of the argument index.
Return
Value Description
0 Success
Exception
Exception Description
195
IO Related
Exception Description
Example
set_digital_output(1, ON) # No. 1 contact ON
set_digital_output(16, OFF) # No. 16 contact OFF
set_digital_output(3) #No. 3 contact ON (A positive number means O
N if the argument val is omitted.)
set_digital_output(-3) #No. 3 contact OFF (A negative number means O
FF if the argument val is omitted.)
6.1.2 set_digital_outputs(bit_list)
Features
This function sends a signal to multiple digital output contact points of the controll
er.
The digital signals of the contact points defined in bit_list are output at one.
Parameters
Parameter
Data Type Default Value Description
Name
List of multiple output contacts
The positive contact number outputs ON:
bit_list list (int) - 1~16
The negative contact number outputs
OFF: -1~-16
Return
Value Description
0 Success
Exception
Exception Description
Example
set_digital_outputs(bit_list=[1,2,3,4,5,6,7,8]) # Contact number 1-8 ON
set_digital_outputs([-1,-2,-3,-4,-5,-6,-7,-8]) # Contact number 1-8 OFF
set_digital_outputs([1,-2,3]) # Contact no. 1 ON, no. 2 OFF, and n
o. 3 ON
set_digital_outputs([4,-9,-12]) # Contact no. 4 ON, no. 9 OFF, and n
o. 12 OFF
197
IO Related
Features
This function sends multiple signals at once from the digital output start contact point (bit_sta
rt) to the end contact point (bit_end) of the controller.
Parameters
Parameter
Data Type Default Value Description
Name
Beginning contact number for output signal
bit_start int -
(1~16)
Note
Return
Value Description
0 Success
Exception
Exception Description
Example
# Outputs contact 1=ON, contact 2=ON, contact 3=OFF, and contact 4=OFF.
set_digital_outputs(bit_start=1, bit_end=4, val=0b0011) # 0b means a binary num
ber.
199
IO Related
6.1.4 get_digital_input(index)
Features
This function reads the signals from digital contact points of the controller and reads the digit
al input contact value.
Parameters
Parameter
Data Type Default Value Description
Name
A number 1 - 16 which means the contact
index int -
number of I/O mounted on the controller.
Return
Value Description
1 ON
0 OFF
Exception
Exception Description
Example
in1 = get_digital_input(1) # Reads the no. 1 contact
in8 = get_digital_input(8) # Reads the no. 8 contact
6.1.5 get_digital_inputs(bit_list)
Features
This function reads the signals from multiple digital contact points of the controller. The digita
l signals of the contact points defined in bit_list are input at one.
Parameters
Parameter
Data Type Default Value Description
Name
List of contact points to read
index list (int) - A number 1–16 which means the I/O contact
number mounted on the controller.
Return
Value Description
Exception
Exception Description
Example
# input contacts: No. 1=OFF, No. 2=OFF, No. 3=ON, and No. 4=ON
res = get_digital_inputs(bit_list=[1,2,3,4])
#res expected value = 0b1100 (binary number), 12 (decimal number), or 0x0C (hexadecim
al number)
# input contacts: No. 5=ON, No. 6=ON, No. 7=OFF, and No. 8=ON
res = get_digital_inputs([5,6,7,8])
#res expected value = 0b1011 (binary number), 11 (decimal number), or 0x0B (hexade
cimal number)
201
IO Related
Features
This function reads multiple signals at once from the digital input start contact point (start_ind
ex) to the end contact point (end_index) of the controller.
Parameters
Parameter
Data Type Default Value Description
Name
Beginning contact number for input signals
bit_start int -
(1~16)
Note
Return
Value Description
Exception
Exception Description
Example
# input contacts: No. 1=OFF, No. 2=OFF, No. 3=ON, and No. 4=ON
res = get_digital_inputs(bit_start=1, bit_end=4)
#res expected value = 0b1100 (binary number), 12 (decimal number), or 0x0C (h
exadecimal number)
Features
This function waits until the signal value of the digital input register of the controller becomes
val (ON or OFF). The waiting time can be changed with a timeout setting. The waiting time
ends, and the result is returned if the waiting time has passed. This function waits indefinitely
if the timeout is not set.
Parameters
Parameter
Data Type Default Value Description
Name
A number 1 - 16 which means the I/O
index int -
index mounted on the controller.
I/O value
value int - ON : 1
OFF : 0
Return
Value Description
0 Success
-1 Failed (time-out)
Exception
Exception Description
203
IO Related
Example
wait_digital_input(1, ON) # Indefinite wait until the no. 1 contact becomes ON
wait_digital_input(2, OFF) # Indefinite wait until the no. 2 contact becomes OFF
res = wait_digital_input(1, ON, 3) # Wait for up to 3 seconds until the no. 1 con
tact becomes ON
# Waiting is terminated and res = 0 if the no. 1 contact becomes ON withi
n 3 seconds.
# Waiting is terminated and res = -1 if the no. 1 contact does not become
ON within 3 seconds.
Features
This function sends the signal of the robot tool from the digital contact point.
Parameters
Parameter
Data Type Default Value Description
Name
I/O contact number mounted on the robot
arm
Note
If val is omitted, the positive number becomes ON and the negative number OFF according to
the sign of the argument index.
Return
Value Description
0 Success
Exception
Exception Description
Example
set_tool_digital_output(1, ON) # Sets the no. 1 contact of the robot arm ON
set_tool_digital_output(6, OFF) # Sets the no. 6 contact of the robot arm OFF
205
IO Related
6.1.9 set_tool_digital_outputs(bit_list)
Features
This function sends the signal of the robot tool from the digital contact point. The digital sig
nals of the contact points defined in bit_list are output at one.
Parameters
Parameter
Data Type Default Value Description
Name
List of multiple output contacts
The positive contact number outputs ON:
bit_list list (int) - 1~6
The negative contact number outputs
OFF: -1~-6
Return
Value Description
0 Success
Exception
Exception Description
Example
set_tool_digital_outputs(bit_list=[1,2,3,4,5,6]) # Sets the contacts 1-6 ON
set_tool_digital_outputs([-1,-2,-3,-4,-5,-6]) # Sets the contacts 1-6 OFF
set_digital_outputs([1,-2,3]) # Contact no. 1 ON, no. 2 OFF, and no. 3 ON
Features
This function sends the signal of the robot tool from the digital contact point. The multiple si
gnals from the first contact point (bit_start) to the last contact point (bit_end) are output at o
ne.
Parameters
Parameter
Data Type Default Value Description
Name
Beginning contact number for output signal
bit_start int -
(1~6)
Note
Return
Value Description
0 Success
Exception
Exception Description
207
IO Related
Example
# Outputs contact 1=ON, contact 2=ON, contact 3=OFF, and contact 4=OFF.
set_tool_digital_outputs(bit_start=1, bit_end=4, val=0b0011) # 0b means a binary
number.
6.1.11 get_tool_digital_input(index)
Features
This function reads the signal of the robot tool from the digital contact point.
Parameters
Parameter
Data Type Default Value Description
Name
I/O contact number (1-6) mounted on the
index int -
robot tool
Return
Value Description
1 ON
0 OFF
Exception
Exception Description
Example
get_tool_digital_input(1) # Reads the no. 1 contact of tool I/O
get_tool_digital_input(6) # Reads the no. 6 contact of tool I/O
209
IO Related
6.1.12 get_tool_digital_inputs(bit_list)
Features
This function reads the signal of the robot tool from the digital contact point.
The digital signals of the contact points defined in bit_list are input at one.
Parameters
Parameter Default
Data Type Description
Name Value
List of contact points to read
bit_list list (int) - (I/O contact numbers (1-6) mounted on the
robot arm)
Return
Value Description
Exception
Exception Description
Example
# input contacts: No. 1=OFF, No. 2=OFF, and No. 3=ON
res = get_tool_digital_inputs(bit_list=[1,2,3]) # Reads the contacts 1, 2, and 3 at once.
#res expected value = 0b100 (binary number), 4 (decimal number), or 0x04 (hexadecimal
number)
Features
This function reads the signal of the robot tool from the digital contact point. The multiple si
gnals from the first contact point (start_index) to the last contact point (end_index) are input
at one.
Parameters
Parameter
Data Type Default Value Description
Name
Beginning contact number for input signals
bit_start int -
(1~6)
Return
Value Description
Exception
Exception Description
Example
# input contacts: No. 1=OFF, No. 2=OFF, and No. 3=ON
res = get_tool_digital_inputs(bit_start=1, bit_end=3)
#res expected value = 0b100 (binary number), 4 (decimal number), or 0x04 (hex
adecimal number)
211
IO Related
res = get_tool_digital_inputs(4, 6)
#res expected value = 0b011 (binary number), 3 (decimal number), or 0x03 (hex
adecimal number)
Features
This function waits until the digital input signal value of the robot tool becomes val (ON or O
FF). The waiting time can be changed with a timeout setting. The waiting time ends, and the
result is returned if the waiting time has passed. This function waits indefinitely if the timeout
is not set.
Parameters
Parameter Default
Data Type Description
Name Value
A number in 1 - 6 which means the I/O index
index int -
mounted on the robot arm
I/O value
value int - ON : 1
OFF : 0
Return
Value Description
0 Success
-1 Failed (time-out)
Exception
Exception Description
213
IO Related
Example
wait_tool_digital_input(1, ON) # Indefinite wait until the no. 1 contact becomes O
N
wait_tool_digital_input(2, OFF) # Indefinite wait until the no. 2 contact becomes
OFF
Features
This function sets the channel mode of the controller analog output.
Parameters
Parameter Default
Data Type Description
Name Value
1 : channel 1
ch int -
2 : channel 2
analog io mode
mod int - DR_ANALOG_CURRENT: Current mode
DR_ANALOG_VOLTAGE: Voltage mode
Return
Value Description
0 Success
Exception
Exception Description
Example
# Sets analog_output channel 1 to the current mode.
set_mode_analog_output(ch=1, mod=DR_ANALOG_CURRENT)
215
IO Related
Features
This function sets the channel mode of the controller analog input.
Parameters
Parameter Default
Data Type Description
Name Value
1 : channel 1
ch int -
2 : channel 2
analog io mode
mod int - DR_ANALOG_CURRENT: Current mode
DR_ANALOG_VOLTAGE: Voltage mode
Return
Value Description
0 Success
Exception
Exception Description
Example
# Sets analog_input channel 1 to the current mode.
set_mode_analog_input(ch=1, mod=DR_ANALOG_CURRENT)
Features
This function outputs the channel value corresponding to the controller analog output.
Parameters
Parameter Default
Data Type Description
Name Value
1 : channel 1
ch int -
2 : channel 2
Return
Value Description
0 Success
Exception
Exception Description
Example
set_mode_analog_output(ch=1, mod=DR_ANALOG_CURRENT) #out ch1=current m
ode
set_mode_analog_output(ch=2, mod=DR_ANALOG_VOLTAGE) #out ch1=voltage m
ode
6.1.18 get_analog_input(ch)
217
IO Related
Features
This function reads the channel value corresponding to the controller analog input.
Parameters
Parameter Default
Data Type Description
Name Value
1 : channel 1
ch int -
2 : channel 2
Return
Value Description
Exception
Exception Description
Example
set_mode_analog_input(ch=1, mod=DR_ANALOG_CURRENT) #input ch1=current m
ode
set_mode_analog_input(ch=2, mod=DR_ANALOG_VOLTAGE) #input ch2=voltage
mode
Features
This function registers the Modbus signal. The Modbus I/O must be set in the Teach Pendant
I/O set-up menu. Use this command only for testing if it is difficult to use the Teach Pendant.
The Modbus menu is disabled in the Teach Pendant if it is set using this command.
Parameters
Parameter Default
Data Type Description
Name Value
ip string - IP address of the Modbus module
Return
Value Description
0 Success
Exception
Exception Description
219
IO Related
Example
# An example of connecting two Modbus IO and allocating the contacts
#Modbus IO 1: IP 192.168.127.254, 8 input points: “di1” - ”di8”, 8 output points:
“do1” - "do8”
#Modbus IO 2: IP 192.168.127.253, 8 input points: “di9” - "di16”, 8 output point
s: “do9” - "do16”
#======================================================
========
# set <modbus 2> input : di9~di16
add_modbus_signal(ip="192.168.127.253",port=502, name="di9", reg_type=DR_MO
DBUS_REG_INPUT, index=0)
add_modbus_signal(ip="192.168.127.253",port=502, name="di10", reg_type=DR_M
ODBUS_REG_INPUT, index=1)
add_modbus_signal(ip="192.168.127.253",port=502, name="di11", reg_type=DR_MO
DBUS_REG_INPUT, index=2)
add_modbus_signal(ip="192.168.127.253",port=502, name="di12", reg_type=DR_MO
DBUS_REG_INPUT, index=3)
add_modbus_signal(ip="192.168.127.253",port=502, name="di13", reg_type=DR_MO
DBUS_REG_INPUT, index=4)
add_modbus_signal(ip="192.168.127.253",port=502, name="di14", reg_type=DR_MO
DBUS_REG_INPUT, index=5)
add_modbus_signal(ip="192.168.127.253",port=502, name="di15", reg_type=DR_MO
DBUS_REG_INPUT, index=6)
add_modbus_signal(ip="192.168.127.253",port=502, name="di16", reg_type=DR_MO
DBUS_REG_INPUT, index=7)
221
IO Related
Features
This function deletes the registered Modbus signal. The Modbus I/O must be set in the Teach
Pendant I/O set-up menu. Use this command only for testing if it is difficult to use the Teac
h Pendant. The Modbus menu is disabled in the Teach Pendant if it is set using this comman
d.
Parameters
Parameter Default
Data Type Description
Name Value
name string - Name of the registered Modbus signal
Return
Value Description
0 Success
Exception
Exception Description
Example
# Use the following command when the Modbus IO signals are registered as “di
1” and "do1”
# and this signal registration is to be deleted. .
del_modbus_signal("di1") # Deletes the registered “di1” contact
del_modbus_signal("do1") # Deletes the registered “do1” contact
223
IO Related
Features
This function sends the signal to an external Modbus system.
Parameters
Parameter Default
Data Type Description
Name Value
iobus string - Modbus name (set in the TP)
Return
Value Description
0 Success
Exception
Exception Description
Example
#Modbus digital I/O is connected, and the signals are registered as “do1” and
“do2”.
set_modbus_output("do1", ON)
set_modbus_output("do2", OFF)
#Modbus analog I/O is connected, and the signals are registered as “reg1” and
“reg2”.
set_modbus_output("reg1", 10)
set_modbus_output("reg2", 24)
Features
This function sends multiple signals to the digital contact points of the external Modbus digita
l I/O unit.
Parameters
Parameter Default
Data Type Description
Name Value
iobus string - Modbus name (set in the TP)
Return
Value Description
0 Success
Exception
Exception Description
Example
# Modbus digital I/O output contact "d1” OFF, "d2” ON, and "d3” ON
set_modbus_outputs(iobus_list=[“d1”, “d2”, “d3”,], val_list=[0,1,1])
225
IO Related
6.1.23 get_modbus_input(iobus)
Features
This function reads the signal from the Modbus system.
Parameters
Parameter Default
Data Type Description
Name Value
iobus string - Modbus name (set in the TP)
Return
Value Description
Exception
Exception Description
Example
#Modbus digital I/O is connected, and the signals are registered as “di1” and “d
i2”.
get_modbus_input("di1")
get_modbus_input("di2")
#Modbus analog I/O is connected, and the signals are registered as “reg1” and
“reg2”.
get_modbus_input("reg1")
get_modbus_input("reg2")
6.1.24 get_modbus_inputs(iobus_list)
Features
This function reads multiple signals from the digital input contact points of the external Modb
us digital I/O unit.
Parameters
Parameter Default
Data Type Description
Name Value
iobus_list list(string) - Modbus input name list (set in the TP)
Return
Value Description
Exception
Exception Description
Example
# Modbus digital I/O input contact ”di1”은 OFF, ”di2” ON, and ”di3” ON
res = get_modbus_inputs(iobus_list=["di1", "di2", "di3”])
#res expected value = 0b110 (binary number), 6 (decimal number), or 0x
06 (hexadecimal number)
227
IO Related
Features
This function waits until the specified signal contact point value of the Modbus digital I/O bec
omes val (ON or OFF). The waiting time can be changed with a timeout setting. The waiting t
ime ends, and the result is returned if the waiting time has passed. This function waits indefin
itely if the timeout is not set.
Parameters
Parameter Default
Data Type Description
Name Value
iobus string - Modbus name (set in the TP)
Return
Value Description
0 Success
-1 Failed (time-out)
Exception
Exception Description
Example
wait_modbus_input("CIN0", ON) # Indefinite wait until the “CIN0” contact becom
es ON
229
TP Interface
6.2 TP Interface
Features
This function provides a message to users through the Teach Pendant. The higher level control
ler receives the string and displays it in the popup window, and the window must be closed
by a user’s confirmation.
Parameters
Parameter
Data Type Default Value Description
Name
Message provided to the user
message string - (The message is limited to less than 256
bytes.)
Message type
DR_PM_MESSAGE
pm_type int DR_PM_MESSAGE
DR_PM_WARNING
DR_PM_ALARM
Return
Value Description
0 Success
Exception
Exception Description
Example
tp_popup("move done", DR_PM_MESSAGE)
tp_popup("Error!! ", DR_PM_ALARM)
a=1
b=2
c=3
tp_popup("a={0}, b={1}, c={2}".format(a,b,c) ,DR_PM_MESSAGE)
231
TP Interface
6.2.2 tp_log(message)
Features
This function records the user-written log to the Teach Pendant.
Parameters
Parameter
Data Type Default Value Description
Name
Log message
message string - (The message is limited to less than 256
bytes.)
Return
Value Description
0 Success
Exception
Exception Description
Example
tp_log("movej() is complete! ")
Features
This function provides a message to users through the Teach Pendant. The higher level control
ler receives the runtime data when a patterned program is run and is displayed in the GUI.
Parameters
Parameter Data
Default Value Description
Name Type
cur_progress int - Value at the current step
Return
Value Description
0 Success
Exception
Exception Description
Example
tp_progress(1, 100)
tp_progress(99, 100)
233
TP Interface
Features
This function receives the user input data through the Teach Pendant.
Parameters
Parameter Data
Default Value Description
Name Type
Character string message to be displayed
message string -
on the TP user input window
Return
Value Description
Exception
Exception Description
Example
q1 = posj(10, 10, 10, 10, 10, 10)
q2 = posj(20, 20, 20, 20, 20, 20)
q3 = posj(30, 30, 30, 30, 30, 30)
q4 = posj(40, 40, 40, 40, 40, 40)
q5 = posj(50, 50, 50, 50, 50, 50)
q6 = posj(60, 60, 60, 60, 60, 60)
235
Thread
6.3 Thread
Features
This function creates and executes a thread. The features executed by the thread are determin
ed by the functions specified in th_func_name.
Note
The following constraints are applied when using the thread command.
Up to 4 threads can be used.
The following motion command cannot be used to move the robot in the thread.
- movej, amovej, movejx, amovejx, movel, amovel, movec, amovec, movesj, amovesj,
- movesx, amovesx, moveb, amoveb, move_spiral, amove_spiral,
- move_periodic, amove_periodic
The thread commands do not operate normally when the loop=Ture during thread_run and
the block is an indefinite loop within the thread function. (The thread is normally stopped
when the stop command is executed through the TP.)
Parameters
Parameter Data
Default Value Description
Name Type
th_func_name callable - Name of the function run by the thread
Return
Value Description
Exception
Exception Description
Example
#----- Thread --------------------------------------
def fn_th_func():
if check_motion()==0: # No motion in action
set_digital_output(1, OFF)
else:
set_digital_output(1, ON)
while 1:
# do something…
wait(0.1)
237
Thread
6.3.2 thread_stop(th_id)
Features
This function terminates a thread.
The program is automatically terminated when the DRL program is terminated even if the thre
ad_stop() command is not used.
Parameters
Parameter Data
Default Value Description
Name Type
th_id int - Thread ID to stop
Return
Value Description
0 Success
Exception
Exception Description
Example
def fn_th_func():
if check_motion()==0: # No motion in action
set_digital_output(1, OFF)
else:
set_digital_output(1, ON)
#----- Main routine --------------------------------------
th_id = thread_run(fn_th_func, loop=True)
# do something…
thread_stop(th_id) # Stops the thread.
6.3.3 thread_pause(th_id)
Features
This function temporarily suspends a thread.
Parameters
Parameter Data
Default Value Description
Name Type
th_id int - Thread ID to suspend
Return
Value Description
0 Success
Exception
Exception Description
Example
def fn_th_func():
if check_motion()==0: # No motion in action
set_digital_output(1, OFF)
else:
set_digital_output(1, ON)
#----- Main routine --------------------------------------
th_id = thread_run(fn_th_func, loop=True)
# do something…
239
Thread
6.3.4 thread_resume(th_id)
Features
This function resumes a temporarily suspended thread.
Parameters
Parameter Data
Default Value Description
Name Type
th_id int - Suspended thread ID to be resumed
Return
Value Description
0 Success
Exception
Exception Description
Example
def fn_th_func():
if check_motion()==0: # No motion in action
set_digital_output(1, OFF)
else:
set_digital_output(1, ON)
# do something…
thread_pause(th_id) # Suspends the thread.
# do something…
thread_resume(th_id) # Resumes the suspended thread.
6.3.5 thread_state(th_id)
Features
This function checks the status of a thread.
Parameters
Parameter Data
Default Value Description
Name Type
th_id int - Thread ID to check the status
Return
Value Description
1 RUN (TH_STATE_RUN)
2 PAUSE (TH_STATE_PAUSE)
3 STOP (TH_STATE_STOP)
Exception
Exception Description
Example
def fn_th_func():
if check_motion()==0: # No motion in action
set_digital_output(1, OFF)
else:
set_digital_output(1, ON)
thread_pause(th_id)
state2 = thread_state(th_id)
241
Thread
while 1:
if g_cmd == "a":
g_cmd = ""
movej(p1,vel=100,acc=100)
client_socket_write(g_sock, b"end")
if g_cmd == "b":
g_cmd = ""
movej(p2,vel=100,acc=100)
client_socket_write(g_sock, b"end")
if g_cmd == "c":
g_cmd = ""
movej(p3,vel=100,acc=100)
client_socket_write(g_sock, b"end")
wait(0.1)
th_client thread: Converts the data received from the server into a string and saves
it in g_cmd.
th_check_io thread: Checks the state of contact no. 1 and terminates the program if
it is ON.
main: Connects to the server.
2 threads run: th_client and th_check_io
If “a” is received from the server, it moves to p1 and sends “end” to the serv
ers.
If “b” is received from the server, it moves to p2 and sends “end” to the ser
vers.
If “c” is received from the server, it moves to p3 and sends “end” to the serv
ers.
243
Others
6.4 Others
6.4.1 wait(time)
Features
This function waits for the specified time.
Parameters
Parameter Data
Default Value Description
Name Type
Time Float - Time [sec]
Return
Value Description
0 Success
Exception
Exception Description
Example
wait(1.3) # Waits for 1.3 seconds.
6.4.2 exit()
Features
This function terminates the currently running program.
Return
Value Description
0 Success
Exception
Exception Description
Example
exit()
245
sin(x)
7. Mathematical Function
7.1 sin(x)
Features
This function returns the sine value of x radians.
Parameters
Parameter Data
Default Value Description
Name Type
x float - -
Return
Value Description
the sine of x -
Exception
Exception Description
7.2 cos(x)
Features
This function returns the cosine value of x radians.
Parameters
Parameter Data
Default Value Description
Name Type
x float - -
Return
Value Description
the cosine of x
Exception
Exception Description
247
tan(x)
7.3 tan(x)
Features
This function returns the tangent value of x radians.
Parameters
Parameter Data
Default Value Description
Name Type
x float - -
Return
Value Description
the tangent of x -
Exception
Exception Description
7.4 asin(x)
Features
This function returns the arc sine value of x radians.
Parameters
Parameter Default
Data Type Description
Name Value
x float -
Return
Value Description
Exception
Exception Description
249
acos(x)
7.5 acos(x)
Features
This function returns the arc cosine value of x radians.
Parameters
Parameter Default
Data Type Description
Name Value
x float -
Return
Value Description
the arc cosine of x -
Exception
Exception Description
7.6 atan(x)
Features
This function returns the arc tangent value of x radians.
Parameters
Parameter Default
Data Type Description
Name Value
x float - -
Return
Value Description
Exception
Exception Description
251
atan2(y, x)
7.7 atan2(y, x)
Features
This function returns the arc tangent value of y/x radians.
Parameters
Parameter Default
Data Type Description
Name Value
y float - -
x float - -
Return
Value Description
Exception
Exception Description
7.8 ceil(x)
Features
This function returns the smallest integer value of integers larger than x. It truncate
s up to the integer.
Parameters
Parameter Default
Data Type Description
Name Value
x float - -
Return
Value Description
rounded integer -
Exception
Exception Description
253
floor(x)
7.9 floor(x)
Features
This function returns the largest integer value of integers smaller than x. It rounds down to th
e nearest one.
Parameters
Parameter Default
Data Type Description
Name Value
x float - -
Return
Value Description
rounded integer -
Exception
Exception Description
7.10 pow(x, y)
Features
Return x raised to the power of y.
Parameters
Parameter Default
Data Type Description
Name Value
x float -
y float -
Return
Value Description
Exception
Exception Description
255
sqrt(x)
7.11 sqrt(x)
Features
This function returns the square root of x.
Parameters
Parameter Default
Data Type Description
Name Value
x float - -
Return
Value Description
Exception
Exception Description
7.12 log(x, b)
Features
This function returns the log of x with base b.
Parameters
Parameter Default
Data Type Description
Name Value
x float - -
Return
Value Description
Exception
Exception Description
257
d2r(x)
7.13 d2r(x)
Features
This function returns the x radians value to degrees.
Parameters
Parameter Default
Data Type Description
Name Value
x float - The angle in degrees
Return
Value Description
Exception
Exception Description
7.14 r2d(x)
Features
This function returns the x radians value to degrees.
Parameters
Parameter Default
Data Type Description
Name Value
x float The angle in radians
Return
Value Description
Exception
Exception Description
259
norm(x)
7.15 norm(x)
Features
This function returns the L2 norm of x.
Parameters
Parameter Default
Data Type Description
Name Value
x float[3] - Point coordinate (x, y, z)
Return
Value Description
Exception
Exception Description
7.16 random()
Features
This function returns a random number between 0 and 1.
Return
Value Description
Exception
Exception Description
261
rotx(angle)
7.17 rotx(angle)
Features
This function returns a rotation matrix that rotates by the angle value along the x-a
xis.
Parameters
Parameter Default
Data Type Description
Name Value
angle float 0 Rotating angle [deg]
Return
Value Description
Exception
Exception Description
Example
rotm = rotx(30)
7.18 roty(angle)
Features
This function returns a rotation matrix that rotates by the angle value along the y-a
xis.
Parameters
Parameter Default
Data Type Description
Name Value
angle float 0 Rotating angle [deg]
Return
Value Description
Exception
Exception Description
Example
rotm = roty(30)
263
rotz(angle)
7.19 rotz(angle)
Features
This function returns a rotation matrix that rotates by the angle value along the z-a
xis.
Parameters
Parameter Default
Data Type Description
Name Value
angle float 0 Rotating angle [deg]
Return
Value Description
Exception
Exception Description
Example
rotm = rotz(30)
7.20 rotm2eul(rotm)
Features
This function receives a rotation matrix and returns the Euler angle (zyz order) to d
egrees. Of the Euler angle (rx, ry, rz) returned as a result, ry is always a positive nu
mber.
Parameters
Parameter Default
Data Type Description
Name Value
rotm Float[3][3] - Rotation matrix
Return
Value Description
Exception
Exception Description
Example
rotm = [[1,0,0],[0,0.87,-0.5],[0,0.5,0.87]]
eul = rotm2eul(rotm)
265
rotm2rotvec(rotm)
7.21 rotm2rotvec(rotm)
Features
This function receives a rotation matrix and returns the rotation vector (angle/axis r
epresentation).
Parameters
Parameter Default
Data Type Description
Name Value
rotm float[3][3] - Rotation matrix
Return
Value Description
Exception
Exception Description
Example
rotm = [[1,0,0],[0,0.87,-0.5],[0,0.5,0.87]]
eul = rotm2rotvec(rotm)
7.22 eul2rotm([alpha,beta,gamma])
Features
This function transforms a Euler angle (zyz order) to a rotation matrix.
Parameters
Parameter Default
Data Type Description
Name Value
eul float[3] [0 0 0] Euler angle (zyz) [deg]
Return
Value Description
Exception
Exception Description
Example
eul = [90, 90, 0]
rotm = eul2rotm (eul)
267
eul2rotvec([alpha,beta,gamma])
7.23 eul2rotvec([alpha,beta,gamma])
Features
This function transforms a Euler angle (zyz order) to a rotation vector.
Parameters
Parameter Default
Data Type Description
Name Value
eul float[3] [0 0 0] Euler angle (zyz) [deg]
Return
Value Description
Exception
Exception Description
Example
eul = [90, 90, 0]
rotvec = eul2rotvec (eul)
7.24 rotvec2eul([rx,ry,rz])
Features
This function transforms a rotation vector to a Euler angle (zyz).
Parameters
Parameter Default
Data Type Description
Name Value
rotvec float[3] - rotation vector
Return
Value Description
Exception
Exception Description
Example
rotvec = [0.7854, 0, 0]
eul = rotvec2eul(rotvec) # eul=[45,0,0]
269
rotvec2rotm([rx,ry,rz])
7.25 rotvec2rotm([rx,ry,rz])
Features
This function transforms a rotation vector to a rotation matrix.
Parameters
Parameter Default
Data Type Description
Name Value
rotvec float[3] - rotation vector
Return
Value Description
Exception
Exception Description
Example
rotm = rotvec2eul([0.7854,0,0])
7.26 htrans(posx1,posx2)
Features
This function returns the pose corresponding to T1*T2 assuming that the homogene
ous transformation matrices obtained from posx1 and posx2 are T1 and T2, respecti
vely.
𝑅1 𝑟1 𝑅2 𝑟2 𝑅 𝑅 𝑟1 + 𝑅1 𝑟2
𝐻1 𝐻2 = [ ] [ ]=[ 1 2 ]
0 1 0 1 0 1
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
posx posx or
posx2 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
posx = htrans(posx1,posx2)
271
get_intermediate_pose(posx1,posx2,alpha)
7.27 get_intermediate_pose(posx1,posx2,alpha)
Features
This function returns posx located at alpha of the linear transition from posx1 to p
osx2. It returns posx1 if alpha is 0, the median value of two poses if alpha is 0.5, a
nd posx2 if alpha is 1.
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
posx posx or
posx2 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
alpha = 0.5
posx = get_intermediate_pose(posx1,posx2,alpha)
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm]
posx posx or
posx2 -
list (float[6]) position list [mm]
Return
Value Description
float [mm]
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
dis_posx = get_distance(posx1, posx2)
273
get_normal(x1, x2, x3)
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
x1 -
list (float[6]) position list
posx posx or
x2 -
list (float[6]) position list
posx posx or
x3 -
list (float[6]) position list
Return
Value Description
Exception
Exception Description
Example
x1 = posx(0, 500, 700, 30, 0, 90)
x2 = posx(500, 0, 700, 0, 0, 45)
x3 = posx(300, 100, 500, 45, 0, 45)
vect = get_normal(x1, x2, x3)
7.30 add_pose(posx1,posx2)
Features
This function obtains the sum of two poses.
𝑅 𝑟1 𝑅 𝑟2 𝑅 𝑅 𝑟1 + 𝑟2
add_pose([ 1 ] ,[ 2 ]) ⇒ [ 1 2 ]
0 1 0 1 0 1
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
posx posx or
posx2 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
add_posx = add_pose(posx1, posx2)
275
subtract_pose(posx1,posx2)
7.31 subtract_pose(posx1,posx2)
Features
This function obtains the difference between two poses.
𝑅1 𝑟1 𝑅2 𝑟2 𝑇
subtract_pose([ ] ,[ ]) ⇒ [𝑅2 𝑅1 𝑟1 − 𝑟2 ]
0 1 0 1 0 1
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
posx posx or
posx2 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
subtract_posx = subtract_pose(posx1, posx2)
7.32 inverse_pose(posx1)
Features
This function returns the posx value that represents the inverse of posx.
𝑅1 𝑟1 𝑅 𝑟1 −1 𝑇
−𝑅1𝑇 𝑟1 ]
inv_pose ([ ])=[ 1 ] = [𝑅1
0 1 0 1 0 1
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
inv_posx = inverse_pose(posx1)
277
dot_pose(posx1, posx2)
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
posx posx or
posx2 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
res= dot_pose(posx1, posx2)
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
posx posx or
posx2 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
res= cross_pose(posx1, posx2)
279
unit_pose(posx1)
7.35 unit_pose(posx1)
Features
This function obtains the unit vector of the given posx translation component.
Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
posx1 -
list (float[6]) position list [mm, deg]
Return
Value Description
Exception
Exception Description
Example
posx1 = [100, 20, 300, 90, 0, 180]
res = unit_pose(posx1
Features
This function opens a serial communication port.
Parameters
Parameter Default
Data Type Description
Name Value
port string None E.g.) "COM1", "COM2"
Parity checking
DR_PARITY_NONE: "N"
DR_PARITY_EVEN: "E"
parity str "N"
DR_PARITY_ODD: "O"
DR_PARITY_MARK: "M"
DR_PARITY_SPACE: "S"
Return
Value Description
281
Serial
Exception
Exception Description
Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)
if type(ser) == serial.Serial:
serial_write(ser, b"123456789")
serial_close(ser)
8.1.2 serial_close(ser)
Features
This function closes a serial communication port.
Parameters
Parameter Default
Data Type Description
Name Value
ser serial.Serial - Serial instance
Return
Value Description
Exception
Exception Description
Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)
if type(ser) == serial.Serial:
serial_write(ser, b"123456789")
serial_close(ser)
283
Serial
8.1.3 serial_state(ser)
Features
This function returns the status of a serial communication port.
Parameters
Parameter Default
Data Type Description
Name Value
ser serial.Serial - Serial instance
Return
Value Description
Exception
Exception Description
Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)
state = serial_state(ser)
serial_close(ser)
Features
This function sets the timeout between the bytes (inter-byte) when reading and writ
ing to the port.
Parameters
Parameter Default
Data Type Description
Name Value
ser serial.Serial - Serial instance
Return
Value Description
0 Success
Exception
Exception Description
Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)
serial_close(ser))
285
Serial
Features
This function records the data (tx_data) to a serial port.
Parameters
Parameter Default
Data Type Description
Name Value
ser serial.Serial - Serial instance
Data to be transmitted
tx_data byte - The data type must be a byte.
Refer to the example below.
Return
Value Description
0 Success
Exception
Exception Description
Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)
serial_close(ser)
Features
This function reads the data from a serial port.
Parameters
Parameter Default
Data Type Description
Name Value
ser serial.Serial - Serial instance
Return
Value (res, rx_data) Description
Exception
Exception Description
287
Serial
Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)
serial_read(ser)
serial_read(ser, 100)
serial_read(ser, 100, 3)
serial_read(ser, -1, 3)
serial_close(ser)
8.2 Tcp/Client
Features
This function creates a socket and attempts to connect it to a server (ip, port).
It returns the connected socket when the client is connected.
Parameters
Parameter Default
Data Type Description
Name Value
ip str - Server IP address: (E.g.) “192.168.137.200”
Return
Value Description
Exception
Exception Description
Example
sock = client_socket_open("192.168.137.200", 20002)
# An indefinite connection is attempted to the server (ip="192.168.137.200", port
=20002).
# The connected socket is returned if the connection is successful.
# The data is read, written, and closed using the returned socket as shown belo
w.
289
Tcp/Client
8.2.2 client_socket_close(sock)
Features
This function terminates communication with the server. To reconnect to the server,
the socket must be closed with client_socket_close(sock) and reopened.
Parameters
Parameter Default
Data Type Description
Name Value
Socket instance returned
sock socket.socket -
from client_socket_open()
Return
Value Description
0 Successful disconnection
Exception
Exception Description
Example
sock = client_socket_open("192.168.137.200", 20002)
# An indefinite connection is attempted to the server (ip="192.168.137.200", port
=20002).
# do something…
8.2.3 client_socket_state(sock)
Features
This function returns the socket connection status.
Parameters
Parameter Default
Data Type Description
Name Value
Socket instance returned
sock socket.socket -
from client_socket_open()
Return
Value Description
1 Connected state
0 Disconnected state
Exception
Exception Description
Example
sock = client_socket_open("192.168.137.200", 20002)
client_socket_close(sock)
291
Tcp/Client
Features
This function transmits data to the server.
Parameters
Parameter Default
Data Type Description
Name Value
Socket instance returned
sock socket.socket -
from client_socket_open()
Data to be transmitted
tx_data byte - The data type must be a byte.
Refer to the example below.
Return
Value Description
0 Success
Exception
Exception Description
Example
sock = client_socket_open(“192.168.137.200”, 20002)
client_socket_close(sock)
Features
This function receives data from the server.
Parameters
Parameter Default
Data Type Description
Name Value
Socket instance returned
sock socket.socket -
from client_socket_open()
Return
Value (res, rx_data) Description
Exception
Exception Description
293
Tcp/Client
Example
sock = client_socket_open(“192.168.137.200”, 20002)
tp_popup("connect O.K!",DR_PM_MESSAGE)
while 1:
client_socket_write(g_sock, b"abcd") # The string “abcd” is sent in a byte type.
wait(0.1)
res, rx_data = client_socket_read(g_sock) # Waits for the data from the server.
tp_popup("res={0}, rx_data ={1}".format(res, rx_data), DR_PM_MESSAGE)
wait(0.1)
The example connects to the server and sends the string “abcd”. (b converts the str
ing to a byte type.)
The message received from the server is output to the TP.
res = 4 and rx_data=b”abcd” since the server transmits the received data as is.
295
Tcp/Client
send_data = b"MEAS_START"
data1 =1
data2 =2
send_data += (data1).to_bytes(4, byteorder='big')
send_data += (data2).to_bytes(4, byteorder='big')
client_socket_write(g_sock, send_data)
wait(0.1)
client_socket_close(g_sock)
The example connects to the server and sends a byte type send_data.
res = 18 and rx_data=send_data since the server transmits the received data as is.
rxd1 extraction: Conversion of 10th - 14th bytes to an integer
rxd2 extraction: Conversion of 14th - 18th bytes to an integer
The final result is res=18, rxd1=1, and rxd2=2.
Example 3: Reconnection
def fn_reconnect():
global g_sock
client_socket_close(g_sock)
g_sock = client_socket_open("192.168.137.200", 20002)
return
client_socket_write(g_sock, b"abcd")
wait(0.1)
while 1:
res, rx_data = client_socket_read(g_sock)
if res < 0:
fn_reconnect()
else:
tp_popup("res={0}, rx_data ={1}".format(res, rx_data), DR_PM_MESSAGE)
wait(0.1)
297
Tcp/Server
8.3 Tcp/Server
8.3.1 server_socket_open(port)
Features
The robot controller creates a server socket and waits for the connection to the cli
ent. The connected socket is returned when the client is connected.
Parameters
Parameter Default
Data Type Description
Name Value
port int - Port number to open
Return
Value Description
Exception
Exception Description
Example
sock = server_socket_open(20002)
# Opens the port 20002 and waits until the client connects.
# The connected socket is returned if the connection is successful.
# The data is read, written, and closed using the returned socket as shown belo
w.
8.3.2 server_socket_close(sock)
Features
This function terminates communication with the client. To reconnect to the client, t
he socket must be closed with server_socket_close(sock) and reopened.
Parameters
Parameter Default
Data Type Description
Name Value
Socket instance returned from
sock socket.socket - server_socket_open()
socket instance
Return
Value Description
0 Successful disconnection
Exception
Exception Description
Example
sock = server_socket_open(20002)
# Opens the port 20002 and waits until the client connects.
# do something…
299
Tcp/Server
8.3.3 server_socket_state(sock)
Features
This function returns the socket connection status.
Parameters
Parameter Default
Data Type Description
Name Value
Socket instance returned from
sock socket.socket - server_socket_open()
socket instance
Return
Value Description
1 Connected state
0 Disconnected state
Exception
Exception Description
Example
sock = server_socket_open(20002)
server_socket_close(sock)
Features
This function transmits data to the client.
Parameters
Parameter Default
Data Type Description
Name Value
Socket instance returned from
sock socket.socket - server_socket_open()
socket instance
Data to be transmitted
tx_data byte - The data type must be a byte.
Refer to the example below.
Return
Value Description
0 Success
Exception
Exception Description
Example
sock = server_socket_open(20002)
server_socket_close(sock)
301
Tcp/Server
Features
This function reads data from the client.
Parameters
Defaul
Paramete
Data Type t Description
r Name
Value
Socket instance returned from
sock socket.socket - server_socket_open()
socket instance
Return
Value (res, rx_data) Description
Example
sock = server_socket_open(20002)
server_socket_close(sock)
303
Tcp/Server
The example assumes that the client connects to the controller with IP = 192,168,
137.100 and port = 20002
and that the received packets are sent to the server as they are (mirroring).
while 1:
server_socket_write(g_sock, b"abcd") # The string “abcd” is sent in a byte typ
e.
wait(0.1)
res, rx_data = server_socket_read(g_sock) # Waits for the data from the server.
tp_popup("res={0}, rx_data ={1}".format(res, rx_data), DR_PM_MESSAGE)
wait(0.1)
The example opens the port 20002 and waits until the client connects.
It connects to the client and sends the string “abcd”.
The message received from the client is output to the TP.
res = 4 and rx_data=b”abcd” since the client transmits the received data as is.
g_sock = server_socket_open(20002)
tp_popup("connect O.K!",DR_PM_MESSAGE)
send_data = b"MEAS_START"
data1 =1
data2 =2
send_data += (data1).to_bytes(4, byteorder='big')
send_data += (data2).to_bytes(4, byteorder='big')
server_socket_write(g_sock, send_data)
wait(0.1)
server_socket_close(g_sock)
305
Tcp/Server
Example 3: Reconnection
def fn_reopen():
global g_sock
server_socket_close(g_sock)
g_sock = server_socket_open(20002)
return
g_sock = server_socket_open(20002)
tp_popup("connect O.K!",DR_PM_MESSAGE)
server_socket_write(g_sock, b"abcd")
wait(0.1)
while 1:
res, rx_data = server_socket_read(g_sock)
if res < 0:
fn_reopen()
else:
tp_popup("res={0}, rx_data ={1}".format(res, rx_data), DR_PM_MESSAGE)
wait(0.1)
which can measure the object position (Tx, Ty) data and the rotation (Rz) data (offset
information) to guide the inputted robot task, and the commands can receive the
measurement data inputs of multiple objects. The installation and tasks of the robot
application using the 2D vision system need to calibrate the visual coordinate system of
the vision system to the physical coordinate system of the robot system (coordinate
system correction). When using an external vision system, the vision system must
calibrate the coordinate system and transfer the corrected coordinate data to the robot.
The vision system can be installed in the Eye-in-hand mode connected to the robot or
in-line mode separated from the robot. It must be fixed so that the relative position of
the robot and vision system does not change during a task. The vision system and the
robot controller communicate through the TCP/IP protocol, and communication is
established when the cable of the vision system is connected to the wired hub port of
307
vs_set_info(type)
9.2 vs_set_info(type)
Features
This function set the type of vision system to use.
Parameters
Parameter Default
Data Type Description
Name Value
DR_VS_CUSTOM(0)
DR_VS_CU
type int DR_VS_COGNEX(1)
STOM
DR_VS_SICK(2)
Return
Value Description
ID of Type ID of type to set
Example
vs_set_info(DR_VS_COGNEX) #Vision type information setting
vs_connect("192.168.137.10") #Connect to vision - Vision IP, Default port
# Enter your task
vs_disconnect() #Disconnect to vision
* Supported Model
Type Model
DR_VS_COGNEX COGNEX IS2000M-23M Series
COGNEX IS7000Series
COGNEX IS8000Series
DR_VS_CUSTOM
Parameters
Parameter Default
Data Type Description
Name Value
ip_addr str - Server IP of vison module (ex. 192.168.137.200)
Return
Value Description
0 Connection success
-1 Connection failed
Example
vs_set_info(DR_VS_COGNEX) #Vision type information setting
vs_connect("192.168.137.10") #Connect to vision - Vision IP, Default port
# Enter your task
vs_disconnect() #Disconnect to vision
309
vs_disconnect()
9.4 vs_disconnect()
Features
This function terminates the connection to the vision system.
Return
Value Description
N/A N/A
Example
vs_set_info(DR_VS_COGNEX) #Vision type information setting
vs_connect("192.168.137.10") #Connect to vision - Vision IP, Default port
# Enter your task
vs_disconnect() #Disconnect to vision
9.5 vs_get_job()
Features
This function loaded the task name, currently loaded in the vision system.(*VS_TYPE: DR_VS_CO
GNEX, DR_VS_SICK)
Return
Value Data Type Description
job_name string Connection success
Example
vs_set_info(DR_VS_COGNEX) #Vision type information setting
vs_connect("192.168.137.10") #Connect to vision - Vision IP, Default port
311
vs_set_job(job_name)
9.6 vs_set_job(job_name)
Features
This function loaded the entered task into the vision system.
Parameters
Parameter Default
Data Type Description
Name Value
job_name string Task name to be loaded
Return
Value Data Type Description
0 int Success
-1 int Failed
Example
9.7 vs_trigger()
Features
This function transmits the measurement command to the vision system. If the measurement is
successful, the result is returned.(*VS_TYPE: DR_VS_COGNEX, DR_VS_SICK)
Return
Value Data Type Description
pos: measuring position of an object (posx parameter
pos posx
type)
Example
vs_set_info(DR_VS_COGNEX) # Select type of vision sensor
vs_connect("192.168.137.10") # Vision IP, Default port
for i in range(10):
pos, var_list = vs_trigger() # Execute the vision meausrement
if var_list[0] == 1: # Check the inspection result
robot_posx_meas = vs_get_offset_pos(pos, VS_POS1) # offset the robot po
se
movel(robot_posx_meas) # move the robot pose
else:
tp_popup("Inspection Fail")
vs_disconnect()
313
vs_set_init_pos(vision_posx_init, robot_posx_init, vs_pos=1)
Parameters
Parameter Data Default
Description
Name Type Value
vision_posx_init posx - Vision measurement coordinate initial value
Return
Value Data Type Description
vs_pos int Success – The entered pos number입력된 pos 번호
-1 int Failed
Example
vs_set_info(DR_VS_COGNEX) # Select type of vision sensor
vs_connect("192.168.137.10") # Vision IP, Default port
vis_posx = posx (410,310,300,0,0,0) # Define the initial posx data - vision
rob_posx = posx (400,300,300,0,180,0) # Define the initial posx data - robot
vs_set_init_pos(vis_posx, rob_posx, VS_POS1) # Enter the initial posx data to Vision
for i in range(10):
pos, var_list = vs_trigger() # Execute the vision meausrement
if var_list[0] == 1: # Check the inspection result
robot_posx_meas = vs_get_offset_pos(pos, VS_POS1) # offset the robot pose
movel(robot_posx_meas) # move the robot pose
else:
tp_popup("Inspection Fail")
vs_disconnect()
Parameters
Data Default
Parameter Name Description
Type Value
Vision measurement coordinate values, caculated
vision_posx_meas posx -
using vs_trigger
Return
Value Data Type Description
robot_posx_meas posx Success
-1 int Failed
Example
vs_set_info(DR_VS_COGNEX) # Select type of vision sensor
vs_connect("192.168.137.10") # Vision IP, Default port
for i in range(10):
pos, var_list = vs_trigger() # Execute the vision meausrement
if var_list[0] == 1: # Check the inspection result
robot_posx_meas = vs_get_offset_pos(pos, VS_POS1) # offset the robot pose
movel(robot_posx_meas) # move the robot pose
else:
tp_popup("Inspection Fail")
vs_disconnect()
315
Integrated example (DR_VS_COGNEX, DR_VS_SICK)
for i in range(10):
pos_meas, var_list = vs_trigger() # Execute the vision meausrement
if pos_meas==-1: # Vision Fail to measure the object
tp_popup("Vision measure fail")
continue
if var_list[0] == 1: # Check the inspection result
# Get guided posx data
rob_posx1_meas = vs_get_offset_pos(pos_meas, VS_POS1) # offset the robot pose
rob_posx2_meas = vs_get_offset_pos(pos_meas, VS_POS2) # offset the robot pose
movel(rob_posx1_meas)
movel(rob_posx2_meas)
else:
tp_popup("Inspection Fail")
continue
vs_disconnect()
9.11 vs_request(cmd)
Features
This function sets the feature for the vision system to request
(*VS_TYPE: DR_VS_CUSTOM)
Parameters
Parameter Default
Data Type Description
Name Value
cmd int - The number of objects to be detected by the vision
system
Return
Value Description
0 Success
-1 Failed
-2 Communication timed out (3 sec.)
Example
vs_request(1) # request the vision measurement on the “1” job
317
vs_result()
9.12 vs_result()
Features
This function retrieves the processing result of the vision system.
(*VS_TYPE: DR_VS_CUSTOM)
Return
Value Description
cnt Success
(>=1) The number of objects detected by the vision system
Position list as a result of the vision system (x coordinate, y
result
coordinate, rotation value)
- cnt =-2 and res = empty list if failed
예제
vs_set_info(DR_VS_CUSTOM)
res = vs_connect("192.168.137.200", 9999) #Vision and communication
connection attempt
if res !=0: #Check the result of
communication connection
tp_popup("connection fail",DR_PM_MESSAGE) #접속 실패 시, 프로그램 종료
exit()
for i in range(cnt):
x = result[i][0]
y = result[i][1]
t = result[i][2]
tp_popup("x={0},y={1}, t={2}".format(result[i][0], result[i][1],
result[i][2]),DR_PM_MESSAGE)
vs_request (cmd)
1) Robot controller → Vision system
“MEAS_START" +cmd[4byte]
- cmd refers to the number of detected objects: Conversion of the integer to 4 bytes. ex) cmd=1
→ 00000001
ex) In case of cmd= 1 : “MEAS_START"+00000001
Acutal packet : 4D4541535F535441525400000001
2) Vision system → Robot controller
319
Intergrated Example
VS_result()
1) Robot controller → Vision system
“MEAS_REQUEST"
2) Vision system → Robot controller
“MEAS_INFO" +cnt[4byte] +[(x[4byte] + y[4byte] + t[4byte]) x cnt]
- cnt refers to the number of detected objects.
- The transmitted x (x coordinate), y (y coordinate), and t (rotation value) must be scaled up
100 times.
ex) cnt = 1 , (x=1.1 , y=2.2, t=3.3)
“MEAS_INFO"+1[4byte] +110[4byte] +220[4byte] +330[4byte]
Actual packet: 4D4541535F494E464F000000010000006E000000DC0000014A
ex) cnt = 2 , (x=1.1 , y=2.2, t=3.3) (x=1.1 , y=-2.2, t=-3.3)
“MEAS_ INFO"+2[4byte] +110[4byte] +220[4byte] +330[4byte]
+110[4byte] -220[4byte] -330[4byte]
Actual packet: 4D4541535F494E464F000000020000006E000000DC0000014A
0000006EFFFFFF24FFFFFEB6
Example
vs_set_info(DR_VS_CUSTOM)
res = vs_connect("192.168.137.200", 9999) #Vision and communication
connection attempt
if res !=0: #Check the result of communication
connection
tp_popup("connection fail",DR_PM_MESSAGE) #Upon connection failure, program
termination
exit()
for i in range(cnt):
x = result[i][0]
y = result[i][1]
t = result[i][2]
tp_popup("x={0},y={1}, t={2}".format(result[i][0], result[i][1],
result[i][2]),DR_PM_MESSAGE)
321