0% found this document useful (0 votes)
55 views322 pages

Doosan Robotics Programming Manual v1.0 Eng

Uploaded by

c.gryzon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views322 pages

Doosan Robotics Programming Manual v1.0 Eng

Uploaded by

c.gryzon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 322

Table of Contents

1. DRL Basic Syntax ....................................................... 24


1.1 Indent ...................................................................................................................24
1.2 Comment.............................................................................................................24
1.3 Semicolon ...........................................................................................................25
1.4 Variable name.....................................................................................................25
1.5 Numeric value ....................................................................................................25
1.6 Character.............................................................................................................26
1.6.1 String ............................................................................................................................................................................... 26
1.6.2 Escape character........................................................................................................................................................ 26
1.6.3 +, * .................................................................................................................................................................................... 26
1.6.4 Indexing & slicing ......................................................................................................................................................... 26

1.7 list .........................................................................................................................27


1.8 set .........................................................................................................................27
1.9 tuple .....................................................................................................................27
1.10 dictionary ............................................................................................................28
1.11 Function ..............................................................................................................28
1.12 Scoping rule .......................................................................................................29
1.13 Parameter mode ................................................................................................29
1.14 lambda .................................................................................................................30
1.15 pass......................................................................................................................30
1.16 __doc__ ...............................................................................................................30
1.17 help() ....................................................................................................................31
1.18 iterator..................................................................................................................31
1.19 generator .............................................................................................................31
1.20 If ............................................................................................................................32
1.21 While ....................................................................................................................32
1.22 for .........................................................................................................................33
1.23 break ....................................................................................................................33
1.24 continue...............................................................................................................33
1.25 Else in a loop ......................................................................................................34

2. Motion-related Commands ......................................... 35


2.1 posj(q1=0, q2=0, q3=0, q4=0, q5=0, q6=0) .....................................................35
2.2 posx(x=0, y=0, z=0, w=0, p=0, r=0)..................................................................36
2.3 trans(pos, delta, ref) ..........................................................................................37
2.4 posb(seg_type, posx1, posx2=None, radius=0) ..........................................39
2.5 fkin(pos) ..............................................................................................................41
2.6 ikin(pos, sol_space) ..........................................................................................42
2.7 addto(pos, add_val=None) ..............................................................................44
2.8 set_velj(vel) .........................................................................................................45
2.9 set_accj(acc).......................................................................................................46
2.10 set_velx(vel1, vel2) ............................................................................................47
2.11 set_velx(vel)........................................................................................................49
2.12 set_accx(acc1, acc2).........................................................................................51
2.13 set_accx(acc) .....................................................................................................53
2.14 set_tcp(name).....................................................................................................55
2.15 set_ref_coord(coord) ........................................................................................56
2.16 movej ...................................................................................................................58
2.17 movel ...................................................................................................................61
2.18 movejx .................................................................................................................65
2.19 movec ..................................................................................................................68
2.20 movesj .................................................................................................................72
2.21 movesx ................................................................................................................75
2.22 moveb ..................................................................................................................80
2.23 move_spiral ........................................................................................................85
2.24 move_periodic ...................................................................................................88
2.25 amovej .................................................................................................................92
2.26 amovel .................................................................................................................95
2.27 amovejx ...............................................................................................................98

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

3. Auxiliary Control Commands .................................. 135


3.1 get_control_mode().........................................................................................135
3.2 get_control_space() ........................................................................................136
3.3 get_current_posj() ...........................................................................................137
3.4 get_current_velj().............................................................................................138
3.5 get_desired_posj()...........................................................................................139
3.6 get_desired_velj() ............................................................................................140
3.7 get_current_posx(ref) .....................................................................................141
3.8 get_current_tool_flange_posx() ...................................................................143
3.9 get_current_velx()............................................................................................144
3.10 get_desired_posx(ref).....................................................................................145
3.11 get_desired_velx() ...........................................................................................146
3.12 get_current_solution_space() .......................................................................147
3.13 get_current_rotm() ..........................................................................................148
3.14 get_joint_torque() ............................................................................................149
3.15 get_external_torque()......................................................................................150

Doosan Robotics Programming Manual (ver.1.0) 4


3.16 get_tool_force()................................................................................................151
3.17 get_solution_space(pos) ...............................................................................152
3.18 get_orientation_error(xd, xc, axis) ...............................................................153

4. Other Settings and Safety-related Commands ...... 154


4.1 enable_virtual_wall() .......................................................................................154
4.2 disable_virtual_wall() ......................................................................................155
4.3 set_workpiece_weight(weight, cog) ............................................................156
4.4 get_workpiece_weight() .................................................................................157
4.5 reset_workpiece_weight()..............................................................................158
4.6 estimate_load().................................................................................................159
4.7 set_tool(name) .................................................................................................160
4.8 set_singular_handling(mode) .......................................................................161

5. Force/Stiffness Control and Other User-Friendly


Features .......................................................................... 164
5.1 parallel_axis(x1, x2, x3, axis) .........................................................................164
5.2 parallel_axis(vect, axis) ..................................................................................166
5.3 align_axis(x1, x2, x3, pos, axis).....................................................................167
5.4 align_axis(vect, pos, axis)..............................................................................169
5.5 is_done_bolt_tightening(m=0, timeout=0, axis=None) ............................170
5.6 release_compliance_ctrl()..............................................................................172
5.7 task_compliance_ctrl......................................................................................173
5.8 set_stiffnessx ...................................................................................................175
5.9 set_user_cart_coord.......................................................................................177
5.10 set_user_cart_coord.......................................................................................179
5.11 set_desired_force............................................................................................181
5.12 release_force(time=0) .....................................................................................183
5.13 check_position_condition .............................................................................185
5.14 check_force_condition...................................................................................187

5
5.15 check_orientation_condition ........................................................................189
5.16 check_orientation_condition ........................................................................192

6. System Commands ................................................... 195


6.1 IO Related..........................................................................................................195
6.1.1 set_digital_output(index, val =None) ....................................................................................................................195
6.1.2 set_digital_outputs(bit_list)........................................................................................................................................197
6.1.3 set_digital_outputs(bit_start, bit_end, val).............................................................................................................198
6.1.4 get_digital_input(index).............................................................................................................................................200
6.1.5 get_digital_inputs(bit_list) ..........................................................................................................................................201
6.1.6 get_digital_inputs(bit_start, bit_end).......................................................................................................................202
6.1.7 wait_digital_input(index, val, timeout=None)......................................................................................................203
6.1.8 set_tool_digital_output(index, val=None) ............................................................................................................205
6.1.9 set_tool_digital_outputs(bit_list)...............................................................................................................................206
6.1.10 set_tool_digital_outputs(bit_start, bit_end, val)....................................................................................................207
6.1.11 get_tool_digital_input(index)....................................................................................................................................209
6.1.12 get_tool_digital_inputs(bit_list) .................................................................................................................................210
6.1.13 get_tool_digital_inputs(bit_start, bit_end)..............................................................................................................211
6.1.14 wait_tool_digital_input(index, val, timeout=None).............................................................................................213
6.1.15 set_mode_analog_output(ch, mod )....................................................................................................................215
6.1.16 set_mode_analog_input(ch, mod ) ......................................................................................................................216
6.1.17 set_analog_output(ch, val)......................................................................................................................................217
6.1.18 get_analog_input(ch)................................................................................................................................................217
6.1.19 add_modbus_signal (ip, port, name, reg_type, index, value=0)..................................................................219
6.1.20 del_modbus_signal (name) ...................................................................................................................................223
6.1.21 set_modbus_output(iobus, val).............................................................................................................................224
6.1.22 set_modbus_outputs(iobus_list, val_list)..............................................................................................................225
6.1.23 get_modbus_input(iobus).......................................................................................................................................226
6.1.24 get_modbus_inputs(iobus_list)..............................................................................................................................227
6.1.25 wait_modbus_input(iobus, val, timeout=None)................................................................................................228

6.2 TP Interface.......................................................................................................230

Doosan Robotics Programming Manual (ver.1.0) 6


6.2.1 tp_popup(message, pm_type=DR_PM_MESSAGE).................................................................................230
6.2.2 tp_log(message)........................................................................................................................................................232
6.2.3 tp_progress(cur_progress, total_progress) ........................................................................................................233
6.2.4 tp_get_user_input(message, input_type) ...........................................................................................................234

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

6.4 Others ................................................................................................................244


6.4.1 wait(time)......................................................................................................................................................................244
6.4.2 exit()................................................................................................................................................................................245

7. Mathematical Function ............................................. 246


7.1 sin(x) ..................................................................................................................246
7.2 cos(x) .................................................................................................................247
7.3 tan(x) ..................................................................................................................248
7.4 asin(x) ................................................................................................................249
7.5 acos(x) ...............................................................................................................250
7.6 atan(x) ................................................................................................................251
7.7 atan2(y, x)..........................................................................................................252
7.8 ceil(x)..................................................................................................................253
7.9 floor(x)................................................................................................................254
7.10 pow(x, y) ............................................................................................................255
7.11 sqrt(x).................................................................................................................256
7.12 log(x, b) ..............................................................................................................257
7.13 d2r(x) ..................................................................................................................258
7.14 r2d(x) ..................................................................................................................259

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. External Communication Commands ..................... 281


8.1 Serial ..................................................................................................................281
8.1.1 serial_open(port=None, baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)..................................................................................281
8.1.2 serial_close(ser)..........................................................................................................................................................283
8.1.3 serial_state(ser) ..........................................................................................................................................................284
8.1.4 serial_set_inter_byte_timeout(ser, timeout=None)...........................................................................................285
8.1.5 serial_write(ser, tx_data)...........................................................................................................................................286

Doosan Robotics Programming Manual (ver.1.0) 8


8.1.6 serial_read(ser, length=-1, timeout=-1)................................................................................................................287

8.2 Tcp/Client ..........................................................................................................289


8.2.1 client_socket_open(ip, port) ....................................................................................................................................289
8.2.2 client_socket_close(sock)........................................................................................................................................290
8.2.3 client_socket_state(sock).........................................................................................................................................291
8.2.4 client_socket_write(sock, tx_data).........................................................................................................................292
8.2.5 client_socket_read(sock, length=-1, timeout=-1)..............................................................................................293
8.2.6 Integrated example...................................................................................................................................................295

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. External Vision Commands ..................................... 307


9.1 Overview ...........................................................................................................307
9.2 vs_set_info(type) .............................................................................................308
9.3 vs_connect(ip_addr, port_num=9999) ........................................................309
9.4 vs_disconnect() ...............................................................................................310
9.5 vs_get_job() ......................................................................................................311
9.6 vs_set_job(job_name) ....................................................................................312
9.7 vs_trigger()........................................................................................................313
9.8 vs_set_init_pos(vision_posx_init, robot_posx_init, vs_pos=1) .............314
9.9 vs_get_offset_pos(vision_posx _meas, vs_pos=1) .................................315
9.10 Integrated example (DR_VS_COGNEX, DR_VS_SICK)............................316
9.11 vs_request(cmd)..............................................................................................317
9.12 vs_result() .........................................................................................................318
9.13 Intergrated Example........................................................................................319

9
 DRL Basic Syntax
No. Function Description

1.1 Indent This function is used to separate each code block.

This function is used to provide an additional description of the


1.2 Comment code. The comments do not affect the source code since they are
excluded from code processing.

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.5 Numeric value int, float, complex

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.

This function is similar to a list but is faster at processing since it is


1.9 tuple
read-only.

1.10 dictionary This function specifies the keys and values and lists the values.

This function is used to obtain a value by inputting the function


1.11 Function
name.

If there is no value corresponding to the local variable name in a


1.12 Scoping rule
function, the name can be found based on the LGB rule.

This function uses default parameter values, keyword parameters,


1.13 Parameter mode
and variable parameters.

1.14 lambda This function indicates a one-line function without a name.

1.15 pass This function is used when an operation is not executed.

This function is used when an additional description of a function is


1.16 __doc__
needed.

1.17 help() This function is used to describe a function.

This function provides a way to access the elements of a cyclic


1.18 iterator
object in order.

1.19 generator This function is used to generate an iterator using a “yield” syntax

Doosan Robotics Programming Manual (ver.1.0) 10


No. Function Description
instead of a function return.

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.

This function is a conditional function that repeats an operation


1.21 While
according to whether the condition is true or false.

This function repeats an operation within the specified repeating


1.22 for
“range”.

1.23 break This function exits the internal block of a loop.

This function stops further executing the internal block of a loop


1.24 continue
and returns to the beginning point of the loop.

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)

This function is equivalent to “addto” in the task space and returns


2.3 trans(pos, delta, ref) the value after homogeneous transformation as much as the delta
of an object in the task space.

Input parameters for constant-velocity blending motion (moveb and


posb(seg_type, posx1, amoveb) with the Posb coordinates of each waypoint and the data
2.4
posx2=None, radius=0) of the unit path type (line or arc) define the unit segment object of
the trajectory to be blended.

This function receives the input data of points or equivalent forms


2.5 fkin(pos) (float[6]) in joint space and returns the coordinates of the TCP
(objects in the task space).

This function returns to the joint location corresponding to


2.6 ikin(pos, sol_space)
sol_space, which is equivalent to the robot pose in the task space,

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.

2.13 set_ref_coord(coord) This function sets the reference coordinate system.

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.

The radius increases in a radial direction and the robot moves in


2.21 move_spiral
parallel with the rotating spiral motion in an axial direction.

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)

Doosan Robotics Programming Manual (ver.1.0) 12


No. Function Description
input as a relative motion that begins at the current position.

The asynchronous movej motion operates in the same way as movej


2.23
amovej except that it does not have the radius parameter for blending.

The asynchronous movel motion operates in the same way as movel


2.24 amovel
except that it does not have the radius parameter for blending.

The asynchronous movejx motion operates in the same way as


2.25 amovejx movejx except that it does not have the radius parameter for
blending.

The asynchronous movec motion operates in the same way as


2.26 amovec movec except that it does not have the radius parameter for
blending.

The asynchronous movesj motion operates in the same way as


2.27 amovesj
movesj() except for the asynchronous processing.

The asynchronous movesx motion operates in the same way as


2.28 amovesx
movesx() except for the asynchronous processing.

The asynchronous moveb motion operates in the same way as


2.29 amoveb moveb() except for the asynchronous processing and executes the
next line after the command is executed.

The asynchronous move_spiral motion operates in the same way as


