C, C++:
Modbus ConfigurationmodbusConfig
The RealMan robotic arm provides an RS485 communication interface respectively on the controller and the end interface board. These interfaces can be configured to the standard Modbus RTU mode. In Modbus RTU mode, users can read and write peripherals connected to the port through the interfaces provided.
WARNING
- Modbus supports switching between RTU and TCP modes. Please configure according to your needs.
- Additionally, supports adding multiple Modbus TCP master configurations.
Add Modbus TCP Master rm_add_modbus_tcp_master()
- Method prototype:
int rm_add_modbus_tcp_master(rm_robot_handle *handle, rm_modbus_tcp_master_info_t master)
Jump to rm_robot_handle and rm_modbus_tcp_master_info_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
master | Input | Modbus TCP master information. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Add a master with IP: 127.0.0.1, port: 502, and name: master1.
rm_modbus_tcp_master_info_t master = {0};
master.port = 502;
strcpy(master.ip, "127.0.0.1");
strcpy(master.master_name, "master1");
ret = rm_add_modbus_tcp_master(handle, master);
printf("add modbus tcp master result : %d\n", ret);
Update Modbus TCP Master rm_update_modbus_tcp_master()
- Method prototype:
int rm_update_modbus_tcp_master(rm_robot_handle *handle, const char *master_name, rm_modbus_tcp_master_info_t master)
Jump to rm_robot_handle and rm_modbus_tcp_master_info_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
master_name | Input | Modbus TCP master name. |
master | Input | Modbus TCP master information. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Update the master1 master's IP to 127.0.0.1.
rm_modbus_tcp_master_info_t master = {0};
master.port = 502;
strcpy(master.ip, "127.0.0.1");
strcpy(master.master_name, "master1");
rm_update_modbus_tcp_master(handle, master.master_name, master);
printf("update modbus tcp master result : %d\n", ret);
Delete Modbus TCP Master rm_delete_modbus_tcp_master()
- Method prototype:
int rm_delete_modbus_tcp_master(rm_robot_handle *handle, const char *master_name)
Jump to rm_robot_handle for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
master_name | Input | Modbus TCP master name. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Delete the master2 master information.
rm_delete_modbus_tcp_master(handle, "master2");
Get Modbus TCP Master List rm_get_modbus_tcp_master_list()
- Method prototype:
int rm_get_modbus_tcp_master_list(rm_robot_handle *handle, int page_num, int page_size, const char *vague_search,rm_modbus_tcp_master_list_t *list)
Jump to rm_robot_handle and rm_modbus_tcp_master_list_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
page_num | Input | Current page number of the query results. |
page_size | Input | Number of results to display per page. |
vague_search | Input | Perform a vague search. |
list | Input | Modbus TCP master list. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Get the saved Modbus master list, page number: 1, page size: 10, without vague search.
rm_modbus_tcp_master_list_t list = {0};
ret = rm_get_modbus_tcp_master_list(handle, 1, 10, "", &list);
printf("get modbus tcp master list result : %d\n", ret);
for (int i = 0; i < list.list_len; i++)
{
printf("modbus tcp master list[%d] ip : %s\n", i, list.master_list[i].ip);
printf("modbus tcp master list[%d] port : %d\n", i, list.master_list[i].port);
printf("modbus tcp master list[%d] name : %s\n", i, list.master_list[i].master_name);
}
Get Specified Modbus TCP Master rm_get_modbus_tcp_master()
- Method prototype:
int rm_get_modbus_tcp_master(rm_robot_handle *handle, const char *master_name, rm_modbus_tcp_master_info_t *master)
Jump to rm_robot_handle and rm_modbus_tcp_master_info_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
master_name | Input | Modbus TCP master name. |
master | Input | Modbus TCP master information. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Get the Modbus TCP master information named master1.
rm_get_modbus_tcp_master(handle, "master1", &master);
printf("get modbus tcp master result : %d\n", ret);
printf("modbus tcp master ip : %s\n", master.ip);
printf("modbus tcp master port : %d\n", master.port);
Get Controller RS485 Mode rm_get_controller_rs485_mode_v4()
- Method prototype:
int rm_get_controller_rs485_mode_v4(rm_robot_handle *handle, int *controller_rs485_mode, int *baudrate)
Jump to rm_robot_handle for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
controller_rs485_mode | Input | 0 - represents default RS485 serial communication; 1 - represents Modbus RTU master mode; 2 - represents Modbus RTU slave mode. |
baudrate | Input | Baud rate. (Currently supports 9600, 19200, 38400, 57600, 115200, 230400, and 460800) |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
ret = rm_get_controller_rs485_mode_v4(handle,&mode,&baudrate);
printf("get controller RS485 mode result : %d %d %d\n", ret,mode,baudrate);
Get Tool End RS485 Mode rm_get_tool_rs485_mode_v4()
- Method prototype:
int rm_get_tool_rs485_mode_v4(rm_robot_handle *handle, int *tool_rs485_mode, int *baudrate)
Jump to rm_robot_handle for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
tool_rs485_mode | Input | 0 - represents Modbus RTU master mode; 1 - represents dexterous hand mode; 2 - represents gripper mode. |
baudrate | Input | Baud rate. (Currently supports 9600, 115200, and 460800) |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
ret = rm_get_tool_rs485_mode_v4(handle,&mode,&baudrate);
printf("rm_get_tool_rs485_mode_v4 result : %d %d %d\n", ret,mode,baudrate);
Set Controller RS485 Mode rm_set_controller_rs485_mode()
- Method prototype:
int rm_set_controller_rs485_mode(rm_robot_handle *handle, int mode, int baudrate)
Jump to rm_robot_handle for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
mode | Input | 0 - represents default RS485 serial communication; 1 - represents Modbus RTU master mode; 2 - represents Modbus RTU slave mode. |
baudrate | Input | Baud rate. (Currently supports 9600, 19200, 38400, 57600, 115200, 230400, and 460800) |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Set the controller communication port RS485 mode to Modbus RTU master mode with a baud rate of 115200.
ret = rm_set_controller_rs485_mode(handle, 1, 115200);
printf("set controller RS485 mode result : %d\n", ret);
Set Tool End RS485 Mode rm_set_tool_rs485_mode()
- Method prototype:
int rm_set_tool_rs485_mode(rm_robot_handle *handle, int mode, int baudrate)
Jump to rm_robot_handle for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
mode | Input | Communication port: 0 - set the end of Tool RS485 port to RTU master; 1 - set the end of Tool RS485 port to dexterous hand mode; 2 - set the end of Tool RS485 port to gripper mode. |
baudrate | Input | Baud rate. (Currently supports 9600, 115200, and 460800) |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Set the end of tool RS485 port to RTU master with a baud rate of 115200.
ret = rm_set_tool_rs485_mode(handle, 0, 115200);
printf("set tool rs485 mode result : %d\n", ret);
Modbus RTU Protocol Read Coils rm_read_modbus_rtu_coils()
- Method prototype:
int rm_read_modbus_rtu_coils(rm_robot_handle *handle, rm_modbus_rtu_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_rtu_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read coils parameters. |
data | Input | Read coils data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Read coils from the controller side where it acts as the Modbus master, with the starting address of 10 and a quantity of 10 coils to be read.
int coils_read_data[10] = {0};
rm_modbus_rtu_read_params_t coils_read = {0};
coils_read.address = 10;
coils_read.num = 10;
coils_read.type = 0;
coils_read.device = 1;
ret = rm_read_modbus_rtu_coils(handle, coils_read, coils_read_data);
printf("read modbus rtu coils result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("coils_read_data[%d] : %d\n", i, coils_read_data[i]);
}
Modbus RTU Protocol Write Coils rm_write_modbus_rtu_coils()
- Method prototype:
int rm_write_modbus_rtu_coils(rm_robot_handle *handle, rm_modbus_rtu_write_params_t param)
Jump to rm_robot_handle and rm_modbus_rtu_write_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Write coils parameters. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Write Coils.
rm_modbus_rtu_write_params_t coils_write = {0};
coils_write.address = 10;
coils_write.num = 10;
coils_write.type = 0;
coils_write.device = 1;
for (int i = 0; i < 10; i++)
{
coils_write.data[i] = 1;
}
ret = rm_write_modbus_rtu_coils(handle, coils_write);
printf("write modbus rtu coils result : %d\n", ret);
Modbus RTU Protocol Read Discrete Inputs rm_read_modbus_rtu_input_status()
- Method prototype:
int rm_read_modbus_rtu_input_status(rm_robot_handle *handle, rm_modbus_rtu_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_rtu_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read discrete inputs parameters. |
data | Input | Read discrete inputs data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Read discrete inputs.
int param_read_data[10] = {0};
rm_modbus_rtu_read_params_t param_read = {0};
param_read.address = 10;
param_read.num = 10;
param_read.type = 0;
param_read.device = 1;
ret = rm_read_modbus_rtu_input_status(handle, param_read, param_read_data);
printf("read modbus rtu input status result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("param_read_data[%d] : %d\n", i, param_read_data[i]);
}
Modbus RTU Protocol Read Holding Registers rm_read_modbus_rtu_holding_registers()
- Method prototype:
int rm_read_modbus_rtu_holding_registers(rm_robot_handle *handle, rm_modbus_rtu_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_rtu_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read holding registers parameters. |
data | Input | Read holding registers data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
// Read holding registers
int param_read_data[10] = {0};
rm_modbus_rtu_read_params_t param_read = {0};
param_read.address = 10;
param_read.num = 10;
param_read.type = 0;
param_read.device = 1;
ret = rm_read_modbus_rtu_holding_registers(handle, param_read, param_read_data);
printf("read modbus rtu holding_registers result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("param_read_data[%d] : %d\n", i, param_read_data[i]);
}
Modbus RTU Protocol Write Holding Registers rm_write_modbus_rtu_registers()
- Method prototype:
int rm_write_modbus_rtu_registers(rm_robot_handle *handle, rm_modbus_rtu_write_params_t param)
Jump to rm_robot_handle and rm_modbus_rtu_write_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Write holding registers parameters. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
// Write holding registers
rm_modbus_rtu_write_params_t param_write = {0};
param_write.address = 10;
param_write.num = 10;
param_write.type = 0;
param_write.device = 1;
for (int i = 0; i < 10; i++)
{
param_write.data[i] = i;
}
ret = rm_write_modbus_rtu_registers(handle, param_write);
printf("write modbus rtu registers result : %d\n", ret);
Modbus RTU Protocol Read Input Registers rm_read_modbus_rtu_input_registers()
- Method prototype:
int rm_read_modbus_rtu_input_registers(rm_robot_handle *handle, rm_modbus_rtu_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_rtu_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read input registers parameters. |
data | Input | Read input registers data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Read input registers.
int input_read_data[10] = {0};
rm_modbus_rtu_read_params_t input_read = {0};
input_read.address = 10;
input_read.num = 10;
input_read.type = 0;
input_read.device = 1;
ret = rm_read_modbus_rtu_input_registers(handle, input_read, input_read_data);
printf("read modbus rtu input registers result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("input_read_data[%d] : %d\n", i, input_read_data[i]);
}
Modbus TCP Protocol Read Coils rm_read_modbus_tcp_coils()
- Method prototype:
int rm_read_modbus_tcp_coils(rm_robot_handle *handle, rm_modbus_tcp_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_tcp_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read coils parameters. |
data | Input | Read coils data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
ModbusTCP read coils.
rm_modbus_tcp_read_params_t param = {0};
param.address = 10;
param.num = 10;
strcpy(param.master_name, "test");
int data[10] = {0};
ret = rm_read_modbus_tcp_coils(handle, param, data);
printf("read modbus tcp coils result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("data[%d] : %d\n", i, data[i]);
}
Modbus TCP Protocol Write Coils rm_write_modbus_tcp_coils()
- Method prototype:
int rm_write_modbus_tcp_coils(rm_robot_handle *handle, rm_modbus_tcp_write_params_t param)
Jump to rm_robot_handle and rm_modbus_tcp_write_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Write coils parameters. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
ModbusTCP write coils.
rm_modbus_tcp_write_params_t param_w = {0};
param_w.address = 10;
param_w.num = 10;
strcpy(param_w.master_name, "test");
memset(param_w.ip, 0, 16);
for (int i = 0; i < 10; i++)
{
param_w.data[i] = i;
}
ret = rm_write_modbus_tcp_coils(handle, param_w);
printf("write modbus tcp coils result : %d\n", ret);
Modbus TCP Protocol Read Discrete Inputs rm_read_modbus_tcp_input_status()
- Method prototype:
int rm_read_modbus_tcp_input_status(rm_robot_handle *handle, rm_modbus_tcp_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_tcp_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read discrete inputs parameters. |
data | Input | Read discrete inputs data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
Read discrete inputs.
rm_modbus_tcp_read_params_t param = {0};
param.address = 10;
param.num = 10;
strcpy(param.master_name, "test");
int data[10] = {0};
ret = rm_read_modbus_tcp_input_status(handle, param, data);
printf("read modbus tcp input status result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("data[%d] : %d\n", i, data[i]);
}
Modbus TCP Protocol Read Holding Registers rm_read_modbus_tcp_holding_registers()
- Method prototype:
int rm_read_modbus_tcp_holding_registers(rm_robot_handle *handle, rm_modbus_tcp_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_tcp_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read holding registers parameters. |
data | Input | Read holding registers data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
// Read holding registers through the saved Modbus TCP master "test"
rm_modbus_tcp_read_params_t param = {0};
param.address = 10;
param.num = 10;
strcpy(param.master_name, "test");
int data[10] = {0};
ret = rm_read_modbus_tcp_holding_registers(handle, param, data);
printf("read modbus tcp holding registers result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("data[%d] : %d\n", i, data[i]);
}
Modbus TCP Protocol Write Holding Registers rm_write_modbus_tcp_registers()
- Method prototype:
int rm_write_modbus_tcp_registers(rm_robot_handle *handle, rm_modbus_tcp_write_params_t param)
Jump to rm_robot_handle and rm_modbus_tcp_write_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Write holding registers parameters. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
// Write holding registers through the saved Modbus TCP master "test", starting address: 10, number of registers to write: 10
// Data to write: 0~9
rm_modbus_tcp_write_params_t param_w = {0};
param_w.address = 10;
param_w.num = 10;
strcpy(param_w.master_name, "test");
for (int i = 0; i < 10; i++)
{
param_w.data[i] = i;
}
ret = rm_write_modbus_tcp_registers(handle, param_w);
printf("write modbus tcp coils result : %d\n", ret);
Modbus TCP Protocol Read Input Registers rm_read_modbus_tcp_input_registers()
- Method prototype:
int rm_read_modbus_tcp_input_registers(rm_robot_handle *handle, rm_modbus_tcp_read_params_t param, int *data)
Jump to rm_robot_handle and rm_modbus_tcp_read_params_t for details of the structure.
- Parameter description:
Parameter | Type | Description |
---|---|---|
handle | Input | Robotic arm handle. |
param | Input | Read input registers parameters. |
data | Input | Read input registers data, array size is param.num. |
- Return value:
Parameter | Type | Description | Handling Suggestions |
---|---|---|---|
0 | int | Success. | - |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. | - Validate JSON Command: ① Enable DEBUG logs for the API to capture the raw JSON data. ② Check JSON syntax: Ensure correct formatting of parentheses, quotes, commas, etc. (You can use a JSON validation tool). ③ Verify against the API documentation that parameter names, data types, and value ranges comply with the specifications. ④ After fixing the issues, resend the command and check if the controller returns a normal status code and business data. - Check Robot Arm Status: ① Check for real-time error messages in the robot arm controller or logs (such as hardware failures, over-limit conditions), and reset, calibrate, or troubleshoot hardware issues according to the prompts. ② After fixing the issues, resend the command and check if the controller returns a normal status code and business data. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. | Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. | - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. - Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. | Verify Version Compatibility: ① Check if the controller firmware version supports the current API functions. For specific version compatibility, refer to the Version Description. ② If the version is too low, upgrade the controller or use an API version that is compatible. |
-4 | int | This interface is not supported by the Gen 3 Controller. | - |
- Usage demo
// Read input registers through the saved Modbus TCP master "test"
rm_modbus_tcp_read_params_t param = {0};
param.address = 10;
param.num = 10;
strcpy(param.master_name, "test");
int data[10] = {0};
ret = rm_read_modbus_tcp_input_registers(handle, param, data);
printf("read modbus tcp input registers result : %d\n", ret);
for (int i = 0; i < 10; i++)
{
printf("data[%d] : %d\n", i, data[i]);
}