How to reset error using C++SDK

Hi,

Please advise on how to reset errors. I’m using xArm6 with Gripper.
When I clear an error in C++SDK I write the following.

// xarm_ is an instance of XArmAPI.

xarm_->motion_enable(false);
xarm_->set_gripper_enable(false);
sleep_milliseconds(1000);

if (xarm_->has_warn()) {
	xarm_->clean_warn();
	sleep_milliseconds(1000);
}

if (xarm_->has_error()) {
	xarm_->clean_error();
	xarm_->clean_gripper_error();
	sleep_milliseconds(1000);
}

xarm_->motion_enable(true);
xarm_->set_gripper_enable(true);
xarm_->set_mode(0);
xarm_->set_state(0);
sleep_milliseconds(1000);

Sometimes I can clear the error without any problem, sometimes I cannot clear the error.

In UFACTORY-Studio, there is an error dialog (e.g. Code: S23) from which I can clear the error.
Is there a description missing to clear the error completely?
The version of the SDK is 1.9.0
Firmware version is 1.10.0

I would appreciate any advice you can give me.

Hi toshinori

The error “Sxx” is a servo error, which is critical. It is recommended to run the studio to find out the reason, or contact support with the error code(support@ufactory.cc). It is not recommended to use the SDK to clean the error directly.

Hi, Mike-chen

The following message was displayed in the studio.
image

We think this is caused by too much movement, so we are operating at a slower speed.
Is it correct to say that the “Sxx” error cannot be cleared without checking in the studio?

Also, is it possible to confirm the cause in more detail by analyzing the log downloaded from the studio?

Hi toshinori

No, that depends on the specific code of the error “Sxx”. For example the S23 error can be got rid of by the SDK if you use the clean_error and enable_robot method.
But if you get S17 or S18, then the process will be much more complicate and normally you need contact us if you get S17 or S18.

Please follow the below steps to check Joint 4/5/6 speed threshold and let me know the result.

  1. Release the E-stop button.

  2. Click ‘enable’ button on xArmStudio.

  3. Enter ’ H102 D0403 I* ’ ( note: * means Joint ID )in ‘Settings-Advanced Tools-Debugging Tools-Joint Debug’,then click “send” .

If data is 3000,please click “Modify Speed Threshold”. If data is 4500,please go to step 6.

  1. Press up the E-stop button

  2. Repeat step 1-3 and use ’ H102 D0403 I* ’ to get the data , and the data should be 4500.

6.Press up the E-stop button,then release the E-stop button,don’t click ‘enable’ button on xArmStudio.
enter ‘H101 D0104 V1 I6’ in ‘Settings-Advanced Tools-Debugging Tools-Joint Debug’, then rotate the joint 6 by hand.

If you can not rotate the joint 6 by hand, please shoot a video about the process and send to us by Google driver sharing link.

Hi Mike-chen

Thank you for letting us know how to check for errors.

Please tell us one related question.
Even if you cannot reset with SDK, you can use UFACTORY-Studio to return to zero position.
Is there a special process in UFACTORY-Studio?
If so, could you please provide the details?

Hi Toshinori,

There is no special step, it will check if there is any error, if yes clear first and plan the trajectory back to the zero position.
The cleaning steps are just like you mentioned, clean_warn/clean_error → set_mode(0)->set_state(0).

Does this error still occur frequently after you clear it? If so, there may still be a problem with joint, xArmStudio only briefly clear this error .

Best regards,
Minna

Hi Minna,

Sorry, my explanation was not clear enough.
When the gripper moves downward to catch an object, if the target is off and one of the claws hits the object, an S23 error occurs.
This control is done using the C++SDK.
When this error occurs, the procedure from the SDK side cannot clear the error.

However, I can clear the error from UFACTORY-Studio.
I am wondering if UFACTORY-Studio is taking steps to connect to xArm that I am not doing.

I have created an instance of the XArmAPI and multiplied the reset process above.
Can you please let me know if there are any other settings I need to make?

Hi Toshinori,

You can try the below code to clear the servo error.

/* you need to pass the error servo_id */
int servo_id = 6;
arm->core->servo_addr_w16(servo_id, 0x0109, 1);

Best regards,
Minna

Hi Minna,

Thank you very much.
I will try it.