2.30 amove_spiral move_spiral() except for the asynchronous processing and executes
the next line after the command is executed.

The asynchronous move_periodic motion operates in the same way


2.31 amove_periodic as move_periodic() except for the asynchronous processing and
executes the next line after the command is executed.

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.33 begin_blend(radius=0) This function begins the blending section.

2.34 end_blend() This function ends the blending section.

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.1 get_control_mode() This function returns the current control mode.

3.2 get_control_space() This function returns the current control space.

3.3 get_current_posj() This function returns the current joint angle.

3.4 get_current_velj() This function returns the current joint velocity.

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.

This function returns the pose and solution space of the


3.7 get_current_posx(ref)
current coordinate system.

3.8 get_current_tool_flange_posx() This function returns the pose of the current tool flange.

3.9 get_current_velx() This function returns the current tool velocity.

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.

This function returns the direction and matrix of the


3.13 get_current_rotm()
current tool.

This function returns the sensor torque value of the


3.14 get_joint_torque()
current joint.

This function returns the torque value generated by the


3.15 get_external_torque()
external force on each current joint.

This function returns the external force applied to the


3.16 get_tool_force()
current tool.

3.17 get_solution_space(pos) This function obtains the 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.

 Other Settings and Safety-related Commands

4.1 enable_virtual_wall() This function enables the virtual domain.

Doosan Robotics Programming Manual (ver.1.0) 14


4.2 disable_virtual_wall() This function disables the virtual domain.

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.

This function retrieves the tool data registered in the Teach


4.7 set_tool(name)
Pendant by name.

set_singular_handling(m In case of path deviation due to the effect of singularity in task


4.8
ode) motion, user can select the response policy

15
 Force/Stiffness Control and Other User-Friendly Features
No. Function Description

This function matches the axis received as the argument axis


5.1 parallel_axis(x1, x2, x3, axis) in the normal vector and tool frame obtained by get_normal
(x1, x2, x3).

This function matches the axis received as the argument axis


5.2 parallel_axis(vect, axis)
in the tool frame in the given vect direction.

This function matches the axis received as the argument axis


align_axis(x1, x2, x3, pos,
5.3 in the normal vector and tool frame obtained by get_normal
axis)
(x1, x2, x3).

This function matches the axis received as the argument axis


5.4 align_axis(vect, pos, axis)
in the tool frame in the given vect direction.

This function monitors the tightening torque of the tool and


is_done_bolt_tightening(m=0,
5.5 returns True if the set torque (m) is reached within the given
timeout=0, axis=None)
time and False if the given time has passed.

This function terminates compliance control and begins


5.6 release_compliance_ctrl()
position control at the current position.

This function begins task compliance control based on the


5.7 task_compliance_ctrl
preset reference coordinate system.

5.8 set_stiffnessx This function sets the stiffness value.

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.

This function reduces the force control target value to 0


5.12 through the time value and returns the task space to
release_force(time=0)
adaptive control.

5.13 check_position_condition This function checks the status of the given position.

This function checks the status of the given force. It


5.14 check_force_condition
disregards the force direction and only compares the sizes.

This function checks the difference between the current pose


5.15 check_orientation_condition
and the specified pose of the robot end effector.

5.16 check_orientation_condition This function checks the difference between the current pose

Doosan Robotics Programming Manual (ver.1.0) 16


No. Function Description
and the rotating angle range of the robot end effector.

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.

This function sends a signal at multiple digital output


6.1.2 set_digital_outputs(bit_list)
contact points of the controller.

This function sends multiple signals at once from the digital


set_digital_outputs(bit_start,
6.1.3 output start contact point (bit_start) to the end contact
bit_end, val)
point (bit_end) of the controller.

This function reads the signals from digital contact points of


6.1.4 get_digital_input(index)
the controller and reads the digital input contact value.

This function reads the signals from multiple digital contact


6.1.5 get_digital_inputs(bit_list)
points of the controller.

This function reads multiple signals at once from the digital


get_digital_inputs(bit_start,
6.1.6 input start contact point (start_index) to the end contact
bit_end)
point (end_index) of 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.

Doosan Robotics Programming Manual (ver.1.0) 18


No. Function Description

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.

This function outputs the channel value corresponding to


6.1.17 set_analog_output(ch, val)
the controller analog output.

This function reads the channel value corresponding to the


6.1.18 get_analog_input(ch)
controller analog input.

add_modbus_signal (ip, port,


6.1.19 This function registers the Modbus signal.
name, reg_type, index, value=0)

6.1.20 del_modbus_signal (name) This function deletes the registered Modbus signal.

This function sends the signal to an external Modbus


6.1.21 set_modbus_output(iobus, val)
system.

set_modbus_outputs(iobus_list, This function sends the multiple signals to the digital


6.1.22
val_list) contact points of the external Modbus digital I/O unit.

6.1.23 get_modbus_input(iobus) This function reads the signal from the Modbus system.

This function reads multiple signals from the digital input


6.1.24 get_modbus_inputs(iobus_list)
contact points of the external Modbus digital I/O unit.

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_popup(message, This function provides a message to users through the


6.2.1
pm_type=DR_PM_MESSAGE) Teach Pendant.

This function records the user-written log to the Teach


6.2.2 tp_log(message)
Pendant.

tp_progress(cur_progress, This function provides a message to users through the


6.2.3
total_progress) Teach Pendant.

tp_get_user_input(message, This function receives the user input data through the Teach
6.2.4
input_type) Pendant.

This function creates and executes a thread. The features


thread_run(th_func_name,
6.3.1 executed by the thread are determined by the functions
loop=False)
specified in th_func_name.

19
No. Function Description

6.3.2 thread_stop(th_id) This function terminates a thread.

6.3.3 thread_pause(th_id) This function temporarily suspends a thread.

6.3.4 thread_resume(th_id) This function resumes a temporarily suspended thread.

6.3.5 thread_state(th_id) This function checks the status of a thread.

6.4.1 wait(time) This function waits for the specified time.

6.4.2 exit() This function terminates the currently running program.

Doosan Robotics Programming Manual (ver.1.0) 20


 Mathematical Function
No. Function Description

7.1 sin(x) This function returns the sine value of x radians.

7.2 cos(x) This function returns the cosine value of x radians.

7.3 tan(x) This function returns the tangent value of x radians.

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.

This function returns the smallest integer value of integers


7.8 ceil(x)
larger than x.

This function returns the largest integer value of integers


7.9 floor(x)
smaller than x.

7.10 pow(x, y) Return x raised to the power of y.

7.11 sqrt(x) This function returns the square root of x.

7.12 log(x, b) This function returns the log of x with base b.

7.13 d2r(x) This function returns the x radians value to degrees.

7.14 r2d(x) This function returns the x radians value to degrees.

7.15 norm(x) This function returns the L2 norm of x.

7.16 random() This function returns a random number.

This function returns a rotation matrix that rotates by the


7.17 rotx(angle)
angle value along the x-axis.

This function returns a rotation matrix that rotates by the


7.18 roty(angle)
angle value along the y-axis.

This function returns a rotation matrix that rotates by the


7.19 rotz(angle)
angle value along the z-axis.

This function receives a rotation matrix and returns the Euler


7.20 rotm2eul(rotm)
angle (zyz order) to degrees.

This function receives a rotation matrix and returns the


7.21 rotm2rotvec(rotm)
rotation vector (angle/axis representation).

7.22 eul2rotm([alpha,beta,gamma]) This function transforms a Euler angle (zyz order) to a

21
No. Function Description
rotation matrix.

eul2rotvec([alpha,beta,gamma This function transforms a Euler angle (zyz order) to a


7.23
]) rotation vector.

This function transforms a rotation vector to a Euler angle


7.24 rotvec2eul([rx,ry,rz])
(zyz).

7.25 rotvec2rotm([rx,ry,rz]) This function transforms a rotation vector to a rotation matrix.

This function returns the pose corresponding to T1*T2


7.26 htrans(posx1,posx2) assuming that the homogeneous transformation matrices
obtained from posx1 and posx2 are T1 and T2, respectively.

get_intermediate_pose(posx1, This function returns posx located at alpha of the linear


7.27
posx2,alpha) transition from posx1 to posx2.

This function returns the distance between two pose


7.28 get_distance(posx1, posx2)
positions in [mm].

This function returns the normal vector of a surface consisting


7.29 get_normal(x1, x2, x3) of three points (posx) in the task space. This direction is
clockwise.

7.30 add_pose(posx1,posx2) This function obtains the sum of two poses.

7.31 subtract_pose(posx1,posx2) This function obtains the difference between two poses.

This function returns posx corresponding to the inverse of the


7.32 inverse_pose(posx1)
posx.

This function obtains the inner product of the translation


7.33 dot_pose(posx1, posx2)
component when two poses are given.

This function obtains the outer product of the translation


7.34 cross_pose(posx1, posx2)
component when two poses are given.

This function obtains the unit vector of the given posx


7.35 unit_pose(posx1)
translation component.

Doosan Robotics Programming Manual (ver.1.0) 22


 External Communication Commands
No. Function Description

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)

8.1.2 serial_close(ser) This function closes a serial communication port.

This function returns the status of a serial communication


8.1.3 serial_state(ser)
port.

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)

This function creates a socket and attempts to connect it to


8.2.1 client_socket_open(ip, port)
a server (ip, port).

8.2.2 client_socket_close(sock) This function terminates communication with the server.

8.2.3 client_socket_state(sock) This function returns the socket status.

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)

This function creates a socket and waits for the connection


8.3.1 server_socket_open(port) to the client. This function returns the connected socket
when the client is connected.

8.3.2 server_socket_close(sock) This function terminates communication with the client.

8.3.3 server_socket_state(sock) This function returns the socket status.

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

1. DRL Basic Syntax


1.1 Indent
 Features
This function is used to separate each code block. An error occurs if the indentation is not co
mplied.

 Example

1.1.1.1 Code block 1

1.1.1.2 [TAB] Code block 2

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.7 # Comment example 1

1.1.1.8 ’’’

1.1.1.9 Comment example 2

’’’

Doosan Robotics Programming Manual (ver.1.0) 24


1Chapter DRL Basic Syntax

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)

1.4 Variable name


 Features
• This function is used to express the data value and can consist of letters, numbers, and und
erscores (_). The first character cannot be a number.

• Letters are case sensitive.

• Reserved words cannot be used.

 Example

friend = 10

Friend = 1

_myFriend = None

1.5 Numeric value


 Features
This function inputs a value in int, float, or a complex number.

 Example
1.1.1.10 10, 0x10, 0o10, 0b10

1.1.1.11 3.14, 314e-2

x = 3-4j

25
Character

1.6 Character
1.6.1 String

 Features
All character strings are in Unicode.

 Example

"string1"

‘string1’

1.6.2 Escape character

 Example

\n, \t, \r, \o, \\, \’, \"

1.6.3 +, *

 Example
"py"+ "tyon"  "python"
"py"* 3  "pypypy"

1.6.4 Indexing & slicing

 Example
"python" [0]  "p"
"python" [1:4]  "yth"

Doosan Robotics Programming Manual (ver.1.0) 26


1Chapter DRL Basic Syntax

1.7 list
 Features
• The items in a list can be changed and ordered.

• A list can be indexed and sliced.

• append, insert, extend, and + operators

• count, remove, and sort operators

 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.

• It provides the intersection and union.

 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 beginning and ending of a function is specified by an indentation of the code.

• The interface and implementation are not separated. However, they must have been defined
before they are used.

 Function declaration syntax


def <function name> (parameter 1, parameter 2, … parameter N):
<syntax> …
return <return value>

Example)
def Times(a, b):
return a * b

Times(10, 10)

Doosan Robotics Programming Manual (ver.1.0) 28


1Chapter DRL Basic Syntax

1.12 Scoping rule


 Features
• If there is no value corresponding to the local variable name in a function, the name can b
e found based on the LGB rule.

- Namespace: An area that contains the variable name

- Local scope: A namespace and local domain inside a function

- Global scope: Global domain outside a function

- 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

1.13 Parameter mode


 Features
This function uses default parameter values, keyword parameters, and variable parameters.

 Example - Default parameter value


def fn_Times(a = 10, b = 20)
return a * b

fn_Times(5)

 Example - Keyword parameter


def fn_Times(a = 10, b = 20)
return a * b

fn_Times(a=5, b=5)

 Example - Variable parameter

def fn_myUnion(*ar)
…….

fn_myUnion("red", "white", "black")

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…"

Doosan Robotics Programming Manual (ver.1.0) 30


1Chapter DRL Basic Syntax

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]

for cha in fn_reverse("golf"):


print(char)

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>

 Example - if, elif, else


if <conditional statement 1>:
<Syntax 1>
elif <conditional statement 2>:
<Syntax 2>
else:
<Syntax 3>

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>

Doosan Robotics Programming Manual (ver.1.0) 32


1Chapter DRL Basic 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

1.25 Else in a loop


 Features
The “else” block is executed when the loop is executed until the end without being terminate
d by the “break” function in the middle of executing 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")

Doosan Robotics Programming Manual (ver.1.0) 34


2Chapter Motion-related Commands

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

float 1-axis angle or


q1 list 0 angle list or
posj posj

q2 float 0 2-axis angle

q3 float 0 3-axis angle

q4 float 0 4-axis angle

q5 float 0 5-axis angle

q6 float 0 6-axis angle

 Return
posj

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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)

2.2 posx(x=0, y=0, z=0, w=0, p=0, r=0)


 Features
This function designates the task space in coordinate values.

 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

w orientation (z-direction rotation of


w float 0
reference coordinate system)

p orientation (y-direction rotation of w


p float 0
rotated coordinate system)

r orientation (z-direction rotation of w and p


r float 0
rotated coordinate system)

 Return
posx

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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()

Doosan Robotics Programming Manual (ver.1.0) 36


2Chapter Motion-related Commands

2.3 trans(pos, delta, ref)


 Features
• This function is equivalent to “addto” in the task space and returns the value after homogen
eous transformation as much as the delta of an object in the task space.

• 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

posx list (float[6]) task space point

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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)

x1_base = posx(500, 45, 700, 0, 180, 0)


x4 = trans(x1_base, [10, 0, 0, 0, 0, 0], DR_TOOL)
movel(x4, ref=DR_BASE)

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()

Doosan Robotics Programming Manual (ver.1.0) 38


2Chapter Motion-related Commands

2.4 posb(seg_type, posx1, posx2=None, radius=0)


 Features
