Python:
Get the Robotic Arm StateArmState It is used to get the robotic arm state. The following is a detailed description of the member functions of getting the robotic arm state ArmState, including the method prototype, parameter description, return value, and usage demo.
Get the current robotic arm state rm_get_current_arm_state()
- Method prototype:
rm_get_current_arm_state(self) -> tuple[int, dict[str, any]]:- Return value:
tuple[int, dict[str,any]]: a tuple containing two elements.
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Current robotic arm state
| Parameter | Type | Description |
|---|---|---|
rm_current_arm_state_t | dict | Dictionary of the current robotic arm state, key: parameters of rm_current_arm_state_t. |
- Usage demo
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_current_arm_state())
arm.rm_delete_robot_arm()Get the current joint temperature rm_get_current_joint_temperature()
- Method prototype:
rm_get_current_joint_temperature(self) -> tuple[int, list[float]]:- Return value:
tuple[int, list[float]]: a tuple containing two elements.
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Robotic arm joint temperature
| Parameter | Type | Description |
|---|---|---|
| - | list[float] | Temperature array of joints 1−7, in °C |
- Usage demo
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_current_joint_temperature())
arm.rm_delete_robot_arm()Get the current joint current rm_get_current_joint_current()
- Method prototype:
rm_get_current_joint_current(self) -> tuple[int, list[float]]:- Return value:
tuple[int, list[float]]: a tuple containing two elements.
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Robotic arm joint current
| Parameter | Type | Description |
|---|---|---|
| - | list[float] | Current array of joints 1−7, in mA |
- Usage demo
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_current_joint_current())
arm.rm_delete_robot_arm()Get the current joint voltage rm_get_current_joint_voltage()
- Method prototype:
rm_get_current_joint_voltage(self) -> tuple[int, list[float]]:- Return value:
tuple[int, list[float]]: a tuple containing two elements.
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Robotic arm joint voltage
| Parameter | Type | Description |
|---|---|---|
| - | list[float] | Voltage array of joints 1−7, in V |
- Usage demo
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_current_joint_voltage())
arm.rm_delete_robot_arm()Set the initial pose of the robotic arm rm_set_init_pose()
- Method prototype:
int rm_set_init_pose(self, joint: list[float]) -> int:- Parameter description:
| Parameter | Type | Description |
|---|---|---|
| joint | list[float] | Joint angle array for the robotic arm's initial pose |
- Return value:
State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Usage demo
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_init_pose())
arm.rm_delete_robot_arm()Get the initial pose of the robotic arm rm_get_init_pose()
- Method prototype:
rm_get_init_pose(self) -> tuple[int, list[float]]:- Return value:
tuple[int, list[float]]: a tuple containing two elements.
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Joint angle for the robotic arm's initial pose
| Parameter | Type | Description |
|---|---|---|
| - | list[float] | Joint angle array for the robotic arm's initial pose, in ° |
- Usage demo
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_init_pose())
arm.rm_delete_robot_arm()Get the current joint angle rm_get_joint_degree()
- Method prototype:
rm_get_joint_degree(self) -> tuple[int, list[float]]:- Return value:
tuple[int, list[float]]: a tuple containing two elements.
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Joint angle for the robotic arm's initial pose
| Parameter | Type | Description |
|---|---|---|
| - | list[float] | Joint angle array for the robotic arm's initial pose, in ° |
- Usage demo
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_joint_degree())
arm.rm_delete_robot_arm()Get all robotic arm states rm_get_arm_all_state()
- Method prototype:
rm_get_arm_all_state(self) -> tuple[int, dict[str, any]]:- Return value:
tuple[int, dict[str, any]]: a tuple containing two elements.
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- All robotic arm states
| Parameter | Type | Description |
|---|---|---|
rm_arm_all_state_t | dict | Dictionary of all robotic arm states, key: parameters of rm_arm_all_state_t. |
- Usage demo
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_arm_all_state())
arm.rm_delete_robot_arm()Get the controller RS485 mode rm_get_controller_rs485_mode()
- Method prototype:
rm_get_controller_rs485_mode(self) -> dict[str, any]:- Return value:
dict[str,any]: a dictionary containing the following keys
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Robotic arm state mode
| Parameter | Type | Description |
|---|---|---|
| mode | int | 0: RS485 serial communication by default, 1: modbus-RTU master mode, 2: modbus-RTU slave mode. |
- Baud rate
| Parameter | Type | Description |
|---|---|---|
| baudrate | int | Baud rate |
- Timeout
| Parameter | Type | Description |
|---|---|---|
| timeout | int | modbus protocol timeout period in 100 ms, available only in modbus-RTU mode. |
- Usage demo
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_controller_rs485_mode())
arm.rm_delete_robot_arm()Get the tool RS485 mode rm_get_tool_rs485_mode()
- Method prototype:
rm_get_tool_rs485_mode(self) -> dict[str, any]:- Return value:
dict[str,any]: a dictionary containing the following keys
- State codes executed by functions
0 represents success. For other error codes, please refer to the API2 Error Codes.
- Robotic arm state mode
| Parameter | Type | Description |
|---|---|---|
mode | int | 0: RS485 serial communication by default, 1: modbus-RTU master mode. |
- Baud rate
| Parameter | Type | Description |
|---|---|---|
baudrate | int | Baud rate |
- Timeout
| Parameter | Type | Description |
|---|---|---|
timeout | int | modbus protocol timeout period in 100 ms, available only in modbus-RTU mode. |
- Usage demo
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_tool_rs485_mode())
arm.rm_delete_robot_arm()
