xArm6 set_position_aa() Not Consistent – C21 Kinematic Error

Hi All,

I’m running into some inconsistencies when using set_position_aa on my xArm6. I have a basic script that moves between two poses in axis-angle representation. Occasionally, it fails with:

Error C21 – “Kinematic Error”

Here’s the minimal code snippet:

from xarm.wrapper import XArmAPI

src = [287, -5, 523, 0, 1.7, 0]
dest = [436, -7, 723, 0, 1.7, 0]

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

# Move to source
code = arm.set_position_aa(src, wait=True, is_radian=True)
if code != 0:
    print(f"[ERROR] Failed to move to src pose: Code {code}, Error: {arm.get_error_code()}")

# Move to destination
code = arm.set_position_aa(dest, wait=True, is_radian=True)
if code != 0:
    print(f"[ERROR] Failed to move to dest pose: Code {code}, Error: {arm.get_error_code()}")

What’s the best practice for using set_position_aa reliably? Would switching to set_position provide more robust performance ? I’d appreciate any recommendations for making motion execution more robust and predictable, especially in production settings.

Thanks in advance!

Hi,
Seems the pose “dest = [436, -7, 723, 0, 1.7, 0]” is unreachable, did you notice that?

As noted earlier, the xArm can reach both points, but not reliably. Could you please advise on best practices to improve consistency in its reach or motion planning?

Hi,
I set the same joint angles, and check the position, it’s far from the position in the screenshot you sent. Seems you set TCP offset or coordinate offset, could you check and share the TCP settings and Coordinate settings?

I then try with TCP settings “Gripper”, but still not able to reproduce the Error C21. Could you let me know how to produce the issue, or could you provide a script which I can reproduce the issue?
And if you could reproduce the issue on your site and then download the log with UFACTORY Studio and share us with Google driver, it will help us figure out the issue.
Thanks