• Input parameters for constant-velocity blending motion (moveb and amoveb) with the Posb
coordinates of each waypoint and the data of the unit path type (line or arc) define the uni
t segment object of the trajectory to be blended.

• 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

posx1 posx - 1st task posx

posx2 posx - 2nd task posx

radius float 0 Blending radius [mm]

 Return
posb

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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.

x1 = posx(564, 200, 690, 0, 180, 0)


seg1 = posb(DR_LINE, x1, radius=40)
x2 = posx(564, 100, 590, 0, 180, 0)
x2c = posx(564, 200, 490, 0, 180, 0)
seg2 = posb(DR_CIRCLE, x2, x2c, radius=40)
x3 = posx(564, 300, 490, 0, 180, 0)
seg3 = posb(DR_LINE, x3, radius=40)
x4 = posx(564, 400, 590, 0, 180, 0)
x4c = posx(564, 300, 690, 0, 180, 0)
seg4 = posb(DR_CIRCLE, x4, x4c, radius=40)
x5 = posx(664, 300, 690, 0, 180, 0)
seg5 = posb(DR_LINE, x5, radius=40)
x6 = posx(564, 400, 690, 0, 180, 0)
x6c = posx(664, 500, 690, 0, 180, 0)
seg6 = posb(DR_CIRCLE, x6, x6c, radius=40)
x7 = posx(664, 400, 690, 0, 180, 0)
seg7 = posb(DR_LINE, x7, radius=40)
x8 = posx(664, 400, 590, 0, 180, 0)
x8c = posx(564, 400, 490, 0, 180, 0)
seg8 = posb(DR_CIRCLE, x8, x8c, radius=0) # The last radius must be 0.

# If not 0, it is processed as 0.

b_list = [seg1, seg2, seg3, seg4, seg5, seg6, seg7, seg8]

moveb(b_list, vel=200, acc=400)

 Related commands
posx()/moveb()/amoveb()

Doosan Robotics Programming Manual (ver.1.0) 40


2Chapter Motion-related Commands

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

posx Task space point

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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)

2.6 ikin(pos, sol_space)


 Features
This function returns the joint position corresponding to sol_space, which is equivale
nt to the robot pose in the operating space, among 8 joint shapes.

 Parameters
Parameter Default
Data Type Description
Name Value
posx posx or
pos -
list (float[6]) position list

sol_space int - solution space

 Robot configuration vs. solution space


Solution space Binary Shoulder Elbow Wrist
0 000 Lefty Below No Flip

1 001 Lefty Below Flip

2 010 Lefty Above No Flip

3 011 Lefty Above Flip

4 100 Righty Below No Flip

5 101 Righty Below Flip

6 110 Righty Above No Flip

 Return
Value Description

posj Joint space point

Doosan Robotics Programming Manual (ver.1.0) 42


2Chapter Motion-related Commands

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

2.7 addto(pos, add_val=None)


 Features
This function creates a new posj object by adding add_val to each joint value of p
osj.

 Parameters
Parameter Default
Data Type Description
Name Value
posj posj or
pos -
list (float[6]) position list

List of add values to be added to the


add_val list (float[6]) None position
* No value is added if it is None or [].

 Return
Value Description

posj Joint space point

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

 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()

Doosan Robotics Programming Manual (ver.1.0) 44


2Chapter Motion-related Commands

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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)

set_accj([30, 40, 30, 30, 30, 10])

 Related commands
set_velj()/movej()/movejx()/movesj()/amovej()/amovejx()amovesj()

Doosan Robotics Programming Manual (ver.1.0) 46


2Chapter Motion-related Commands

2.10 set_velx(vel1, vel2)


 Features
This function sets the velocity of the task space motion globally. The globally set ve
locity velx is applied as the default velocity if the task motion such as movel(), amo
vel(), movec(), movesx() is called without the explicit input of the velocity value. In t
he set value, vel1 and vel2 define the linear velocity and rotating velocity, relatively,
of TCP.

 Parameters
Parameter Default
Data Type Description
Name Value
vel1 float - velocity 1

vel2 float - velocity 2

 Return
Value Description

0 Success

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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)

nd 20(deg/sec) which are the specified velocity.


<#2
set_velx(10.5, 19.4) # Decimal point input is possible.

 Related commands
set_accx()/movel()/movec()/movesx()/moveb()/move_spiral()/amovel()/amovec()/
amovesx()/amoveb()/amove_spiral()

Doosan Robotics Programming Manual (ver.1.0) 48


2Chapter Motion-related Commands

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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)

movel(P1, vel=20, acc=40) # The task motion linear velocity to P1 is 20(mm/


sec) which is the specified velocity.
#2
set_velx(10.5) # Decimal point input is possible.

 Related commands
set_accx()/movel()/movec()/movesx()/moveb()/move_spiral()/amovel()/amovec()/
amovesx()/amoveb()/amove_spiral()

Doosan Robotics Programming Manual (ver.1.0) 50


2Chapter Motion-related Commands

2.12 set_accx(acc1, acc2)


 Features
This function sets the acceleration of the task space motion globally. The globally s
et acceleration accx is applied as the default acceleration if the task motion such a
s movel(), amovel(), movec(), movesx() is called without the explicit input of the acc
eleration value. In the set value, acc1 and acc2 define the linear acceleration and ro
tating acceleration, relatively, of the TCP.

 Parameters
Parameter Default
Data Type Description
Name Value
acc1 float - acceleration 1

acc2 float - acceleration 2

 Return
Value Description

0 Success

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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()

Doosan Robotics Programming Manual (ver.1.0) 52


2Chapter Motion-related Commands

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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()

Doosan Robotics Programming Manual (ver.1.0) 54


2Chapter Motion-related Commands

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

Doosan Robotics Programming Manual (ver.1.0) 56


2Chapter Motion-related Commands

 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

float None velocity (same to all axes) or


vel (v)
list (float[6]) None velocity (to an axis)

float None acceleration (same to all axes) or


acc (a)
list (float[6]) None acceleration (acceleration to an axis)

time (t) float None Reach time [sec]

radius (r) float None Radius for blending

Movement basis
mod int DR_MV_MOD_ABS  DR_MV_MOD_ABS: Absolute
 DR_MV_MOD_REL: Relative

Reactive motion mode


ra int DR_MV_RA_DUPLICATE  DR_MV_RA_DUPLICATE: duplicate
 DR_MV_RA_OVERRIDE: override

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time, r:radius)


 _global_velj is applied if vel is None. (The initial value of _global_velj is 0.0 and can be set by
set_velj.)
 _global_accj is applied if acc is None. (The initial value of _global_accj is 0.0 and can be set by
set_accj.)
 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.

Doosan Robotics Programming Manual (ver.1.0) 58


2Chapter Motion-related Commands

Caution

If the following motion is blended with the conditions of ra=DR_MV_RA_DUPLICATE and


radius>0, the preceding motion can be terminated when the following motion is terminated
while the remaining motion time determined by the remaining distance, velocity, and
acceleration of the preceding motion is greater than the motion time of the following motion.
Refer to the following image for more information.

 Return
Value Description

0 Success

Negative value Failed

59
movej

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 60


2Chapter Motion-related Commands

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

float None velocity or


vel (v)
list (float[2]) None velocity1, velocity2

float None acceleration or


acc (a)
list (float[2]) None acceleration1, acceleration2

Reach time [sec]

float None * If the time is specified, values are


time (t)
processed based on time, ignoring vel
and acc.

radius (r) float None Radius for blending

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

Reactive motion mode


ra int DR_MV_RA_DUPLICATE  DR_MV_RA_DUPLICATE: duplicate
 DR_MV_RA_OVERRIDE: override

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time, r:radius)


 _global_velx is applied if vel is None. (The initial value of _global_velx is 0.0 and can be set by
set_velx.)

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

If the following motion is blended with the conditions of ra=DR_MV_RA_DUPLICATE and


radius>0, the preceding motion can be terminated when the following motion is terminated
while the remaining motion time determined by the remaining distance, velocity, and
acceleration of the preceding motion is greater than the motion time of the following motion.
Refer to the following image for more information.

Doosan Robotics Programming Manual (ver.1.0) 62


2Chapter Motion-related Commands

 Return
Value Description

0 Success

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 64


2Chapter Motion-related Commands

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

float None velocity (same to all axes) or


vel (v)
list (float[6]) None velocity (to an axis)

float None acceleration (same to all axes) or


acc (a)
list (float[6]) None acceleration (acceleration to an axis)

time (t) float None Reach time [sec]

radius (r) float None Radius for blending

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

Reactive motion mode


ra int DR_MV_RA_DUPLICATE  DR_MV_RA_DUPLICATE: duplicate
 DR_MV_RA_OVERRIDE: override

sol int 0 Solution space

65
movejx

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time, r:radius)


 _global_velj is applied if vel is None. (The initial value of _global_velj is 0.0 and can be set by
set_velj.)
 _global_accj is applied if acc is None. (The initial value of _global_accj is 0.0 and can be set by
set_accj.)
 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.)
 Using the blending in the preceding motion generates an error in the case of input with
relative motion (mod=DR_MV_MOD_REL), and it is recommended to blend using movej() or
movel().
 Refer to the description of movej() and movel() for blending according to option ra and
vel/acc.

 Robot configuration (shape vs. solution space)


Solution space Binary Shoulder Elbow Wrist

0 000 Lefty Below No Flip

1 001 Lefty Below Flip

2 010 Lefty Above No Flip

3 011 Lefty Above Flip

4 100 Righty Below No Flip

5 101 Righty Below Flip

6 110 Righty Above No Flip

7 111 Righty Above Flip

 Return
Value Description

0 Success

Negative value Error

Doosan Robotics Programming Manual (ver.1.0) 66


2Chapter Motion-related Commands

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

float None velocity or


vel (v)
list (float[2]) None velocity1, velocity2

float None acceleration or


acc (a)
list (float[2]) None acceleration1, acceleration2

time (t) float None Reach time [sec]

radius (r) float None Radius for blending

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

Reactive motion mode


ra int DR_MV_RA_DUPLICATE  DR_MV_RA_DUPLICATE: duplicate
 DR_MV_RA_OVERRIDE: override

Doosan Robotics Programming Manual (ver.1.0) 68


2Chapter Motion-related Commands

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

If the following motion is blended with the conditions of ra=DR_MV_RA_DUPLICATE and


radius>0, the preceding motion can be terminated when the following motion is terminated
while the remaining motion time determined by the remaining distance, velocity, and
acceleration of the preceding motion is greater than the motion time of the following motion.
Refer to the following image for more information.

69
movec

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

Doosan Robotics Programming Manual (ver.1.0) 70


2Chapter Motion-related Commands

 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)

movec(P1, P2, vel=30)


# Moves to P2 with a velocity of 30(mm/sec) and global acceleration of 60(mm/sec2)
# via P1 along the arc trajectory.
movej(P0)
movec(P3, P4, vel=30, acc=60)
# Moves to P4 with a velocity of 30(mm/sec) and acceleration of 60(mm/sec 2).
# via P3 along the arc trajectory
movej(P0).
movec(P2, P1, time=5)
# Moves with a global velocity of 30(mm/sec) and acceleration of 60(mm/sec2).
# to P1 along the arc trajectory via P2 at the 5-second point.
movec(P3, P4, time=3, radius=100)
# Moves along the arc trajectory to P4 via P3 with a reach time of 3 seconds
# and then executes the next motion at a distance of 100mm from the P4 position.
movec(P2, P1, ra=DR_MV_RA_OVERRIDE)
# Immediately terminates the last motion and blends it to move to the P1 position.

 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

float velocity (same to all axes) or


vel (v) None
list (float[6]) velocity (to an axis)

float acceleration (same to all axes) or


acc (a) None
list (float[6]) acceleration (acceleration to an axis)

time (t) float None Reach time [sec]

Movement basis
mod int DR_MV_MOD_ABS  DR_MV_MOD_ABS: Absolute
 DR_MV_MOD_REL: Relative

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 _global_velj is applied if vel is None. (The initial value of _global_velj is 0.0 and can be set by
set_velj.)
 _global_accj is applied if acc is None. (The initial value of _global_accj is 0.0 and can be set by
set_accj.)
 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 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.

Doosan Robotics Programming Manual (ver.1.0) 72


2Chapter Motion-related Commands

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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.

movesj(qlist, vel=30, acc=100)


# Moves the spline curve that connects the waypoints defined in the qlist.
# with a maximum velocity of 30(mm/sec) and maximum acceleration of 1
00(mm/sec2)

73
movesj

#CASE 2) Relative angle input (mod= DR_MV_MOD_REL)


q0 = posj(0,0,0,0,0,0)
movej(q0, vel=30, acc=60) # Moves in joint motion to the initial position (q
0).
dq1 = posj(10, -10, 20, -30, 10, 20) # Defines dq1 (q1=q0+dq1) as the relativ
e joint angle of q0
dq2 = posj(15, 10, -10, -20, 10, 20) # Defines dq2 (q2=q1+dq2) as the relativ
e joint angle of q1
dq3 = posj(25, 50, 40, 100, 30, 10) # Defines dq3 (q3=q2+dq3) as the relativ
e joint angle of q2
dq4 = posj(-20, -40, -20, -70, -40, 10) # Defines dq4 (q4=q3+dq4) as the relativ
e joint angle of q3
dq5 = posj(-10, 10, 10, 40, -10, 30) # Defines dq5 (q5=q4+dq5) as the relativ
e joint angle of q4

dqlist = [dq1, dq2, dq3, dq4, dq5]


# Defines the list (dqlist) which is a set of q1-q5 as the relative waypoints.

movesj(dqlist, vel=30, acc=100, mod= DR_MV_MOD_REL )


# Moves the spline curve that connects the relative waypoints defined in t
he dqlist
# with a maximum velocity of 30(mm/sec) and maximum acceleration of 1
00(mm/sec2) (same motion as CASE-1).

 Related commands
posj()/set_velj()/set_accj()/amovesj()

Doosan Robotics Programming Manual (ver.1.0) 74


2Chapter Motion-related Commands

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

time (t) float None Reach time [sec]

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

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 _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.
 _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, each pos in the pos_list is defined in the relative coordinate
of the previous pos. (If pos_list=[p1, p2, ...,p(n-1), p(n)], p1 is the relative angle of the starting
point while p(n) is the relative coordinate of p(n-1).)
 This function does not support online blending of previous and subsequent motions.

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

