C, C++:
End Tool Protocol Configuration End Tool Action Configuration
Supports action-related configuration, including operations such as querying, running, deleting, saving, and updating.
Query Action List rm_get_tool_action_list
- Method prototype:
int rm_get_tool_action_list(rm_robot_handle *handle, int page_num, int page_size, const char *vague_search, rm_tool_action_list_t *list);- Parameter description:
| Parameter | Type | Description |
|---|---|---|
handle | Input | Robotic arm handle. |
page_num | Input | Page number. |
page_size | Input | Number of items per page. |
vague_search | Input | Vague search string. |
list | Output | Action list. |
Jump to rm_robot_handle and rm_tool_action_list_t for details of the structure.
- Return value:
| Parameter | Description |
|---|---|
| 0 | Success. |
| 1 | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
| -1 | The data transmission fails, indicating that a problem occurs during the communication. |
| -2 | The data reception fails, indicating that a problem occurs during the communication or the controller has a return timeout. |
| -3 | The return value parsing fails, indicating that the received data format is incorrect or incomplete. |
| -4 | This interface is not supported by the Gen 3 Controller. |
- Usage demo
int page_num = 1;
int page_size = 20;
const char* vague_search = NULL;
rm_tool_action_list_t list;
ret = rm_get_tool_action_list(handle, page_num, page_size, vague_search, &list);
printf("%d\n", ret);
printf("=== Tool Action List ===\n");
printf("Number of returned actions: %d\n", list.list_len);
printf("\n");
const int THRESHOLD = 1000000;
for (int i = 0; i < list.list_len; i++) {
printf("Action %d:\n", i + 1);
printf(" Name: %s\n", list.act_list[i].name);
int hasValidPos = 0;
for (int j = 0; j < 100; j++) {
if (abs(list.act_list[i].hand_pos[j]) < THRESHOLD) {
hasValidPos = 1;
break;
}
}
int hasValidAngle = 0;
for (int j = 0; j < 100; j++) {
if (abs(list.act_list[i].hand_angle[j]) < THRESHOLD) {
hasValidAngle = 1;
break;
}
}
if (hasValidPos) {
printf(" handpos: [");
for (int j = 0; j < 100; j++) {
if (abs(list.act_list[i].hand_pos[j]) < THRESHOLD) {
if (j > 0) printf(", ");
printf("%d", list.act_list[i].hand_pos[j]);
}
}
printf("]\n");
}
else if (hasValidAngle) {
printf(" handangle: [");
for (int j = 0; j < 100; j++) {
if (abs(list.act_list[i].hand_angle[j]) < THRESHOLD) {
if (j > 0) printf(", ");
printf("%d", list.act_list[i].hand_angle[j]);
}
}
printf("]\n");
}
printf("--------------------\n");
}Run Specified End Tool Action rm_run_tool_action
- Method prototype:
int rm_run_tool_action(rm_robot_handle *handle, const char *action_name);- Parameter description:
| Parameter | Type | Description |
|---|---|---|
handle | Input | Robotic arm control handle. |
action_name | Input | Action name. |
Jump to rm_robot_handle for details of the structure.
- Return value:
| Parameter | Description |
|---|---|
| 0 | Success. |
| 1 | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
| -1 | The data transmission fails, indicating that a problem occurs during the communication. |
| -2 | The data reception fails, indicating that a problem occurs during the communication or the controller has a return timeout. |
| -3 | The return value parsing fails, indicating that the received data format is incorrect or incomplete. |
| -4 | This interface is not supported by the Gen 3 Controller. |
| -5 | The current in-position device verification fails, i.e., the current in-position device is not an end tool action. |
- Usage demo
Run the specified end tool action "run_tool_action"
const char* action_name = "1";
ret = rm_run_tool_action(handle, action_name);
printf("%d\n", ret);Delete Specified End Tool Action rm_delete_tool_action
- Method prototype:
int rm_delete_tool_action(rm_robot_handle *handle, const char *action_name);- Parameter description:
| Parameter | Type | Description |
|---|---|---|
handle | Input | Robotic arm control handle. |
action_name | Input | Action name. |
Jump to rm_robot_handle for details of the structure.
- Return value:
| Parameter | Description |
|---|---|
| 0 | Success. |
| 1 | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
| -1 | The data transmission fails, indicating that a problem occurs during the communication. |
| -2 | The data reception fails, indicating that a problem occurs during the communication or the controller has a return timeout. |
| -3 | The return value parsing fails, indicating that the received data format is incorrect or incomplete. |
| -4 | This interface is not supported by the Gen 3 Controller. |
- Usage demo
Delete the specified end tool action "delete_tool_action"
const char* action_name = "p";
ret = rm_delete_tool_action(handle, action_name);
printf("%d\n", ret);Save Action to Controller rm_save_tool_action
- Method prototype:
int rm_save_tool_action(rm_robot_handle *handle, const char *action_name,int *selected_array,int array_size, int array_type);- Parameter description:
| Parameter | Type | Description |
|---|---|---|
handle | Input | Robotic arm control handle. |
action_name | Input | Action name. |
selected_array | Input | Value of the save array. |
array_size | Input | Size of the save array. |
array_type | Input | Save type (0 - indicates save type is hand_pos; 1 - indicates save type is hand_angle) |
Jump to rm_robot_handle for details of the structure.
- Return value:
| Parameter | Description |
|---|---|
| 0 | Success. |
| 1 | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
| -1 | The data transmission fails, indicating that a problem occurs during the communication. |
| -2 | The data reception fails, indicating that a problem occurs during the communication or the controller has a return timeout. |
| -3 | The return value parsing fails, indicating that the received data format is incorrect or incomplete. |
| -4 | This interface is not supported by the Gen 3 Controller. |
- Usage demo
Save action "save_tool_action"
const char* action_name = "12";
int selected_array[6] = {1,1,1,1,1,1};
int array_size = 6;
int array_type = 0;
ret = rm_save_tool_action(handle, action_name, selected_array, array_size, array_type);
printf("%d\n", ret);Update Action to Controller rm_update_tool_action
- Method prototype:
int rm_update_tool_action(rm_robot_handle *handle, const char *action_name, const char *new_name, int *selected_array,int array_size, int array_type);- Parameter description:
| Parameter | Type | Description |
|---|---|---|
handle | Input | Robotic arm control handle. |
action_name | Input | Action name. |
new_name | Input | New action name. |
selected_array | Input | Value of the save array. |
array_size | Input | Size of the save array. |
array_type | Input | Save type (0 - indicates save type is hand_pos; 1 - indicates save type is hand_angle) |
Jump to rm_robot_handle for details of the structure.
- Return value:
| Parameter | Description |
|---|---|
| 0 | Success. |
| 1 | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
| -1 | The data transmission fails, indicating that a problem occurs during the communication. |
| -2 | The data reception fails, indicating that a problem occurs during the communication or the controller has a return timeout. |
| -3 | The return value parsing fails, indicating that the received data format is incorrect or incomplete. |
| -4 | This interface is not supported by the Gen 3 Controller. |
- Usage demo
const char* action_name = "121";
const char* new_name = "12";
int selected_array[6] = { 2,1,1,1,1,1 };
int array_size = 6;
int array_type = 1;
ret = rm_update_tool_action(handle, action_name, new_name, selected_array, array_size, array_type);
printf("%d\n", ret);End Tool Control Configuration
Set end-effector angle-following control rm_set_hand_follow_angle()
Sets the follow angle with a maximum control frequency of 50Hz.
Dexterous Hand: 6 active degrees of freedom (DoF) — DoF 1 (Thumb flexion), DoF 2 (Index finger), DoF 3 (Middle finger), DoF 4 (Ring finger), DoF 5 (Little finger), DoF 6 (Thumb rotation/opponency).
2-Finger Gripper: 1 active degree of freedom (DoF).
WARNING
To use this feature, please contact technical support to obtain and flash the customized firmware upgrade package for the end-effector tool (dexterous hand/gripper).
- Method prototype:
int rm_set_hand_follow_angle(rm_robot_handle *handle, const int *hand_angle, bool block);Jump to rm_robot_handle for details of the structure.
- Parameter description:
| Parameter | Type | Description |
|---|---|---|
handle | Input | Robotic arm handle. |
hand_angle | Input | Sets the angles for the degrees of freedom. When configuring individual finger movements for the dexterous hand, hand_angle represents an array of finger angles controlled according to the definitions specified by the hand manufacturer.For example, dexterous hand angle definitions (Unit: 0.01°): Thumb: 0 ~ 7400; Index Finger: 0 ~ 8500; Middle Finger: 0 ~ 8400; Ring Finger: 0 ~ 8500; Little Finger: 0 ~ 8400; Thumb Yaw/Rotation: 0 ~ 11000 |
block | Input | true: Indicates non-blocking mode, returns after sending successfully. false: Indicates blocking mode, returns after receiving the successful setting command. |
- Return value:
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Usage demo
// High-speed control of the dexterous hand, non-blocking mode
const int angle[6]= {0,100,200,300,400,500};
bool block = true;
ret = rm_set_hand_follow_angle(robot_handle,angle,block);Set end-effector position-following controlrm_set_hand_follow_pos()
Sets the follow position for the end-effector tool with a maximum control frequency of 50Hz.
Dexterous Hand: 6 active degrees of freedom (DoF) — DoF 1 (Thumb flexion), DoF 2 (Index finger), DoF 3 (Middle finger), DoF 4 (Ring finger), DoF 5 (Little finger), DoF 6 (Thumb rotation/opponency).
2-Finger Gripper: 1 active degree of freedom (DoF).
WARNING
To use this feature, please contact technical support to obtain and flash the customized firmware upgrade package for the end-effector tool (dexterous hand/gripper).
- Method prototype:
int rm_set_hand_follow_pos(rm_robot_handle *handle, const int *hand_pos, bool block);Jump to rm_robot_handle for details of the structure.
- Parameter description:
| Parameter | Type | Description |
|---|---|---|
handle | Input | Robotic arm handle. |
hand_pos | Input | Sets the positions for the degrees of freedom. When configuring the position for the 2-finger gripper, hand_pos represents an array of DoF positions controlled according to the definitions specified by the gripper manufacturer.For example, 2-finger gripper DoF definitions: Travel Range: 0 ~ 120mm; Actuator Stroke: 0 ~ 12000 |
block | Input | true: Indicates non-blocking mode, returns after sending successfully. false: Indicates blocking mode, returns after receiving the successful setting command. |
- Return value:
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Usage demo
// High-speed control of the dexterous hand, non-blocking mode
const int pos[6]= {0,100,200,300,400,500};
bool block = true;
ret = rm_set_hand_follow_pos(robot_handle,pos,block);
