3. Continuous Linear Motion

Waiting

In the set_position() interface for linear motion, the wait parameter is used to set whether to wait or not.

  • wait=True means that the next command to the robotic arm will be sent only after the current command is completed.

  • wait=False means that after sending the current command, the next command will be sent immediately regardless of whether the robotic arm has completed its execution.

For example, to make the robotic arm move to the following four points (A, B, C, D) at a speed of 200 mm/s without waiting between commands:

  • Point A: [300, 100, 150, 180, 0, 0]

  • Point B: [300, -100, 150, 180, 0, 0]

  • Point C: [400, -100, 150, 180, 0, 0]

  • Point D: [400, 100, 150, 180, 0, 0]

The complete code is as follows:

from xarm.wrapper import XArmAPI  
arm = XArmAPI('192.168.1.47')  

arm.motion_enable(enable=True)  
arm.set_mode(0)  
arm.set_state(0)

arm.set_position(300, 100, 150, 180, 0, 0, speed=200, wait=False)  
arm.set_position(300, -100, 150, 180, 0, 0, speed=200, wait=False)  
arm.set_position(400, -100, 150, 180, 0, 0, speed=200, wait=False)  
arm.set_position(400, 100, 150, 180, 0, 0, speed=200, wait=False)

Blending Radius

The blending radius is similar to the turning radius of a car. When a blending radius greater than 0 is set, the robotic arm's trajectory becomes smoother during turns. In the set_position() interface for linear motion, the blending radius is passed through the radius parameter. The radius parameter is only effective when wait=False, and its setting affects the continuity of the trajectory.

The table below shows the relationship between trajectory continuity and the wait and radius parameters:

Parameterradius < 0radius ≥ 0

wait=True

Discontinuous

Discontinuous

wait=False

Discontinuous

Continuous

Therefore, continuous linear motion can only be achieved when wait=False and radius ≥ 0.

Continuous Linear Motion

The conditions required for continuous linear motion are:

  • At least two Cartesian commands are needed.

  • wait=False

  • radius ≥ 0

The following is an example of continuous linear motion with a blending radius of 5 mm:

from xarm.wrapper import XArmAPI  
arm=XArmAPI('192.168.1.47')  
arm.motion_enable(enable=True)  
arm.set_mode(0)  
arm.set_state(0)  
  
arm.set_position(300,100,150,180,0,0,speed=200,wait=False,radius=5)  
arm.set_position(300,-100,150,180,0,0,speed=200,wait=False,radius=5)  
arm.set_position(400,-100,150,180,0,0,speed=200,wait=False,radius=5)  
arm.set_position(400,100,150,180,0,0,speed=200,wait=False,radius=5)

Last updated