Doosan Robotics Programming Manual (ver.1.0) 76


2Chapter Motion-related Commands

Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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.

movesx(xlist, vel=[100, 30], acc=[200, 60], vel_opt=DR_MVS_VEL_NONE)


# Moves the spline curve that connects the waypoints defined in the xlist
# with a maximum velocity of 100, 30(mm/sec, deg/sec) and maximum acc
eleration of 200(mm/sec2) and
# 60(deg/sec2).
movesx(xlist, vel=[100, 30], acc=[200, 60], time=5, vel_opt=DR_MVS_VEL_CONST)
# Moves the spline curve that connects the waypoints defined in the xlist
# with a constant velocity of 100, 30(mm/sec, deg/sec).

#CASE 2) Relative coordinate input (mod= DR_MV_MOD_REL)


P0 = posj(0,0,90,0,90,0)

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)

dxlist = [dx1, dx2, dx3, dx4, dx5, dx6]


# Defines the list (dxlist) which is a set of dx1-dx6 as the waypoints.

movesx(dxlist, vel=[100, 30], acc=[200, 60], mod= DR_MV_MOD_REL, vel_opt=DR_


MVS_VEL_NONE)
# Moves the spline curve that connects the waypoints defined in the dxlis
t
# with a maximum velocity of 100, 30 (mm/sec, deg/sec)
# and maximum acceleration of 200(mm/sec2), and 60(deg/sec2) (same mot
ion as CASE-1).

Doosan Robotics Programming Manual (ver.1.0) 78


2Chapter Motion-related Commands

 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

Reach time [sec]


* If the time is specified, values are
time (t) float None
processed based on time, ignoring vel
and acc.

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

Doosan Robotics Programming Manual (ver.1.0) 80


2Chapter Motion-related Commands

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 Up to 25 arguments can be entered in posb_list.
 _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.
 _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, each pos in the posb_list is defined in the relative coordinate
of the previous pos.

Caution

 A user input error is generated if the blending radius in posb is 0.


 A user input error is generated due to the duplicated input of Line if contiguous Line-Line
segments have the same direction.
 A user input error is generated to prevent a sudden acceleration if the blending condition
causes a rapid change in direction.
 This function does not support online blending of previous and subsequent motions.

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

81
moveb

Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

seg11 = posb(DR_LINE, X1, radius=20)


seg12 = posb(DR_CIRCLE, X1a, X1a2, radius=20)
seg14 = posb(DR_LINE, X1b2, radius=20)
seg15 = posb(DR_CIRCLE, X1c, X1c2, radius=20)
seg16 = posb(DR_CIRCLE, X1d, X1d2, radius=20)
b_list1 = [seg11, seg12, seg14, seg15, seg16]
# The blending radius of the last waypoint (seg16) is ignored.

movej(Jx1, vel=30, acc=60, mod=DR_MV_MOD_ABS)


# Joint motion to the initial angle (Jx1)
movel(X0, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)
# Line motion to the initial position (X0)

Doosan Robotics Programming Manual (ver.1.0) 82


2Chapter Motion-related Commands

moveb(b_list1, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)


# Moves the robot from the current position through a trajectory consistin
g of seg11(LINE), seg12(CIRCLE), seg14(LINE),
# seg15(CIRCLE), and seg16(CIRCLE) with a constant velocity of 150(mm/se
c) with the exception of accelerating and decelerating sections.
# (The final point is X1d2.) Blending to the next segment begins
# when the distance of 20mm from the end point (X1, X1a2, X1b2, X1c2,
and X1d2) of each segment
# is reached.

# 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)

dseg11 = posb(DR_LINE, dX1, radius=20)


dseg12 = posb(DR_CIRCLE, dX1a, dX1a2, radius=20)
dseg14 = posb(DR_LINE, dX1b2, radius=20)
dseg15 = posb(DR_CIRCLE, dX1c, dX1c2, radius=20)
dseg16 = posb(DR_CIRCLE, dX1d, dX1d2, radius=20)
db_list1 = [dseg11, dseg12, dseg14, dseg15, dseg16]
# The blending radius of the last waypoint (dseg16) is ignored.

movej(Jx1, vel=30, acc=60, mod=DR_MV_MOD_ABS)


# Joint motion to the initial angle (Jx1)
movel(X0, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)
# Line motion to the initial position (X0)

83
moveb

moveb(b_list1, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)


# Moves the robot from the current position through a trajectory consistin
g of dseg11(LINE), dseg12(CIRCLE), dseg14(LINE),
# dseg15(CIRCLE), and dseg16(CIRCLE) with a constant velocity of 150(mm/
sec) with the exception of accelerating and decelerating sections.
# (The final point is X1d2.)
# Blending to the next segment begins when the distance of 20mm from
the end point (X1, X1a2, X1b2, X1c2, and X1d2) of each segment is reached.
# (The path is the same as CASE#1.)

 Related commands
posb()/set_velx()/set_accx()/set_tcp()/set_ref_coord()/amoveb()

Doosan Robotics Programming Manual (ver.1.0) 84


2Chapter Motion-related Commands

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

rmax float 10 rmax > 0 Final spiral radius [mm]

Distance moved in the axis direction


lmax float 0
[mm]

vel (v) float None velocity

acc (a) float None acceleration

time (t) float None time ≥ 0 Total execution time <sec>

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

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 rev refers to the total number of revolutions of the spiral motion.
 Rmax refers to the maximum radius of the spiral motion.
 Lmax refers to the parallel distance in the axis direction during the motion. A negative value
means the parallel distance in the –axis direction.
 Vel refers to the moving velocity of the spiral motion.
 The first value of _global_velx (parallel velocity) is applied if vel is None. (The initial value of
_global_velx is 0.0 and can be set by set_velx.)
 acc refers to the moving acceleration of the spiral motion.
 The first value of _global_accx (parallel acceleration) is applied if acc is None. (The initial value
of _global_accx is 0.0 and can be set by set_accx.)
 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.
 The axis defines the axis that is perpendicular to the surface defined by the spiral motion.
 Ref refers to the reference coordinate system defined by the spiral motion.
 This function does not support online blending of previous and subsequent motions.

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

Doosan Robotics Programming Manual (ver.1.0) 86


2Chapter Motion-related Commands

 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])

atime float 0.0 0≤atime Acc-, dec- time [sec]

repeat int 1 >0 Repetition count

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.

Doosan Robotics Programming Manual (ver.1.0) 88


2Chapter Motion-related Commands

 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

 Ref refers to the reference coordinate system of the repeated motion.


 If a maximum velocity error is generated during a motion, adjust the amplification and period
using the following formula.
Max. velocity = Amplification(amp)*2*pi(3.14)/Period(period) (i.e., Max.
velocity=62.83mm/sec if amp=10mm and period=1 sec)
 This function does not support online blending of previous and subsequent motions.

 Return
Value Description

0 Success

Negative value Error

 Exception

Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

Doosan Robotics Programming Manual (ver.1.0) 90


2Chapter Motion-related Commands

# 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

float velocity (same to all axes) or


vel (v) None
list (float[6]) velocity (to an axis)

float acceleration (same to all axes) or


acc (a) None
list (float[6]) acceleration (acceleration to an axis)

time (t) float None Reach time [sec]

Movement basis
mod int DR_MV_MOD_ABS  DR_MV_MOD_ABS: Absolute
 DR_MV_MOD_REL: Relative

Reactive motion mode


ra int DR_MV_RA_DUPLICATE  DR_MV_RA_DUPLICATE: duplicate
 DR_MV_RA_OVERRIDE: override

Doosan Robotics Programming Manual (ver.1.0) 92


2Chapter Motion-related Commands

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 _global_velj is applied if vel is None. (The initial value of _global_velj is 0.0 and can be set by
set_velj.)
 _global_accj is applied if acc is None. (The initial value of _global_accj is 0.0 and can be set by
set_accj.)
 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.
 Refer to the description of the movej() motion for the path of blending according to option
ra and vel/acc.

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 94


2Chapter Motion-related Commands

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

Reach time [sec]


* If the time is specified, values are
time (t) float None
processed based on time, ignoring vel
and acc.

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

Reactive motion mode


ra int DR_MV_RA_DUPLICATE
 DR_MV_RA_DUPLICATE: duplicate

95
amovel

Parameter
Data Type Default Value Description
Name
 DR_MV_RA_OVERRIDE: override

Note

 Abbreviated parameter names supported (v:vel, a:acc, t:time).


 _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.
 _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.)
 Refer to the description of the movej() motion for the path of the blending according to
option ra and vel/acc.

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

Doosan Robotics Programming Manual (ver.1.0) 96


2Chapter Motion-related Commands

 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

float None velocity (same to all axes) or


vel (v)
list (float[6]) None velocity (to an axis)

float None acceleration (same to all axes) or


acc (a)
list (float[6]) None acceleration (acceleration to an axis)

time (t) float None Reach time [sec]

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

Reactive motion mode


ra int DR_MV_RA_DUPLICATE  DR_MV_RA_DUPLICATE: duplicate
 DR_MV_RA_OVERRIDE: override

sol int 0 Solution space

Doosan Robotics Programming Manual (ver.1.0) 98


2Chapter Motion-related Commands

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 _global_velj is applied if vel is None. (The initial value of _global_velj is 0.0 and can be set by
set_velj.)
 _global_accj is applied if acc is None. (The initial value of _global_accj is 0.0 and can be set by
set_accj.)
 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 time is specified, values are processed based on time, ignoring vel and acc.
 If the time is None, it is set to 0.
 _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.
 Refer to the description of the movej() motion for the path of the blending according to
option ra and vel/acc.

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 100


2Chapter Motion-related Commands

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

time (t) float None Reach time [sec]

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

ra int DR_MV_RA_DUPLICATE Reactive motion mode

101
amovec

Parameter
Data Type Default Value Description
Name
 DR_MV_RA_DUPLICATE: duplicate
 DR_MV_RA_OVERRIDE: override

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time, 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.
 _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. Here, the robot moves on the circular path at a
total movement angle of angle1 + 2xangle2.
 Refer to the description of the movej() motion for the path of the blending according to
option ra and vel/acc.

 Return
Value Description

0 Success

Negative value Error

Doosan Robotics Programming Manual (ver.1.0) 102


2Chapter Motion-related Commands

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

float velocity (same to all axes) or


vel (v) None
list (float[6]) velocity (to an axis)

float acceleration (same to all axes) or


acc (a) None
list (float[6]) acceleration (acceleration to an axis)

time (t) float None Reach time [sec]

Movement basis
mod int DR_MV_MOD_ABS  DR_MV_MOD_ABS: Absolute
 DR_MV_MOD_REL: Relative

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 _global_velj is applied if vel is None. (The initial value of _global_velj is 0.0 and can be set by
set_velj.)
 _global_accj is applied if acc is None. (The initial value of _global_accj is 0.0 and can be set by
set_accj.)
 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.

Doosan Robotics Programming Manual (ver.1.0) 104


2Chapter Motion-related Commands

 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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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)

qlist = [q1, q2, q3, q4, q5]


# Defines the list (qlist) which is a set of waypoints q1-q5.

amovesj(qlist, vel=30, acc=100)


# Moves the spline curve that connects the waypoints defined in the qlist.
# with a maximum velocity of 30(mm/sec) and maximum acceleration of 1
00(mm/sec2).
# Executes the next command.
wait(3) # Temporarily suspends the program exe
cution for 3 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
posj()/set_velj()/set_accj()/mwait()/amovesj()

Doosan Robotics Programming Manual (ver.1.0) 106


2Chapter Motion-related Commands

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

time (t) float None Reach time [sec]

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

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 _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.
 _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, each pos in the pos_list is defined in the relative coordinate
of the previous pos. (If pos_list=[p1, p2, ...,p(n-1), p(n)], p1 is the relative angle of the starting
point while p(n) is the relative coordinate of p(n-1).)
 This function does not support online blending of previous and subsequent motions.

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

Doosan Robotics Programming Manual (ver.1.0) 108


2Chapter Motion-related Commands

Exception Description

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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.

amovesx(xlist, vel=[100, 30], acc=[200, 60], vel_opt=DR_MVS_VEL_NONE)


# Moves the spline curve that connects the waypoints defined in the xlist
# with a maximum velocity of 100, 30(mm/sec, deg/sec) and maximum acc
eleration of 200(mm/sec2) and
# 60(deg/sec2). The next command is executed immediately after the moti
on starts.
wait(3) # Temporarily suspends the program execution for 3 seconds (whil
e 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()/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

Reach time [sec]


* If the time is specified, values are
time (t) float None
processed based on time, ignoring vel
and acc.

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

Doosan Robotics Programming Manual (ver.1.0) 110


2Chapter Motion-related Commands

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 Up to 25 arguments can be entered in posb_list.
 _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_accj 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.
 _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, each pos in the pos_list is defined in the relative coordinate
of the previous pos.
 This function does not support online blending of previous and subsequent motions.

Caution

 A user input error is generated if the blending radius in posb is 0.


 A user input error is generated due to the duplicated input of Line if contiguous Line-Line
segments have the same direction.
 A user input error is generated to prevent a sudden acceleration if the blending condition
causes a rapid change in direction.
 This function does not support online blending of previous and subsequent motions.

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

111
amoveb

Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

seg11 = posb(DR_LINE, X1, radius=20)


seg12 = posb(DR_CIRCLE, X1a, X1a2, radius=20)
seg14 = posb(DR_LINE, X1b2, radius=20)
seg15 = posb(DR_CIRCLE, X1c, X1c2, radius=20)
seg16 = posb(DR_CIRCLE, X1d, X1d2, radius=20)
b_list1 = [seg11, seg12, seg14, seg15, seg16]
# The blending radius of the last waypoint (seg16) is ignored.
movej(Jx1, vel=30, acc=60, mod=DR_MV_MOD_ABS)
# Joint motion to the initial angle (Jx1)
movel(X0, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)
# Line motion to the initial position (X0)

Doosan Robotics Programming Manual (ver.1.0) 112


2Chapter Motion-related Commands

amoveb(b_list1, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)


# Moves the robot from the current position through a trajectory consistin
g of seg11(LINE), seg12(CIRCLE), seg14(LINE),
# seg15(CIRCLE), and seg16(CIRCLE) with a constant velocity of 150(mm/se
c) with the exception of accelerating and decelerating sections.
# (The final point is X1d2.)
# Blending to the next segment begins when the distance of 20mm from
the end point (X1, X1a2, X1b2, X1c2, and X1d2)
# of each segment is reached.
wait(3) # Temporarily suspends the program exe
cution for 3 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
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

