Blocking and Slow "set_gripper_position" with "wait=False"

Using the xArm gripper on the xArm 6. Using the 2.5.109 software version and 2.5.5 firmware.

When I call the “set_gripper_position” function with “wait=False” in a loop, the expected behavior is to almost immediately exit, since the wait=False should be non-blocking similar to what happens in the “set_position” command. However, not only is the command blocking, but it takes some time, so that the gripper motion is blocky rather than smooth.

I tried to do the same with blockly, and did not encounter this issue.

We need more information to figure out this issue. Could you please share the python codes and Blockly project here, or send me a Email with those files, my Email daniel.wang@ufactory.cc

Here is the Python codes and Blockly I test

import time
from xarm.wrapper import XArmAPI
arm = XArmAPI('192.168.1.83')


arm.set_mode(0)
arm.set_state(0)
time.sleep(1)


position_list=[
[300,-100,100,180,0,0],
[300,-100,300,180,0,0],
[300,100,300,180,0,0],
[300,100,100,180,0,0]
]

for i in range(5):
    for pos in position_list:
        print(pos)
        arm.set_position(*pos,speed=200,wait=False)
    arm.set_gripper_position(pos=800,speed=1000,wait=False)
    for pos in position_list:
        print(pos)
        arm.set_position(*pos,speed=200,wait=False)
    arm.set_gripper_position(pos=0,speed=1000,wait=False)

Here is python code to reproduce the bug:

import time
from xarm.wrapper import XArmAPI
arm = XArmAPI("192.168.1.237")

arm.set_mode(0)
arm.set_state(0)
time.sleep(1)

t0 = time.time()
for i in range(5):
    arm.set_gripper_position(pos=800, speed=1000, wait=False)
    arm.set_gripper_position(pos=0, speed=1000, wait=False)
print(f"Time for 10x set_gripper_position time with wait=False: {time.time() - t0: .2f} [s]")

t0 = time.time()
for i in range(5):
    arm.set_position(x=360, wait=False)
    arm.set_position(x=330, wait=False)
print(f"Time for 10x set_position with wait=False: {time.time() - t0: .2f} [s]")

I’d expect both printed times to be close to zero, since wait=False should be non-blocking. In practice, the set_position works fine, but the set_gripper_position has a bug, since it blocks until the movement is complete:

SDK_VERSION: 1.14.8
ROBOT_IP: 192.168.1.237, VERSION: v2.5.5, PROTOCOL: V1, DETAIL: 6,6,XI1200,XX0000,v2.5.5, TYPE1300: [0, 0]
change protocol identifier to 3
[set_state], xArm is ready to move
Time for 10x set_gripper_position time with wait=False:  4.73 [s]
Time for 10x set_position with wait=False:  0.01 [s]

Try to change the “wait” to “wait_motion”, like that.

arm.set_gripper_position(pos=800, speed=1000, wait_motion=False)

Changing to wait_motion=False in the code I attached indeed removes the blocking issue, but the gripper doesn’t actually open or close, so this is not a solution.

For reference I’m using the xArm-Python-SDK from pypi with version 1.14.8.

The robot has motion planning, it will plan the path if it receive 10 commands at same time.
The gripper does not have the concept of motion planning, it’s a bit like the “servo_j” of the robot, it only execute the last command when it receives 10 commands at same time.
How do you want use the gripper?