C, C++:
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:
C
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
C
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:
C
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"
C
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:
C
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"
C
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:
C
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"
C
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:
C
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
C
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);