rmax float 10 rmax > 0 Final spiral radius [mm]

Distance moved in the axis direction


lmax float 0
[mm]

vel (v) float None velocity

acc (a) float None acceleration

time (t) float None time ≥ 0 Total execution time <sec>

axis
 DR_AXIS_X: x-axis
axis int DR_AXIS_Z -
 DR_AXIS_Y: y-axis
 DR_AXIS_Z: z-axis

ref Int DR_TOOL - reference coordinate

Doosan Robotics Programming Manual (ver.1.0) 114


2Chapter Motion-related Commands

Parameter Default
Data Type Range Description
Name Value
 DR_BASE : base coordinate
 DR_TOOL : tool coordinate
 user coordinate: user defined

Note

 Abbreviated parameter names are supported. (v:vel, a:acc, t:time)


 rev refers to the total number of revolutions of the spiral motion.
 Rmax refers to the maximum radius of the spiral motion.
 Lmax refers to the parallel distance in the axis direction during the motion. A negative value
means the parallel distance in the –axis direction.
 Vel refers to the moving velocity of the spiral motion.
 The first value of _global_velx (parallel velocity) is applied if vel is None. (The initial value of
_global_velx is 0.0 and can be set by set_velx.)
 Acc refers to the moving acceleration of the spiral motion.
 The first value of _global_accx (parallel acceleration) is applied if acc is None. (The initial value
of _global_accx is 0.0 and can be set by set_accx.)
 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.
 The axis defines the axis that is perpendicular to the surface defined by the spiral motion.
 Ref refers to the reference coordinate system defined by the spiral motion.
 This function does not support online blending of previous and subsequent motions.

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

115
amove_spiral

Exception Description

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 116


2Chapter Motion-related Commands

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])

atime float 0.0 0≤atime Acc-, dec- time [sec]

repeat int 1 >0 Repetition count

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.

 Ref refers to the reference coordinate system of the repeated motion.


 If a maximum velocity error is generated during a motion, adjust the amplification and period
using the following formula.
Max. velocity = Amplification(amp)*2*pi(3.14)/Period(period) (i.e., Max.
velocity=62.83mm/sec if amp=10mm and period=1 sec)

Doosan Robotics Programming Manual (ver.1.0) 118


2Chapter Motion-related Commands

 This function does not support online blending of previous and subsequent motions.

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

Doosan Robotics Programming Manual (ver.1.0) 120


2Chapter Motion-related Commands

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 122


2Chapter Motion-related Commands

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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.

end_blend() # Ends the batch setting of the blending sections.

 Related commands
end_blend()/movej()/movel()/movejx()/movec()

Doosan Robotics Programming Manual (ver.1.0) 124


2Chapter Motion-related Commands

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()

Doosan Robotics Programming Manual (ver.1.0) 126


2Chapter Motion-related Commands

2.37 check_motion()
 Features
This function checks the status of the currently active motion.

 Parameters
Not applicable

 Return (TBD)
Value Description

0 DR_STATE_IDLE (no motion in action)

1 DR_STATE_INIT (motion being calculated)

2 DR_STATE_BUSY (motion in operation)

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 128


2Chapter Motion-related Commands

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 130


2Chapter Motion-related Commands

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 132


2Chapter Motion-related Commands

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 134


3Chapter Auxiliary Control Commands

3. Auxiliary Control Commands


3.1 get_control_mode()
 Features
This function returns the current control mode.

 Parameters
Not applicable

 Return
Value Description

Control mode
int 3 : Position control mode
4 : Torque control mode

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 Example
x1 = get_control_space()

 Related commands
Not applicable

Doosan Robotics Programming Manual (ver.1.0) 136


3Chapter Auxiliary Control Commands

3.3 get_current_posj()
 Features
This function returns the current joint angle.

 Parameters
Not applicable

 Return
Value Description

posj Joint angle

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

float[6] Tool speed

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 Example
velj1 = get_current_velj()

 Related commands
get_desired_velj()

Doosan Robotics Programming Manual (ver.1.0) 138


3Chapter Auxiliary Control Commands

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

posj Joint angle

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_INVALID) Invalid command

 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

float[6] Target joint velocity

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_INVALID) Invalid command

 Example
velj1 = get_desired_velj()

 Related commands
get_current_velj()

Doosan Robotics Programming Manual (ver.1.0) 140


3Chapter Auxiliary Control Commands

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

 ref: DR_BASE (base coordinate)/user coordinate (globally declared user coordinate)


 DR_BASE is applied when ref is omitted.

 Return
Value Description

Posx Task space point

Int Solution space (0 ~ 7)

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 Example
x1, sol = get_current_posx() #x1 w.r.t. DR_BASE

DR_USR1=set_user_cart_coord(x1, x2, x3, pos)


set_ref_coord(DR_USR1)

x1, sol = get_current_posx(DR_USR1) #x1 w.r.t. DR_USR1

 Related commands
get_desired_posx()

141
get_current_posx(ref)

Doosan Robotics Programming Manual (ver.1.0) 142


3Chapter Auxiliary Control Commands

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

posx Pose of tool flange

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

float[6] Tool velocity

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 Example
velx1 = get_current_velx()

 Related commands
get_desired_velx()

Doosan Robotics Programming Manual (ver.1.0) 144


3Chapter Auxiliary Control Commands

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

 ref: DR_BASE (base coordinate)/user coordinate (globally declared user coordinate)


 DR_BASE is applied when ref is omitted.

 Return
Value Description

float[6] Tool velocity

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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)

x1 = get_desired_posx(DR_USR1) #x1 w.r.t. 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

float[6] Tool velocity

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_INVALID) Invalid command

 Example
vel_x1 = get_desired_velx()

 Related commands
get_current_velx()

Doosan Robotics Programming Manual (ver.1.0) 146


3Chapter Auxiliary Control Commands

3.12 get_current_solution_space()
 Features
This function returns the current solution space value.

 Parameters
Not applicable

 Return
Value Description

int Solution space (0 ~ 7)

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

float[3][3] Rotation matrix

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

Doosan Robotics Programming Manual (ver.1.0) 148


3Chapter Auxiliary Control Commands

3.14 get_joint_torque()
 Features
This function returns the sensor torque value of the current joint.

 Parameters
Not applicable

 Return
Value Description

float[6] JTS torque value

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

float[6] Torque value generated by an external force

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 Example
trq_ext=get_external_torque()

 Related commands
get_joint_torque()/get_tool_force()

Doosan Robotics Programming Manual (ver.1.0) 150


3Chapter Auxiliary Control Commands

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

float[6] External force applied to the tool

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

0~7 Solution space

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 152


3Chapter Auxiliary Control Commands

3.18 get_orientation_error(xd, xc, axis)


 Features
This function returns the orientation error value between the arbitrary poses xd and xc of the
axis.

 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

float Orientation error value

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

4. Other Settings and Safety-related


Commands
4.1 enable_virtual_wall()
 Features
This function enables the virtual domain.

 Parameters
Not applicable

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Related commands
enable_virtual_wall()/disable_virtual_wall()

Doosan Robotics Programming Manual (ver.1.0) 154


4Chapter Other Settings and Safety-related Commands

4.2 disable_virtual_wall()
 Features
The virtual domain is disabled.

 Parameters
Not applicable

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Related commands
enable_virtual_wall()/disable_virtual_wall()

155
set_workpiece_weight(weight, cog)

4.3 set_workpiece_weight(weight, cog)


 Features
This function sets the weight and the center of gravity of the workpiece. The center of gravity
is based on the TCP coordinate.

 Parameters
Parameter
Data Type Default Value Description
Name
weight float - weight

cog list (float[3]) - Center of gravity

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
set_workpiece_weight(4.0, [10.0, 20.0, 30.0])

 Related commands
get_workpiece_weight()/reset_workpiece_weight()

Doosan Robotics Programming Manual (ver.1.0) 156


4Chapter Other Settings and Safety-related Commands

4.4 get_workpiece_weight()
 Features
This function measures and returns the weight of the workpiece.

 Parameters
Not applicable

 Return
Value Description

Positive value Measured weight

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
reset_workpiece_weight()

 Related commands
set_workpiece_weight()/get_workpiece_weight()

Doosan Robotics Programming Manual (ver.1.0) 158


4Chapter Other Settings and Safety-related Commands

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

Weight float weight

cog float[3] Center of gravity (COG)

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
set_tool ("tool1") # Calls the "tool1" data registered in the TP and sets it as th
e tool.

 Related commands
set_tcp()

Doosan Robotics Programming Manual (ver.1.0) 160


4Chapter Other Settings and Safety-related Commands

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

movel(P1, vel=10, acc=20)


set_velx(30)
set_accx(60)
set_singular_handling(DR_STOP) # Task motion path first
movel(P2) m

 Related commands
movel()/movec()/movesx()/moveb()/move_spiral()/amovel()/amovec()/
amovesx()/amoveb()/amove_spiral()

Doosan Robotics Programming Manual (ver.1.0) 162


4Chapter Other Settings and Safety-related Commands

163
parallel_axis(x1, x2, x3, axis)

5. Force/Stiffness Control and Other User-


Friendly Features
5.1 parallel_axis(x1, x2, x3, axis)
 Features
This function matches the axis received as the argument axis in the normal vector and tool fr
ame obtained by get_normal (x1, x2, x3). The current position is maintained as the TCP positio
n of the robot.

 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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

Doosan Robotics Programming Manual (ver.1.0) 164


5Chapter Force/Stiffness Control and Other User-Friend

Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

5.2 parallel_axis(vect, axis)


 Features
This function matches the axis received as the argument axis in the tool frame in the given v
ect direction. The current position is maintained as the TCP position of the robot.

 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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 166


5Chapter Force/Stiffness Control and Other User-Friend

5.3 align_axis(x1, x2, x3, pos, axis)


 Features
This function matches the axis received as the argument axis in the normal vector and tool fr
ame obtained by get_normal (x1, x2, x3). The robot TCP moves to the pos position.

 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

Negative value Error

167
align_axis(x1, x2, x3, pos, axis)

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
p0 = posj(0,0,45,0,90,0)
movej(p0, v=30, a=30)

x1 = posx(0, 500, 700, 30, 0, 0)


x2 = posx(500, 0, 700, 0, 0, 0)
x3 = posx(300, 100, 500, 0, 0, 0)
pos = posx(400, 400, 500, 0, 0, 0)
align_axis(x1, x2, x3, pos, DR_AXIS_X)

 Related commands
get_normal()/align_axis()/parallel_axis()/parallel_axis()

Doosan Robotics Programming Manual (ver.1.0) 168


5Chapter Force/Stiffness Control and Other User-Friend

5.4 align_axis(vect, pos, axis)


 Features
This function matches the axis received as the argument axis in the tool frame in the given v
ect direction. The robot TCP moves to the pos position.

 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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
p0 = posj(0,0,45,0,90,0)
movej(p0, v=30, a=30)

vect = [10, 20, 30]


pos = posx(100, 500, 700, 45, 0, 0)

169
is_done_bolt_tightening(m=0, timeout=0, axis=None)

align_axis(vect, pos, DR_AXIS_X)

 Related commands
align_axis()/parallel_axis()/parallel_axis()

5.5 is_done_bolt_tightening(m=0, timeout=0,


axis=None)
 Features
This function monitors the tightening torque of the tool and returns True if the set
torque (m) is reached within the given time and False if the given time has passe
d.

 Parameters
Parameter
Data Type Default Value Description
Name
m float 0 Target torque

timeout float 0 Monitoring duration [sec]

axis
 DR_AXIS_X: x-axis
axis int -
 DR_AXIS_Y: y-axis
 DR_AXIS_Z: z-axis

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

Doosan Robotics Programming Manual (ver.1.0) 170


5Chapter Force/Stiffness Control and Other User-Friend

 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

res = is_done_bolt_tightening(10, 5, DR_AXIS_Z)


# Returns True if the tightening torque of 10Nm is reached within 5 seco
nds.
# Returns False otherwise.
if res==True:
# some action comes here for the case that bolt tightening is done
x=1
else:
# some action comes here for the case that it fails
x=2

 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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 172


5Chapter Force/Stiffness Control and Other User-Friend

5.7 task_compliance_ctrl
 Features
This function begins task compliance control based on the preset reference coordinate system.

 Parameters (Stiffness TBD)


Parameter
Data Type Default Value Description
Name

[3000, 3000, 3000, Three translational stiffnesses


stx float[6]
200, 200, 200] Three rotational stiffnesses

Stiffness varying time [sec]


Range: 0 - 1.0
time float 0
* Linear transition during the specified
time

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

task_compliance_ctrl([500, 500, 500, 100, 100, 100])


# Begins with the user-defined stiffness.
release_compliance_ctrl()

 Related commands
set_stiffnessx()/elease_compliance_ctrl()

Doosan Robotics Programming Manual (ver.1.0) 174


5Chapter Force/Stiffness Control and Other User-Friend

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

[500, 500, 500, Three translational stiffnesses


stx float[6]
100, 100, 100] Three rotational stiffnesses

Stiffness varying time [sec]


time float 0 Range: 0 - 1.0
* Linear transition during the specified time

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 176


5Chapter Force/Stiffness Control and Other User-Friend

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

Successful coordinate setting


Positive integer
Set coordinate ID (101 - 200)

-1 Failed coordinate setting

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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()

Doosan Robotics Programming Manual (ver.1.0) 178


5Chapter Force/Stiffness Control and Other User-Friend

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

v1 float[3] - Y-axis unit vector

posx posx or
pos -
list (float[6]) position list

 Return
Value Description

Successful coordinate setting


Positive integer
Set coordinate ID (101 - 200)

-1 Failed coordinate setting

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 180


5Chapter Force/Stiffness Control and Other User-Friend

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

Force control in the corresponding


direction if 1
dir int[6] [0, 0, 0, 0, 0, 0]
Compliance control in the corresponding
direction if 0

Time needed to increase the force [sec]


time float 0
Range: 0 - 1.0

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

set_desired_force(fd, dir=fctrl_dir) # Executed in the current coordinate system


# Zero force control in the z-axis direction, moment control in the z-axis directio
n, and compliance control in the other directions

 Related commands
release_force()/task_compliance_ctrl()/set_stiffnessx()/release_compliance_ctrl()

