Skip to content

Controller IO Configuration and Query controllerIOConfig

It is used for IO configuration. The following is a detailed description of the member functions of the controller IO configuration and query controllerIOConfig, including the method prototype, parameter description, return value, and usage demo.

Controller IO The robotic arm controller has IO ports for interaction with peripheral equipment. The quantity and classification of IO ports are as follows:

TypeQuantityDescription
Digital IOFour channelsOptional for 0 V−24 V, DO/DI multiplexing

Set the IO mode rm_set_io_mode()

  • Method prototype:
python
rm_set_io_mode(self, io_num: int, io_mode: int, io_speed: int=0, io_speed_mode: int=0) -> int:
  • Parameter description:
ParameterTypeDescription
io_numintIO port numbers 1−4.
io_modeintMode,
0: general-purpose input mode.
1: general-purpose output mode.
2: input start function multiplexing mode.
3: input pause function multiplexing mode.
4: input resumption function multiplexing mode.
5: input emergency stop function multiplexing mode.
6: input to current loop drag multiplexing mode.
7: input to position-only drag mode (available for the 6-DoF force version).
8: input to orientation-only drag mode (available for the 6-DoF force version).
9: input to position-orientation drag multiplexing mode (available for the 6-DoF force version).
10: input maximum external axis soft limit multiplexing mode (available for external axis mode).
11: input minimum external axis soft limit multiplexing mode (available for external axis mode).
12: input initial pose function multiplexing mode.
13: output collision function multiplexing mode.
14: Real-Time Speed Adjustment Function Multiplexing Mode.
io_speedintThe speed value range is 0-100.
io_speed_modeintThe mode value range is 1 or 2.
1-indicates single-trigger mode. In single-trigger mode, when the IO is pulled low, the speed is set to the value of the speed parameter. When the IO returns to a high level, the speed is set to the initial value.
2-indicates continuous-trigger mode. In continuous-trigger mode, when the IO is pulled low, the speed is set to the value of the speed parameter, and when the IO returns to a high level, the speed maintains the current value.
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe 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 IO channel 1 to the general-purpose output mode
print(arm.rm_set_io_mode(1, 1))
print(arm.rm_set_io_mode(2, 14,50,2))
arm.rm_delete_robot_arm()

Set the digital output state rm_set_do_state()

  • Method prototype:
python
rm_set_do_state(self, io_num: int, state: int) -> int:
  • Parameter description:
ParameterTypeDescription
io_numstrIO port number, range: 1−4
stateintIO state, 1: high output, 0: low output
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe 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 IO channel 1 output to high
print(arm.rm_set_do_state(1, 1))

arm.rm_delete_robot_arm()

Get the digital IO state rm_get_io_state()

  • Method prototype:
python
rm_get_io_state(self, io_num: int) -> dict[str, any]:
  • Parameter description:
ParameterTypeDescription
io_numstrIO port number, range: 1−4
  • Return value:dict[str,any]: a dictionary containing the following keys
  1. int: state codes executed by functions.
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  1. IO state and mode.
ParameterTypeDescription
io_stateintIO Status Acquisition Structure
io_modeintMode,
0: general-purpose input mode.
1: general-purpose output mode.
2: input start function multiplexing mode.
3: input pause function multiplexing mode.
4: input resumption function multiplexing mode.
5: input emergency stop function multiplexing mode.
6: input to current loop drag multiplexing mode.
7: input to position-only drag mode (available for the 6-DoF force version).
8: input to orientation-only drag mode (available for the 6-DoF force version).
9: input to position-orientation drag multiplexing mode (available for the 6-DoF force version).
10: input maximum external axis soft limit multiplexing mode (available for external axis mode).
11: input minimum external axis soft limit multiplexing mode (available for external axis mode).
12: input initial pose function multiplexing mode.
13: output collision function multiplexing mode.
14: Real-Time Speed Adjustment Function Multiplexing Mode.
  • 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)

# Get the state of the IO channel 1
print(arm.rm_get_io_state(1))

arm.rm_delete_robot_arm()

Get all IO input state rm_get_io_input()

  • Method prototype:
python
rm_get_io_input(self) -> tuple[int, list[int]]:
  • Return value: tuple[int, list[int]]: A tuple containing two elements.
  1. int: state codes executed by functions.
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  1. Four-channel digital input state list
ParameterTypeDescription
-list[int]Four-channel digital input state list, 1: high, 0: low, -1: the port is not in input mode
  • 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)

# Get the IO input state
print(arm.rm_get_io_input())

arm.rm_delete_robot_arm()

Get all IO output state rm_get_io_output()

  • Method prototype:
python
rm_get_io_output(self) -> tuple[int, list[int]]:
  • Return value:tuple[int, list[int]]: A tuple containing two elements.
  1. int: state codes executed by functions.
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  1. Four-channel digital output state list
ParameterTypeDescription
-list[int]Four-channel digital output state list, 1: high, 0: low, -1: the port is not in output mode
  • 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_io_output())

arm.rm_delete_robot_arm()

Set the controller power output rm_set_voltage()

  • Method prototype:
python
rm_set_voltage(self, voltage_type: int) -> int:
  • Parameter description:
ParameterTypeDescription
voltage_typeintPower output type, 0: 0 V, 2: 12 V, 3: 24 V
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe 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 controller power output to 24 V
print(arm.rm_set_voltage(3))

arm.rm_delete_robot_arm()

Get the controller power output rm_get_voltage()

  • Method prototype:
python
rm_get_voltage(self) -> tuple[int, int]:
  • Return value:tuple[int, int]
  1. int: state codes executed by functions.
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  1. Power output type
ParameterTypeDescription
-intPower output type, 0: 0 V, 2: 12 V, 3: 24 V
  • 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_voltage())

arm.rm_delete_robot_arm()