Python:
Five-Fingered Dexterous Hand ConfigurationHandControl It is used to set the five-fingered dexterous hand control. The following is a detailed description of the member functions of the five-fingered dexterous hand configuration HandControl, including the method prototype, parameter description, return value, and usage demo.
Run dexterous hand target gesture sequence number rm_set_hand_posture()
rm_set_hand_posture()- Method prototype:
python
rm_set_hand_posture(self, posture_num: int, block: bool, timeout: int) -> int:- Parameter description:
| Parameter | Type | Description |
|---|---|---|
posture_num | int | Gesture sequence number pre-stored in the dexterous hand, range: 1−40 |
block | bool | true: blocking mode, return after the dexterous hand finishes its movement; false: non-blocking mode, immediately return after sending the command |
timeout | int | Timeout setting in blocking mode, in s |
- Return value:
State codes executed by functions:
| 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 | The current in-position equipment verification fails, indicating the current in-position equipment is not a dexterous hand. | - Detect Concurrent Control by Multiple Devices: Check if other devices are sending motion commands to the robot arm, including the motion of the robot arm, gripper, dexterous hand, and elevator. - Monitor Command Events in Real-Time: Register the callback function rm_get_arm_event_call_back:① Capture device arrival events (such as motion completion, timeout, etc.). ② Determine the specific device type that triggered the event through the device parameter in the callback. |
| -5 | int | Timeout, no response returns. | - Check Timeout Setting: In blocking mode, it supports configuring the timeout for waiting for the device to complete its motion. Ensure that the timeout is set longer than the device's motion time. - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
- Usage demo
python
from Robotic_Arm.rm_robot_interface import *
# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)
# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)
print(arm.rm_set_hand_posture(1, True, 10))
arm.rm_delete_robot_arm()Run dexterous hand action sequence number rm_set_hand_seq()
rm_set_hand_seq()- Method prototype:
python
rm_set_hand_seq(self, seq_num: int, block: bool, timeout: int) -> int:- Parameter description:
| Parameter | Type | Description |
|---|---|---|
seq_num | int | Gesture sequence number pre-stored in the dexterous hand, range: 1−40 |
block | bool | true: blocking mode, return after the dexterous hand finishes its movement; false: non-blocking mode, immediately return after sending the command |
timeout | int | Timeout setting in blocking mode, in s |
- Return value:
State codes executed by functions:
| 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 | The current in-position equipment verification fails, indicating the current in-position equipment is not a dexterous hand. | - Detect Concurrent Control by Multiple Devices: Check if other devices are sending motion commands to the robot arm, including the motion of the robot arm, gripper, dexterous hand, and elevator. - Monitor Command Events in Real-Time: Register the callback function rm_get_arm_event_call_back:① Capture device arrival events (such as motion completion, timeout, etc.). ② Determine the specific device type that triggered the event through the device parameter in the callback. |
| -5 | int | Timeout, no response returns. | - Check Timeout Setting: In blocking mode, it supports configuring the timeout for waiting for the device to complete its motion. Ensure that the timeout is set longer than the device's motion time. - Check Network Connectivity: Use tools like ping/telnet to check if the communication link with the controller is normal. |
- Usage demo
python
from Robotic_Arm.rm_robot_interface import *
# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)
# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)
print(arm.rm_set_hand_seq(1, True, 15))
arm.rm_delete_robot_arm()Set the angles of the dexterous hand’s degrees of freedomrm_set_hand_angle()
- Method prototype:
python
rm_set_hand_angle(self, hand_angle: list[int], block: bool, timeout: int) -> int:- Parameter description:
| Parameter | Type | Description |
|---|---|---|
hand_angle | list[int] | Array of finger angles, range: 0~1000, -1 indicates that no operation is performed on this degree of freedom and the current state is maintained. |
block | bool | true: blocking mode, return after the dexterous hand finishes its movement; false: non-blocking mode, immediately return after sending the command |
timeout | int | Timeout setting in blocking mode, in s |
- Return value:
State codes executed by functions:
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Usage demo
python
from Robotic_Arm.rm_robot_interface import *
# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)
# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)
# Set the finger angles of the dexterous hand
print(arm.rm_set_hand_angle([-1,100,200,300,400,500]),True,1)
arm.rm_delete_robot_arm()Set the speed of the dexterous handrm_set_hand_speed()
- Method prototype:
python
rm_set_hand_speed(self, speed: int) -> int:- Parameter description:
| Parameter | Type | Description |
|---|---|---|
speed | int | Finger speed, range: 1−1,000 |
- Return value:
State codes executed by functions:
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Usage demo
python
from Robotic_Arm.rm_robot_interface import *
# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)
# 创建机械臂连接,打印连接id
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)
print(arm.rm_set_hand_speed(500))
arm.rm_delete_robot_arm()Set the force threshold of the dexterous handrm_set_hand_force()
- Method prototype:
python
rm_set_hand_force(self, force: int) -> int:- Parameter description:
| Parameter | Type | Description |
|---|---|---|
| force | int | Finger force, range: 1−1,000 |
- Return value:
State codes executed by functions:
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Usage demo
python
from Robotic_Arm.rm_robot_interface import *
# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)
# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)
print(arm.rm_set_hand_force(500))
arm.rm_delete_robot_arm()