Doosan Robotics Programming Manual (ver.1.0) 182


5Chapter Force/Stiffness Control and Other User-Friend

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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()

Doosan Robotics Programming Manual (ver.1.0) 184


5Chapter Force/Stiffness Control and Other User-Friend

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

min float DR_COND_NONE Minimum value

max float DR_COND_NONE Maximum 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_ABS: Absolute
 DR_MV_MOD_REL: Relative

posx posx or
pos -
list (float[6]) position list

Note

 The absolution position is used if the mod is DR_MV_MOD_ABS.


 The pos position is used if the mod is DR_MV_MOD_REL.
 Pos is meaningful only if the mod is DR_MV_MOD_REL.

 Return
Value Description

True The condition is True.

False The condition is False.

185
check_position_condition

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

CON5= check_position_condition(DR_AXIS_Z,min=-10,max=-5, ref=DR_BASE)

# −10 ≤ z ≤ −5

CON6= check_position_condition(DR_AXIS_Z,min=-10,max=-5, mod=DR_MV_MO


D_ABS) #
−10 ≤ z ≤ −5

posx1 = posx(400, 500, 800, 0, 180,0)


CON7= check_position_condition(DR_AXIS_Z,min=-10,max=-5,mod = DR_MV_MOD_
REL, pos=posx1) #
posx1_(z) − 10 ≤ z ≤ posx1_(z) − 5

 Related commands
check_force_condition()/check_orientation_condition()/set_ref_coord()

Doosan Robotics Programming Manual (ver.1.0) 186


5Chapter Force/Stiffness Control and Other User-Friend

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

min float DR_COND_NONE Minimum value (min ≥ 0)

max float DR_COND_NONE Maximum value (max ≥ 0)

reference coordinate
 DR_BASE : base coordinate
ref int None
 DR_TOOL : tool coordinate
 user coordinate: User defined

 Return
Value Description

True The condition is True.

False The condition is False.

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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

if (fcon2 and pcon1):


break

 Related commands
check_position_condition()/check_orientation_condition()/set_ref_coord()

Doosan Robotics Programming Manual (ver.1.0) 188


5Chapter Force/Stiffness Control and Other User-Friend

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 only: True if the difference is + and False if -

• 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

True The condition is True.

False The condition is False.

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
posx1 = posx(400,500,800,0,180,30)
posx2 = posx(400,500,500,0,180,60)

CON1= check_orientation_condition(DR_AXIS_C, min=posx1, max= posx2)


# If the current task coordinate posxc = posx(400, 500, 500, 0, 180, 40)
# CON1=True since posx1 Rz=30 < posxc Rz=40 < posx2 Rz=60

CON2= check_orientation_condition(DR_AXIS_C, min=posx1)


# If the current task coordinate posxc = posx(400, 500, 500, 0, 180, 15)
# CON2=False since posx1 Rz=30 > posxc Rz=15

CON3= check_orientation_condition(DR_AXIS_C, max= posx2)

Doosan Robotics Programming Manual (ver.1.0) 190


5Chapter Force/Stiffness Control and Other User-Friend

# 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 only: True if the difference is + and False if -

• 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

Doosan Robotics Programming Manual (ver.1.0) 192


5Chapter Force/Stiffness Control and Other User-Friend

Parameter
Data Type Default Value Description
Name
min float DR_COND_NONE Minimum value

max float DR_COND_NONE Maximum 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

True The condition is True.

False The condition is False.

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

CON1= check_orientation_condition(DR_AXIS_C, max=5, mod=DR_MV_MOD_REL, p


os=posx1)

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()

Doosan Robotics Programming Manual (ver.1.0) 194


6Chapter System Commands

6. System Commands
6.1 IO Related

6.1.1 set_digital_output(index, val =None)

 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

(A positive number means ON while a


negative number means OFF.)

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

195
IO Related

Exception Description

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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.)

Doosan Robotics Programming Manual (ver.1.0) 196


6Chapter System Commands

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

6.1.3 set_digital_outputs(bit_start, bit_end, val)

 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)

Ending contact number for output signal


bit_end int -
(1~16)

val int - Output value

Note

 Bit_end must be a larger number than bit_start.


 Val is the value of the combination of bits where bit_start =LSB and bit_end=MSB.
Ex) bit_start =1, bit_end=4, val=0b1010 # No. 4=ON, no. 3=OFF, no. 2=ON, and no. 1=OFF

 Return
Value Description

0 Success

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

Doosan Robotics Programming Manual (ver.1.0) 198


6Chapter System Commands

 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.

# Outputs contact 3=ON and contact 4=OFF.


set_digital_outputs(bit_start=3, bit_end=4, val=0b01) # 0b means a binary numbe
r.

# Outputs the ON signal from contacts 1 through 8.


set_digital_outputs(1, 8, 0xff) # 0x means a hexadecimal
number.

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
in1 = get_digital_input(1) # Reads the no. 1 contact
in8 = get_digital_input(8) # Reads the no. 8 contact

Doosan Robotics Programming Manual (ver.1.0) 200


6Chapter System Commands

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

Multiple contacts to be read at once


int (>=0) (the value of the combination of the bit list where bit_start
=LSB and bit_end=MSB)

Negative number Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

6.1.6 get_digital_inputs(bit_start, bit_end)

 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)

Ending contact number for input signals


bit_end int -
(1~16)

Note

Bit_end must be a larger number than bit_start.

 Return
Value Description

Multiple contacts to be read at once


int (>=0) Value of the combination of bits where bit_start =LSB and
bit_end=MSB.

Negative number Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

Doosan Robotics Programming Manual (ver.1.0) 202


6Chapter System Commands

6.1.7 wait_digital_input(index, val, timeout=None)

 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

Waiting time (sec)


timeout float - This function waits indefinitely if the
timeout is not set.

 Return
Value Description

0 Success

-1 Failed (time-out)

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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.

Doosan Robotics Programming Manual (ver.1.0) 204


6Chapter System Commands

6.1.8 set_tool_digital_output(index, val=None)

 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

 Val argument existing: A number


index int - between 1 and 6
 No val argument: 1 ~ 6 , -1 ~ -6

(A positive number means ON while a


negative number means OFF.)

val int - I/O value: The value to output

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

set_tool_digital_output(3 #No. 3 contact ON (A positive number m


eans ON if the argument val is omitted.)
set_tool_digital_output(-3) #No. 3 contact OFF (A negative number
means OFF if the argument val is omitted.)

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

Doosan Robotics Programming Manual (ver.1.0) 206


6Chapter System Commands

6.1.10 set_tool_digital_outputs(bit_start, bit_end, val)

 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)

Ending contact number for output signal


bit_end int -
(1~6)

Val int - Output value

Note

 Bit_end must be a larger number than bit_start.


 Val is the value of the combination of bits where bit_start =LSB and bit_end=MSB.
Ex) bit_start =1, bit_end=4, val=0b1010 # No. 4=ON, no. 3=OFF, no. 2=ON, and no. 1=OFF

 Return
Value Description

0 Success

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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.

# Outputs contact 3=ON and contact 4=OFF.


set_tool_digital_outputs(bit_start=3, bit_end=4, val=0b01) # 0b means a binary nu
mber.

# Outputs the ON signal from contacts 1 through 8.


set_tool_digital_outputs(1, 8, 0xff) # 0x means a hexadecim
al number.

Doosan Robotics Programming Manual (ver.1.0) 208


6Chapter System Commands

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

(the value of the combination of the bit list where bit_start


int (>=0)
=LSB and bit_end=MSB)

Negative number Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

# input contacts: No. 4=ON, No. 5=ON, and No. 6=OFF


res = get_tool_digital_inputs([4,5,6])
#res expected value = 0b011 (binary number), 3 (decimal number), or 0x03 (hexadecimal
number)

Doosan Robotics Programming Manual (ver.1.0) 210


6Chapter System Commands

6.1.13 get_tool_digital_inputs(bit_start, bit_end)

 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)

Ending contact number for input signals


bit_end int -
(1~6)

 Return
Value Description

Multiple contacts to be read at once


int (>=0) Value of the combination of bits where bit_start =LSB and
bit_end=MSB.

Negative number Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

# input contacts: No. 4=ON, No. 5=ON, and No. 6=OFF

211
IO Related

res = get_tool_digital_inputs(4, 6)
#res expected value = 0b011 (binary number), 3 (decimal number), or 0x03 (hex
adecimal number)

Doosan Robotics Programming Manual (ver.1.0) 212


6Chapter System Commands

6.1.14 wait_tool_digital_input(index, val, timeout=None)

 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

Waiting time (sec)


timeout float - This function waits indefinitely if the timeout is
not set.

 Return
Value Description

0 Success

-1 Failed (time-out)

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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

res = wait_tool_digital_input(1, ON, 3) # Wait for up to 3 seconds until the no.


1 contact 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.

Doosan Robotics Programming Manual (ver.1.0) 214


6Chapter System Commands

6.1.15 set_mode_analog_output(ch, mod )

 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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
# Sets analog_output channel 1 to the current mode.
set_mode_analog_output(ch=1, mod=DR_ANALOG_CURRENT)

# Sets analog_output channel 2 to the voltage mode.


set_mode_analog_output(ch=2, mod=DR_ANALOG_VOLTAGE)

215
IO Related

6.1.16 set_mode_analog_input(ch, mod )

 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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
# Sets analog_input channel 1 to the current mode.
set_mode_analog_input(ch=1, mod=DR_ANALOG_CURRENT)

# Sets analog_input channel 2 to the voltage mode.


set_mode_analog_input(ch=2, mod=DR_ANALOG_VOLTAGE)

Doosan Robotics Programming Manual (ver.1.0) 216


6Chapter System Commands

6.1.17 set_analog_output(ch, val)

 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

analog output value


val float -  Current mode: 4.0~20.0 [mA]
 Voltage mode: 0~10.0 [V]

 Return
Value Description

0 Success

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

set_analog_output(ch=1, val=5.2) # Outputs 5.2 mA to channel 1


set_analog_output(ch=2, val=10.0) #Outputs 10V to channel 2

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

The analog input value of the specified channel


float  Current mode: 4.0~20.0 [mA]
 Voltage mode: 0~10.0 [V]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

Cur = get_analog_input(1) # Reads the analog input current value of channel 1


Vol = get_analog_input(2) # Reads the analog input voltage value of channel 2.

Doosan Robotics Programming Manual (ver.1.0) 218


6Chapter System Commands

6.1.19 add_modbus_signal (ip, port, name, reg_type, index, value=0)

 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

port int - Port number of the Modbus module

name string - Modbus signal name

Modbus signal type


 DR_MODBUS_DIG_INPUT
reg_type int -  DR_MODBUS_DIG_OUTPUT
 DR_MODBUS_REG_INPUT
 DR_MODBUS_REG_OUTPUT

index int - Modbus signal index

Output when the type is


value int 0 DR_MODBUS_DIG_OUTPUT or
DR_MODBUS_REG_OUTPUT (ignored otherwise)

 Return
Value Description

0 Success

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

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 1> input : di1~di8


add_modbus_signal(ip="192.168.127.254",port=502, name="di1", reg_type=DR_MOD
BUS_REG_INPUT, index=0)
add_modbus_signal(ip="192.168.127.254",port=502, name="di2", reg_type=DR_MOD
BUS_REG_INPUT, index=1)
add_modbus_signal(ip="192.168.127.254",port=502, name="di3", reg_type=DR_MOD
BUS_REG_INPUT, index=2)
add_modbus_signal(ip="192.168.127.254",port=502, name="di4", reg_type=DR_MOD
BUS_REG_INPUT, index=3)
add_modbus_signal(ip="192.168.127.254",port=502, name="di5", reg_type=DR_MOD
BUS_REG_INPUT, index=4)
add_modbus_signal(ip="192.168.127.254",port=502, name="di6", reg_type=DR_MOD
BUS_REG_INPUT, index=5)
add_modbus_signal(ip="192.168.127.254",port=502, name="di7", reg_type=DR_MOD
BUS_REG_INPUT, index=6)
add_modbus_signal(ip="192.168.127.254",port=502, name="di8", reg_type=DR_MOD
BUS_REG_INPUT, index=7)

# set <modbus 1> output : do1~do8


add_modbus_signal(ip="192.168.127.254",port=502, name="do1", reg_type=DR_MO
DBUS_REG_OUTPUT, index=0, value=0)
add_modbus_signal(ip="192.168.127.254",port=502, name="do2", reg_type=DR_MO
DBUS_REG_OUTPUT, index=1, value=0)
add_modbus_signal(ip="192.168.127.254",port=502, name="do3", reg_type=DR_MO
DBUS_REG_OUTPUT, index=2, value=0)
add_modbus_signal(ip="192.168.127.254",port=502, name="do4", reg_type=DR_MO
DBUS_REG_OUTPUT, index=3, value=0)
add_modbus_signal(ip="192.168.127.254",port=502, name="do5", reg_type=DR_MO

Doosan Robotics Programming Manual (ver.1.0) 220


6Chapter System Commands

DBUS_REG_OUTPUT, index=4, value=0)


add_modbus_signal(ip="192.168.127.254",port=502, name="do6", reg_type=DR_MO
DBUS_REG_OUTPUT, index=5, value=0)
add_modbus_signal(ip="192.168.127.254",port=502, name="do7", reg_type=DR_MO
DBUS_REG_OUTPUT, index=6, value=0)
add_modbus_signal(ip="192.168.127.254",port=502, name="do8", reg_type=DR_MO
DBUS_REG_OUTPUT, index=7, value=0)

#======================================================
========
# 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)

# set <modbus 2> output : do9~do16


add_modbus_signal(ip="192.168.127.253",port=502, name="do9", reg_type=DR_M
ODBUS_REG_OUTPUT, index=0, value=0)
add_modbus_signal(ip="192.168.127.253",port=502, name="do10", reg_type=DR_M
ODBUS_REG_OUTPUT, index=1, value=0)
add_modbus_signal(ip="192.168.127.253",port=502, name="do11", reg_type=DR_M
ODBUS_REG_OUTPUT, index=2, value=0)

221
IO Related

