Python:
Universal Extended Joint ControlExpandControl
It is used for the expansion joint control. The following is a detailed description of the member functions of the general expansion joint control ExpandControl
, including the method prototype, parameter description, return value, and usage demo.
Speed loop control of expansion jointsrm_set_expand_speed()
- Method prototype:
python
rm_set_expand_speed(self, speed: int) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
speed | int | Speed percentage, -100−100. speed<0: lifting mechanism moves down; speed>0: lifting mechanism moves up; speed=0: lifting mechanism stops moving. |
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- 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 expansion joint to move backward at a speed of 50%
print(arm.rm_set_expand_speed(-50))
arm.rm_delete_robot_arm()
Position loop control of expansion jointsrm_set_expand_pos()
- Method prototype:
python
rm_set_expand_pos(self, speed: int, height: int, block: int) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
speed | int | Speed percentage, 1−100 |
height | int | Expansion joint angle, in ° |
block | int | Blocking settings: multi-thread mode: 0: non-blocking mode, immediately return after sending commands; 1: blocking mode, return after the robotic arm reaches the target position or the planning fails; single-thread mode: 0: non-blocking mode; other values: blocking mode, and timeout period setting, in s. |
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- 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_expand_pos(200, 20, 1))
arm.rm_delete_robot_arm()
Get the state of expansion joints rm_get_expand_state()
- Method prototype:
python
rm_get_expand_state(self) -> tuple[int, dict[str, any]]:
- Return value:
- int: state codes executed by functions.
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Dictionary of the expansion joint state
Parameter | Type | Description |
---|---|---|
rm_expand_state_t | dict[str,any] | Obtained dictionary of the expansion joint state, key: field name of rm_expand_state_t |
- 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_get_expand_state())
arm.rm_delete_robot_arm()