Python:
System ConfigurationControllerConfig It is used for system configuration (e.g., robotic arm state and power). The following is a detailed description of the member functions of the system configuration ControllerConfig, including the method prototype, parameter description, return value, and usage demo.
Get the controller state rm_get_controller_state()
- Method prototype:
rm_get_controller_state(self) -> dict[str, any]:- Return value:
dict[str,any]: a dictionary containing the following keys.
- int: state codes executed by functions.
0 represents success. For other error codes, please refer to the API2 Error Codes.
- System state
| Parameter | Type | Description |
|---|---|---|
voltage | float | Returned voltage |
current | float | Returned current |
temperature | float | Returned temperature |
sys_err | int | System error code |
- 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_state())
arm.rm_delete_robot_arm()Set the robotic arm power rm_set_arm_power()
- Method prototype:
rm_set_arm_power(self, power: int) -> int:- Parameter description:
| Parameter | Type | Description |
|---|---|---|
power | int | 1: power on, 0: power off. |
- 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)
# Power on the robotic arm
print(arm.rm_set_arm_power(1))
arm.rm_delete_robot_arm()Get the power state of the robotic arm rm_get_arm_power_state()
- Method prototype:
rm_get_arm_power_state(self) -> tuple[int, int]:- Return value:
tuple[int, int]: a tuple containing two elements
int: state codes executed by functions.
0 represents success. For other error codes, please refer to the API2 Error Codes.
Robotic arm power state
Parameter Type Description - intObtained power state of the robotic arm, 1: power on, 0: power off
- 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_power_state())
arm.rm_delete_robot_arm()Get the cumulative runtime of the controller rm_get_system_runtime()
- Method prototype:
rm_get_system_runtime(self) -> dict[str, any]:- Return value:
tuple[int, int]: a tuple containing two elements
int: state codes executed by functions.
0 represents success. For other error codes, please refer to the API2 Error Codes.
Controller runtime
Parameter Type Description dayintRead time hourintRead time minintRead time secintRead time
- 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_system_runtime())
arm.rm_delete_robot_arm()Clear the cumulative runtime of the controller rm_clear_system_runtime()
- Method prototype:
rm_clear_system_runtime(self) -> int:- 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_clear_system_runtime())
arm.rm_delete_robot_arm()Get the cumulative rotation angle of the joint rm_get_joint_odom()
- Method prototype:
rm_get_joint_odom(self) -> tuple[int, list[float]]:- Return value:
tuple[int, list[float]]: a tuple containing two elements.
int: state codes executed by functions.
0 represents success. For other error codes, please refer to the API2 Error Codes.
Cumulative joint rotation angle
Parameter Type Description - list[float]Cumulative rotation angle of each joint
- 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_odom())
arm.rm_delete_robot_arm()Clear the cumulative rotation angle of the joint rm_clear_joint_odom()
- Method prototype:
int rm_clear_joint_odom(self) -> int:- 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_clear_joint_odom())
arm.rm_delete_robot_arm()Get the software information of the robotic arm rm_get_arm_software_info()
- Method prototype:
rm_get_arm_software_info(self) -> tuple[int, dict[str, any]]:- Return value:
tuple[int, dict[str, any]]: the first element is the status code, and the second element is the robotic arm software version information dictionary.
int: the status code returned by the function.
Return value Description 0 Obtained and parsed successfully. -1 Data sending failed; a problem occurred during communication. -2 Data receiving failed; a problem occurred during communication or the controller timed out without returning. -3 Return value parsing failed; the data cannot be recognized or is incomplete; this value is also returned when the version format of a 4th-generation controller cannot be recognized. Robotic arm software version information
Parameter Type Description rm_arm_software_version_tdict[str,any]Dictionary of the robotic arm software version information, key: field name of rm_arm_software_version_t Jump to rm_arm_software_version_t for details of the structure.
- Usage demo
from Robotic_Arm.rm_robot_interface import (
RoboticArm, rm_thread_mode_e, rm_api_version,
)
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)
print("SDK version:", rm_api_version())
print("Local algorithm version:", arm.rm_algo_version())
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
if handle.id <= 0:
raise RuntimeError("Failed to connect to the robot")
try:
ret, software_info = arm.rm_get_arm_software_info()
if ret == 0:
print("Controller software:", software_info)
else:
print("Failed to obtain or parse the controller software information, status code:", ret)
finally:
arm.rm_delete_robot_arm()Set the wired network IP address rm_set_NetIP()
- Method prototype:
rm_set_NetIP(self, ip: str, netmask: str, gw: str) -> int:- Parameter Description:
| Name | Type | Description |
|---|---|---|
ip | str | The IP address of the wired network interface. |
netmask | str | The subnet mask of the wired network interface. |
gw | str | The gateway address of the wired network interface. |
- 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)
# Set the IP address of the robotic arm to "192.168.1.19"
print(arm.rm_set_NetIP("192.168.1.19", "255.255.255.0", "192.168.1.1"))
arm.rm_delete_robot_arm()Clear the system error rm_clear_system_err()
- Method prototype:
rm_clear_system_err(self) -> int:- 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_clear_system_err())
arm.rm_delete_robot_arm()