add_modbus_signal(ip="192.168.127.253",port=502, name="do12", reg_type=DR_M


ODBUS_REG_OUTPUT, index=3, value=0)
add_modbus_signal(ip="192.168.127.253",port=502, name="do13", reg_type=DR_M
ODBUS_REG_OUTPUT, index=4, value=0)
add_modbus_signal(ip="192.168.127.253",port=502, name="do14", reg_type=DR_M
ODBUS_REG_OUTPUT, index=5, value=0)
add_modbus_signal(ip="192.168.127.253",port=502, name="do15", reg_type=DR_M
ODBUS_REG_OUTPUT, index=6, value=0)
add_modbus_signal(ip="192.168.127.253",port=502, name="do16", reg_type=DR_M
ODBUS_REG_OUTPUT, index=7, value=0)

Doosan Robotics Programming Manual (ver.1.0) 222


6Chapter System Commands

6.1.20 del_modbus_signal (name)

 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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

6.1.21 set_modbus_output(iobus, val)

 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)

Modbus digital I/O


 ON : 1
 OFF : 0
value int -

Value for Modbus analog I/O

 Return
Value Description

0 Success

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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

Doosan Robotics Programming Manual (ver.1.0) 224


6Chapter System Commands

“reg2”.
set_modbus_output("reg1", 10)
set_modbus_output("reg2", 24)

6.1.22 set_modbus_outputs(iobus_list, val_list)

 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)

value int - I/O output value list

 Return
Value Description

0 Success

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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])

# Modbus digital I/O output contact "d3” OFF and "d4” ON


set_modbus_outputs([“d3”, “d4”], [0,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

0 or 1 ON or Off in the case of the Modbus digital I/O

The register value in the case of


value
the Modbus analog module

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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")

Doosan Robotics Programming Manual (ver.1.0) 226


6Chapter System Commands

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

Multiple contacts to be read at once


int (>=0) (the value of the combination of iobus_list where the first
value is LSB and the last value is MSB)

Negative number Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

# Modbus digital I I/O input contact "di4” OFF and "di5” ON


res = get_modbus_inputs(["di4", "di5"])
#res expected value = 0b10 (binary number), 2 (decimal number), or 0x0
2 (hexadecimal number)

227
IO Related

6.1.25 wait_modbus_input(iobus, val, timeout=None)

 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)

Modbus digital I/O


 ON : 1
value int -  OFF : 0

Value for Modbus analog I/O

Waiting time (sec)


timeout float - This function waits indefinitely if the timeout is
not set.

 Return
Value Description

0 Success

-1 Failed (time-out)

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
wait_modbus_input("CIN0", ON) # Indefinite wait until the “CIN0” contact becom
es ON

Doosan Robotics Programming Manual (ver.1.0) 228


6Chapter System Commands

wait_modbus_input("CIN0", OFF) # Indefinite wait until the “CIN0” contact beco


mes OFF

res = wait_modbus_input("CIN0", ON, 3) # Wait for up to 3 seconds until the "C


IN0" contact becomes ON
# res = 0 if the “CIN0” contact becomes ON within 3 seconds.
# res = -1 if the “CIN0” contact does not become ON within 3 seconds.

229
TP Interface

6.2 TP Interface

6.2.1 tp_popup(message, pm_type=DR_PM_MESSAGE)

 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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
tp_popup("move done", DR_PM_MESSAGE)
tp_popup("Error!! ", DR_PM_ALARM)
a=1

Doosan Robotics Programming Manual (ver.1.0) 230


6Chapter System Commands

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
tp_log("movej() is complete! ")

Doosan Robotics Programming Manual (ver.1.0) 232


6Chapter System Commands

6.2.3 tp_progress(cur_progress, total_progress)

 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

total_ progress int - Value at the final step

 Return
Value Description

0 Success

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
tp_progress(1, 100)
tp_progress(99, 100)

233
TP Interface

6.2.4 tp_get_user_input(message, input_type)

 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

TP user input message type


 DR_VAR_INT: Integer type
input_type int -
 DR_VAR_FLOAT: Real number type
 DR_VAR_STR: Character string

 Return
Value Description

User input data User input data received from the TP

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

Doosan Robotics Programming Manual (ver.1.0) 234


6Chapter System Commands

 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)

int_y= tp_get_user_input("message1", input_type= DR_VAR_INT)


if int_y==1: # Moves to q1 if the TP user input is 1.
movej(q1, vel=30, acc=30)
else: # Moves to q2 if the TP user input is not 1.
movej(q2, vel=30, acc=30)

float_y= tp_get_user_input("message2", input_type= DR_VAR_FLOAT)


if float_y==3.14: # Moves to q3 if the TP user input is 3.14.
movej(q3, vel=30, acc=30)
lse: # Moves to q4 if the TP user input is not 3.14.
movej(q4, vel=30, acc=30)

str_y= tp_get_user_input("message3", input_type= DR_VAR_STR)


if str_y=="a": # Moves to q5 if the TP user input is “a”.
movej(q5, vel=30, acc=30)
else: # Moves to q6 if the TP user input is not “a”.
movej(q6, vel=30, acc=30)

235
Thread

6.3 Thread

6.3.1 thread_run(th_func_name, loop=False)

 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

Flag indicates whether the thread will be


repeated
loop bool False  True: Repeated calling of th_func_name
(interval 0.01second)
 False: One-time calling of th_func_name

 Return
Value Description

int Registered thread ID

Negative value Failed

Doosan Robotics Programming Manual (ver.1.0) 236


6Chapter System Commands

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

#----- Main routine ----------------------------------


th_id = thread_run(fn_th_func, loop=True) # Thread run

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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.

Doosan Robotics Programming Manual (ver.1.0) 238


6Chapter System Commands

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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_pause(th_id) # Suspends the thread.

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

Negative value Failed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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_pause(th_id) # Suspends the thread.

# do something…
thread_resume(th_id) # Resumes the suspended thread.

Doosan Robotics Programming Manual (ver.1.0) 240


6Chapter System Commands

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

 Example
def fn_th_func():
if check_motion()==0: # No motion in action
set_digital_output(1, OFF)
else:
set_digital_output(1, ON)

th_id = thread_run(fn_th_func, loop=True)


state1 = thread_state(th_id)

thread_pause(th_id)
state2 = thread_state(th_id)

6.3.6 Integrated example

241
Thread

This example explains how to use the thread.

 Example 1: Thread example


#----- thread 1: client comm. ---------------------
def fn_th_client():
global g_sock
global g_cmd
res, rx_data = client_socket_read(g_sock)
if res > 0:
g_cmd = rx_data.decode() #decode: Converts byte type into a string.
else: # Communication error
client_socket_close(g_sock)
exit() # Terminates the program.
wait(0.1)
return 0

#----- thread 2: check IO -------------------------


def fn_th_check_io():
if get_digital_input(1) == ON:
exit() # Terminates the program.
wait(0.1)
return 0

#----- main ---------------------------------------


g_sock = client_socket_open("192.168.137.2", 20002) # Connects to the server.
g_cmd = ""

g_th_id1 = thread_run(th_client, loop=True) # Runs the th_client thread.


g_th_id2 = thread_run(th_check_io, loop=True) # Runs the th_check_io thread.

p1 = posj(0, 0, 90, 0, 90, 0)


p2 = posj(10, 0, 90, 0, 90, 0)
p3 = posj(20, 0, 90, 0, 90, 0)

Doosan Robotics Programming Manual (ver.1.0) 242


6Chapter System Commands

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

Negative value Error

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 Example
wait(1.3) # Waits for 1.3 seconds.

while 1: # Checks contact no. 1 every 0.1 second.


if get_digital_input(1) == ON:
set_digital_output(1, ON)
wait(0.1)

Doosan Robotics Programming Manual (ver.1.0) 244


6Chapter System Commands

6.4.2 exit()

 Features
This function terminates the currently running program.

 Return
Value Description

0 Success

 Exception
Exception Description

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

 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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 246


7Chapter Mathematical Function

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 248


7Chapter Mathematical Function

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

the arc sine of x -

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 250


7Chapter Mathematical Function

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

the arc tangent of x -

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

the arc tangent of y/x The result is between -pi and pi

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 252


7Chapter Mathematical Function

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 254


7Chapter Mathematical Function

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

x raised to the power y -

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

the square root of x Success

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 256


7Chapter Mathematical Function

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 - -

b float - base, e (natural logarithm)

 Return
Value Description

the logarithm of f to the base of b. -

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

The angle in radians -

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 258


7Chapter Mathematical Function

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

The angle in degrees -

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

float Size of the point coordinate vector

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

Doosan Robotics Programming Manual (ver.1.0) 260


7Chapter Mathematical Function

7.16 random()
 Features
This function returns a random number between 0 and 1.

 Return
Value Description

random number Random number between 0 and 1 (float)

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

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

float[3][3] Rotation matrix

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
rotm = rotx(30)

Doosan Robotics Programming Manual (ver.1.0) 262


7Chapter Mathematical Function

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

float[3][3] Rotation matrix

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

float[3][3] Rotation matrix

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
rotm = rotz(30)

Doosan Robotics Programming Manual (ver.1.0) 264


7Chapter Mathematical Function

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

float[3] ZYZ Euler angle [deg]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

float[3] rotation vector

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
rotm = [[1,0,0],[0,0.87,-0.5],[0,0.5,0.87]]
eul = rotm2rotvec(rotm)

Doosan Robotics Programming Manual (ver.1.0) 266


7Chapter Mathematical Function

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

float[3][3] Rotation matrix

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

float[3] rotation vector

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
eul = [90, 90, 0]
rotvec = eul2rotvec (eul)

Doosan Robotics Programming Manual (ver.1.0) 268


7Chapter Mathematical Function

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

float[3] ZYZ Euler angle [deg]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

float[3][3] Rotation matrix

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
rotm = rotvec2eul([0.7854,0,0])

Doosan Robotics Programming Manual (ver.1.0) 270


7Chapter Mathematical Function

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

posx [mm, deg]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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]

alpha float - 0.0 ≤ alpha ≤ 1.0

 Return
Value Description

posx [mm, deg]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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)

Doosan Robotics Programming Manual (ver.1.0) 272


7Chapter Mathematical Function

7.28 get_distance(posx1, posx2)


 Features
This function returns the distance between two pose positions in [mm].

 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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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)

7.29 get_normal(x1, x2, x3)


 Features
This function returns the normal vector of a surface consisting of three points (posx)
in the task space. This direction is clockwise.

 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

float[3] normal vector

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) C extension module error occurred

DR_Error (DR_ERROR_STOP) Program terminated forcefully

 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)

Doosan Robotics Programming Manual (ver.1.0) 274


7Chapter Mathematical Function

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

posx [mm, deg]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

posx [mm, deg]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
subtract_posx = subtract_pose(posx1, posx2)

Doosan Robotics Programming Manual (ver.1.0) 276


7Chapter Mathematical Function

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

posx [mm, deg]

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
posx1 = [100, 20, 300, 90, 0, 180]
inv_posx = inverse_pose(posx1)

277
dot_pose(posx1, posx2)

7.33 dot_pose(posx1, posx2)


 Features
This function obtains the inner product of the translation component when two pos
es are given.

 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

float Inner product of two poses.

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
posx1 = [100, 20, 300, 90, 0, 180]
posx2 = [200, 50, 100, 90, 30, 150]
res= dot_pose(posx1, posx2)

Doosan Robotics Programming Manual (ver.1.0) 278


7Chapter Mathematical Function

7.34 cross_pose(posx1, posx2)


 Features
This function obtains the outer product of the translation component when two pos
es are given.

 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

float[3] Outer product of two poses.

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

float[3] Unit vector of the given posx

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
posx1 = [100, 20, 300, 90, 0, 180]
res = unit_pose(posx1

Doosan Robotics Programming Manual (ver.1.0) 280


8Chapter External Communication Commands

8. External Communication Commands


8.1 Serial

8.1.1 serial_open(port=None, baudrate=115200, bytesize=DR_EIGHTBITS,


parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)

 Features
This function opens a serial communication port.

 Parameters
Parameter Default
Data Type Description
Name Value
port string None E.g.) "COM1", "COM2"

baudrate int 115200 Baud rate

Number of data bits


 DR_FIVEBITES: 5
bytesize int 8  DR_SIXBITS: 6
 DR_SEVENBITS: 7
 DR_EIGHTBITS: 8

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"

Number of stop bits


 DR_STOPBITS_ONE =1
stopbits int 1
 DR_STOPBITS_ONE_POINT_FIVE = 1.5
 DR_STOPBITS_TWO = 2

 Return
Value Description

serial.Serial instance Successful connection

281
Serial

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) Serial.SerialException error occurred

 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)

Doosan Robotics Programming Manual (ver.1.0) 282


8Chapter External Communication Commands

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

0 Successful closing of a serial port

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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

1 Serial port opened

0 Serial port closed

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 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)

Doosan Robotics Programming Manual (ver.1.0) 284


8Chapter External Communication Commands

8.1.4 serial_set_inter_byte_timeout(ser, timeout=None)

 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

Timeout between bytes during reading or


writing

 Continued processing of data that was


timeout float None
processed before the timeout
 None: inter-byte timeout not specified

 Return
Value Description

0 Success

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)

state = serial_set_inter_byte_timeout(ser, 0.1)

serial_close(ser))

285
Serial

8.1.5 serial_write(ser, tx_data)

 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

-1 The port is not open.

-2 serial.SerialException error occurred

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
ser = serial_open(port="COM2", baudrate=115200, bytesize=DR_EIGHTBITS,
parity=DR_PARITY_NONE, stopbits=DR_STOPBITS_ONE)

serial_write(ser, b"123456789") # b means the byte type.

serial_close(ser)

Doosan Robotics Programming Manual (ver.1.0) 286


8Chapter External Communication Commands

8.1.6 serial_read(ser, length=-1, timeout=-1)

 Features
This function reads the data from a serial port.

 Parameters
Parameter Default
Data Type Description
Name Value
ser serial.Serial - Serial instance

Number of bytes to read


 -1: Not specified (The number of bytes to read
length int -1
is not specified.)
 n(>=0): The specified number of bytes is read.

Read waiting time


int
timeout -1  -1: Indefinite wait
float
 n(>0): n seconds

 Return
Value (res, rx_data) Description

0 Number of bytes of the received data

res -1 The port is not open.

-2 serial.SerialException error occurred

rx_data Number of bytes read (byte type)

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

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)

Doosan Robotics Programming Manual (ver.1.0) 288


8Chapter External Communication Commands

8.2 Tcp/Client

8.2.1 client_socket_open(ip, port)

 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”

port int - Server port number (e.g.) 20002

 Return
Value Description

socket.socket instance Successful connection

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) socket.error occurred during a connection

 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.

