Before you start
Safety Precautions
The code examples in this guide include joint and Cartesian coordinates, which, based on your robot’s placement and surroundings, could cause damage or harm. When running these examples, or any new movement in general, set the speed (v) to a low value and be ready to use the emergency stop if needed. All of the code examples below assume the robot is in its home position before executing the code.
Prerequisites
This guide assumes you are already familiar with joint (posj) and Cartesian coordinates (posx). If you have never heard of these, make sure to first check this article.
Running the examples
All of the code examples below are meant to be run through DRL studio (either with an actual robot or RoboDK simulation).
Robot limits
Cobots have inherent limitations, and in many cases, they may attempt to reach a target pose even if they cannot do so smoothly. Joint movements are generally reliable and function as expected. However, other types of movements carry the risk of encountering singularities, which can result in unexpected behaviour and movement patterns.
Synchronous and asynchronous movements
As you use Doosan robots, you will notice multiple movement commands such as movej, movel, movejx, and movec. Additionally, each of these commands has a counterpart with the letter ‘a’ in front, like amovej, amovel, amovejx, and amovec. The latter are asynchronous movements, meaning the code following these commands will be executed without waiting for the movement to finish. Below, you will see an example demonstrating how the two differ in practice. Apart from one blocking the code execution flow until it’s finished and the other not, there are no other differences between the ‘a’ and non-‘a’ movements.
Function parameters
The functions you will encounter in this How-to accept multiple parameters such as position, speed, acceleration, reference coordinates, reach time, etc. However, in this guide, only the basics (pose, speed, and acceleration) are included. Feel free to experiment with the different parameters on your own.
Examples
Joint movement (movej)
# get the current pose of the robot in joint coordinates
current_posj = get_current_posj()
# create a new pose based on the current one
target_posj = addto(current_posj, [0,0,135,45,45,0])
# move to the target pose
movej(target_posj, v=20, a=100)
# log a message
tp_log(str("What is the robot doing as this message appears?"))
# move back to the starting pose
movej(current_posj, v=20, a=100)
In the provided code, the current position of the robot is retrieved in joint coordinates (posj). Then, a new pose is created using the addto()
function by providing the adjustments we want to make to the current posj. In this case, J3, J4, and J5 are increased by 135 or 45 degrees, while the other three joints remain unchanged. Next, we move to the newly created pose and then back to the starting position.
Notice at what point the log message appears, as this will be important later on.
Linear movement (movel)
# get the current pose in cartesian coordinates
current_posx, _ = get_current_posx()
# transform the current pose by increasing its Y value by 200mm
target_posx = trans(current_posx, posx(0,200,0,0,0,0))
# move linearly to the target pose
movel(target_posx, v=20, a=100)
# move linearly back to the starting pose
movel(current_posx, v=20, a=100)
In the provided code, the current position of the robot is retrieved in Cartesian coordinates. Then, a new pose is created using the trans()
function and providing the adjustment we want to make to the current posx. In this case, only the Y value is changed by 200mm relative to the robot base (the base is set as the default reference frame). Next, we move to the newly created pose and then back to the starting position.
Async joint movement (amovej)
# get the current pose of the robot in joint coordinates
current_posj = get_current_posj()
# create a new pose based on the current one
target_posj = addto(current_posj, [0,0,135,45,45,0])
# move to the target pose async
amovej(target_posj, v=20, a=100)
# log a message
tp_log(str("What is the robot doing as this message appears?"))
The provided example is very similar to the movej example you saw earlier but with two minor changes: there is only one move, and it is asynchronous. You may have noticed in the movej example that the message was logged after the first move was finished. In the current example, the message is logged as soon as the move starts. This is the sole difference between synchronous and asynchronous movements: the former waits for the move to finish before executing the rest of the code, while the latter does not
Other movements
There are many other types of movements you can perform with Doosan robots that are not included here. Feel free to experiment with them on your own.
How-to by @dimitar.prisadnikov