client_socket_write(sock, b"123abc") # Sends data to the server (b represents th


e byte type).
res, rx_data = client_socket_read(sock) # Receives the data from the server.
client_socket_close(sock) # Closes the connection to the server.

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_RUNTIME) socket.error occurred during disconnection

 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…

client_socket_close(sock) # Closes the connection to the server.

Doosan Robotics Programming Manual (ver.1.0) 290


8Chapter External Communication Commands

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
sock = client_socket_open("192.168.137.200", 20002)

state = client_socket_state(sock) # Reads the socket state.

client_socket_close(sock)

291
Tcp/Client

8.2.4 client_socket_write(sock, tx_data)

 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

-1 The server is not connected.

-2 socket.error occurred during a data transfer

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
sock = client_socket_open(“192.168.137.200”, 20002)

client_socket_write(sock, b"1234abcd") # b means the byte type.

msg = “abcd” # msg is a string variable.


client_socket_write(sock, msg.decode()) # decode() converts a string type to a byt
e type.

client_socket_close(sock)

Doosan Robotics Programming Manual (ver.1.0) 292


8Chapter External Communication Commands

8.2.5 client_socket_read(sock, length=-1, timeout=-1)

 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()

Number of bytes of the received data


 -1: Not specified (The number of bytes to read
length int -1
is not specified.)
 n(>=0): The specified number of bytes is read.

Waiting time for receipt


int
timeout -1  -1: Indefinite wait
float
 n(>0): n seconds

 Return
Value (res, rx_data) Description

>0 Number of bytes of the received data

-1 The server is not connected.


res
-2 socket.error occurred during data reception

-3 Timeout during data reception

rx_data Received data (byte type)

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

293
Tcp/Client

 Example
sock = client_socket_open(“192.168.137.200”, 20002)

res, rx_data = client_socket_read(sock) # Indefinite wait until the data is receiv


ed
# Reads all received data since the length is omitted.
# Waits indefinitely until the data is received since timeout is omitted.
# (res = size of received data, rx_data=received data) is returned when the data
is received.

res, rx_data = client_socket_read(sock, timeout=3) # Waits for up to 3 seconds u


ntil the data is received.
# (res = size of received data, rx_data=received data) is returned if the data is r
eceived within 3 seconds.
# (res = -3, rx_data=None) is returned if the data is not received within 3 secon
ds.

res, rx_data = client_socket_read(sock, length=64) # Reads 64 bytes of the rece


ived data.

res, rx_data = client_socket_read(sock, length=64, timeout=3)


# Reads 64 bytes of the received data within the 3-second timeout.

rx_msg = rx_data.decode() # rx_data is a byte type and can be converted to a s


tring type
# using decode().
# For example, if rx_data = b”abcd”,
# rx_msg=”abcd”.
client_socket_close(sock)

Doosan Robotics Programming Manual (ver.1.0) 294


8Chapter External Communication Commands

8.2.6 Integrated example

Assume that server IP = 192.168.137,200 and open port =20002


and that the received packets are sent to the client as they are (mirroring).

 Example 1: Example of a default TCP client


# Assume server IP = 192.168.137,200 and open port =20002.
g_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.

 Example 2: Examples of a packet transfer

Transmission packet: “MEAS_START" +data1[4byte]+data2[4byte]


data1: Conversion of the integer to 4 byte. ex) 1 → 00000001
data2: Conversion of the integer to 4 byte. ex) 2 → 00000002
ex) data1=1 and data2=2: “MEAS_START"+00000001+00000002
Actual packet: 4D4541535F53544152540000000100000002
Received packet: res=18, rx_data=“MEAS_START"+00000001+00000002
rxd1 extraction: Conversion of 10th - 14th bytes to an integer
rxd2 extraction: Conversion of 14th - 18th bytes to an integer

g_sock = client_socket_open("192.168.137.100", 20002)


tp_popup("connect O.K!",DR_PM_MESSAGE)

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)

res, rx_data = client_socket_read(g_sock)


tp_popup("res={0}, rx_data ={1}".format(res, rx_data), DR_PM_MESSAGE)

rxd1 = int.from_bytes(rx_data[10:10+4], byteorder='big', signed=True)


rxd2 = int.from_bytes(rx_data[14:14+4], byteorder='big', signed=True)

tp_popup("res={0}, rxd1={1}, rxd2={2}".format(res, rxd1, rxd2), DR_PM_MESSAGE)

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

Doosan Robotics Programming Manual (ver.1.0) 296


8Chapter External Communication Commands

client_socket_close(g_sock)
g_sock = client_socket_open("192.168.137.200", 20002)
return

g_sock = client_socket_open("192.168.137.200", 20002)


tp_popup("connect O.K!",DR_PM_MESSAGE)

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)

The example checks the return value of the client_socket_read() command.


A negative value is returned if the connection to the server is terminated or there i
s a communication problem.
The function reconnect() is called to attempt a reconnection if a negative value is r
eturned.
Note that the opened socket is closed when a reconnection is attempted.

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

socket.socket instance Successful connection

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_VALUE) Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME) socket.error occurred during a connection

 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.

server_socket_write(sock, b"123abc") # Sends data to the client (b represents the


byte type).
res, rx_data = server_socket_read(sock) # Receives the data from the client.

server_socket_close(sock) # Closes the connection to the client.

Doosan Robotics Programming Manual (ver.1.0) 298


8Chapter External Communication Commands

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

DR_Error (DR_ERROR_RUNTIME) socket.error occurred during disconnection

 Example
sock = server_socket_open(20002)
# Opens the port 20002 and waits until the client connects.

# do something…

server_socket_close(sock) ) # Closes the connection to the client.

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

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
sock = server_socket_open(20002)

state = server_socket_state(sock) # Reads the socket state.

server_socket_close(sock)

Doosan Robotics Programming Manual (ver.1.0) 300


8Chapter External Communication Commands

8.3.4 server_socket_write(sock, tx_data)

 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

-1 The client is not connected.

-2 socket.error occurred during a data transfer

 Exception
Exception Description

DR_Error (DR_ERROR_TYPE) Parameter data type error occurred

 Example
sock = server_socket_open(20002)

server_socket_write(sock, b"1234abcd") # b means the byte type.

msg = “abcd” # msg is a string variable.


server_socket_write(sock, msg.decode()) # decode() converts a string type to a by
te type.

server_socket_close(sock)

301
Tcp/Server

8.3.5 server_socket_read(sock, length=-1, timeout=-1)

 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

Number of bytes of the received data


 -1: Not specified (The number of bytes to read
length int -1
is not specified.)
 n(>=0): The specified number of bytes is read.

Waiting time for receipt


int
timeout -1  -1: Indefinite wait
float
 n(>0): n seconds

 Return
Value (res, rx_data) Description

0 Number of bytes of the received data

-1 The client is not connected.


res
-2 socket.error occurred during data reception

-3 Timeout during data reception

rx_data Received data (byte type)

Doosan Robotics Programming Manual (ver.1.0) 302


8Chapter External Communication Commands

 Example
sock = server_socket_open(20002)

res, rx_data = server_socket_read(sock) # Indefinite wait until the data is recei


ved
# Reads all received data since the length is omitted.
# Waits indefinitely until the data is received since timeout is omitted.
# (res = size of received data, rx_data=received data) is returned when the data
is received.

res, rx_data = server_socket_read(sock, timeout=3) # Waits for up to 3 seconds u


ntil the data is received.
# (res = size of received data, rx_data=received data) is returned if the data is r
eceived within 3 seconds.
# (res = -3, rx_data=None) is returned if the data is not received within 3 secon
ds.

res, rx_data = server_socket_read(sock, length=64) # Reads 64 bytes of the rec


eived data.

res, rx_data = server_socket_read(sock, length=64, timeout=3)


# Reads 64 bytes of the received data within the 3-second timeout.

rx_msg = rx_data.decode() # rx_data is a byte type and can be converted to a s


tring type
# using decode().
# For example, if rx_data = b”abcd”,
# rx_msg=”abcd”.

server_socket_close(sock)

303
Tcp/Server

8.3.6 Integrated example

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).

 Example 1: Default TCP server example


g_sock = server_socket_open(20002)
tp_popup("connect O.K!",DR_PM_MESSAGE)

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.

 Example 2: Examples of a packet transfer


Transmission packet: “MEAS_START" +data1[4byte]+data2[4byte]
data1: Conversion of the integer to 4 byte. ex) 1 → 00000001
data2: Conversion of the integer to 4 byte. ex) 2 → 00000002
ex) data1=1 and data2=2: “MEAS_START"+00000001+00000002
Actual packet: 4D4541535F53544152540000000100000002
Received packet: res=18, rx_data=“MEAS_START"+00000001+00000002
rxd1 extraction: Conversion of 10th - 14th bytes to an integer
rxd2 extraction: Conversion of 14th - 18th bytes to an integer

g_sock = server_socket_open(20002)
tp_popup("connect O.K!",DR_PM_MESSAGE)

Doosan Robotics Programming Manual (ver.1.0) 304


8Chapter External Communication Commands

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)

res, rx_data = server_socket_read(g_sock)


tp_popup("res={0}, rx_data ={1}".format(res, rx_data), DR_PM_MESSAGE)

rxd1 = int.from_bytes(rx_data[10:10+4], byteorder='big', signed=True)


rxd2 = int.from_bytes(rx_data[14:14+4], byteorder='big', signed=True)

tp_popup("res={0}, rxd1={1}, rxd2={2}".format(res, rxd1, rxd2), DR_PM_MESSAGE)

server_socket_close(g_sock)

The example sends the byte type send_data.


res = 18 and rx_data=send_data since the client 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.

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)

The example checks the return value of the server_socket_read() command.


A negative value is returned if the connection to the client is terminated or there is
a communication problem.
The function reopen() is called to wait for the client connection if a negative value
is returned.
Note that the opened socket is closed when a reconnection is attempted.

Doosan Robotics Programming Manual (ver.1.0) 306


9Chapter External Vision Commands

9. External Vision Commands


9.1 Overview
Doosan Robotics provides the commands to guide robots with vision by connecting the
robots to an external vision system. It enables connecting a robot to a 2D vision system

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

the robot controller.

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 IS5600/5705 Series

COGNEX IS7000Series

COGNEX IS8000Series

DR_VS_SICK SICK Inspector PIM60 Series

SICK Inspector PI50 Series

DR_VS_CUSTOM

Doosan Robotics Programming Manual (ver.1.0) 308


9Chapter External Vision Commands

9.3 vs_connect(ip_addr, port_num=9999)


 Features
This function establishes communication with the vision system.

 Parameters
Parameter Default
Data Type Description
Name Value
ip_addr str - Server IP of vison module (ex. 192.168.137.200)

port_num int 9999 Port 번호 (예, 9999)

 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

Doosan Robotics Programming Manual (ver.1.0) 310


9Chapter External Vision Commands

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

-1 int 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

vs_set_job("test.job") # Set (load) the current vision job


job_name=vs_get_job() # Get the current setting vision job
tp_popup("{0}".format(job_name))

vs_disconnect() # Disconnect to vision

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

vs_set_info(DR_VS_COGNEX) #Vision type information setting


vs_connect("192.168.137.10") #Connect to vision - Vision IP, Default port

vs_set_job("test.job") # Set (load) the current vision job


job_name=vs_get_job() # Get the current setting vision job
tp_popup("{0}".format(job_name))

vs_disconnect() # Disconnect to vision

Doosan Robotics Programming Manual (ver.1.0) 312


9Chapter External Vision Commands

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)

var_list: Additional measurement results entered by Users


var_list list[float] ex) Check pass/fail, distance measurement, angle
measurement, etc.

-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 Visio


n

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)

9.8 vs_set_init_pos(vision_posx_init, robot_posx_init,


vs_pos=1)
 Features
Enter the initial position information of the object to perform the vision guidance operation.
(*VS_TYPE: DR_VS_COGNEX, DR_VS_SICK)

 Parameters
Parameter Data Default
Description
Name Type Value
vision_posx_init posx - Vision measurement coordinate initial value

robot_posx_init posx - Coordinate initial value for robot work

vs_pos int 1 The pos number of the initial value entered

 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()

Doosan Robotics Programming Manual (ver.1.0) 314


9Chapter External Vision Commands

9.9 vs_get_offset_pos(vision_posx _meas, vs_pos=1)


 Features
The coordinate of the robot is calculated using the coordinate values, measured in the vision
system. The initial value should be entered in advance through vs_set_init_pos.

 Parameters
Data Default
Parameter Name Description
Type Value
Vision measurement coordinate values, caculated
vision_posx_meas posx -
using vs_trigger

Pos number of the robot initial value to calculate


vs_pos int 1
offset coordinate

 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

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()

315
Integrated example (DR_VS_COGNEX, DR_VS_SICK)

9.10 Integrated example (DR_VS_COGNEX,


DR_VS_SICK)
vs_set_info(DR_VS_COGNEX) # Select type of vision sensor
if ( vs_connect("192.168.137.10") != 0 ): # Vision IP, Default port
tp_popup("connection fail",DR_PM_MESSAGE)
exit()

vis_posx_init = posx (410,310,300,0,0,0) # Define the initial posx data - vision


rob_posx_init1 = posx (400,300,300,0,180,0) # Define the initial posx data - robot
rob_posx_init2 = posx (420,320,300,0,180,0) # Define the initial posx data - robot

vs_set_init_pos(vis_posx_init, rob_posx_init1, VS_POS1) # Enter the initial posx data to Vision

vs_set_init_pos(vis_posx_init, rob_posx_init2, VS_POS2)

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()

Doosan Robotics Programming Manual (ver.1.0) 316


9Chapter External Vision Commands

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()

ret = vs_request(1) #1번 물체 비전측정 정보 요청

cnt, result = vs_result() #물체 측정결과 정보 가져 오기

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)

Doosan Robotics Programming Manual (ver.1.0) 318


9Chapter External Vision Commands

9.13 Intergrated Example


Communication Protocol
The vision system must conform to the following protocol to ensure that vision commands run
properly.

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

“MEAS_OK” is transmitted if the vision system is normal, and “MEAS_NG” is transmitted


otherwise.

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()

ret = vs_request(1) #Request of Vision Measurement


Information for No. 1 Object

cnt, result = vs_result() #Get object measurement result


information

Doosan Robotics Programming Manual (ver.1.0) 320


9Chapter External Vision Commands

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

You might also like