Skip to content

Communication Configuration CommunicationConfig

The robotic arm controller communicates with the user through the network port, WiFi, RS232-USB port, and RS485 port, and there is no need for users to switch when using. With any of the above ports, after receiving the command, the controller will return the data through the same port if the command format is correct. The following is a detailed description of the member functions of the communication configuration CommunicationConfig, including the method prototype, parameter description, return value, and usage demo.

Set the WiFi AP mode rm_set_wifi_ap()

  • Method prototype:
python
rm_set_wifi_ap(self, wifi_name: str, password: str) -> int:
  • Parameter description:
ParameterTypeDescription
wifi_namestrWiFi name
passwordstrWiFi password
  • 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)

print(arm.rm_set_wifi_ap("robot", "12345678"))

arm.rm_delete_robot_arm()

Set the WiFi STA mode rm_set_wifi_sta()

  • Method prototype:
python
rm_set_wifi_sta(self, router_name: str, password: str) -> int:
  • Parameter description:
ParameterTypeDescription
router_namestrRouter name
passwordstrRouter WiFi password
  • 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)

print(arm.rm_set_wifi_sta("robot", "12345678"))

arm.rm_delete_robot_arm()

Set the baud rate of the controller RS485 rm_set_RS485()

After the setting is successful, the buzzer rings.

  • Method prototype:
python
rm_set_RS485(self, baudrate: int) -> int:
  • Parameter description:
ParameterTypeDescription
baudrateintBaud rate: 9600, 19200, 38400, 115200, and 460800. If the user sets other values, the controller uses 460800 by default.
  • 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)

print(arm.rm_set_RS485(115200))

arm.rm_delete_robot_arm()

Get the wired network informationrm_get_wired_net()

If the wired network is not connected, invalid data will be returned.

  • Method prototype:
python
rm_get_wired_net(self) -> dict[str, any]:
  • Return value:dict[str,any]: a dictionary containing the following keys
  1. return_code (int): a state code 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. Network address
ParameterTypeDescription
ipstrIP address
maskstrSubnet mask
macstrMAC address
  • 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_wired_net())

arm.rm_delete_robot_arm()

Get the WiFi network information rm_get_wifi_net()

  • Method prototype:
python
rm_get_wifi_net(self) -> tuple[int, dict[str, any]]:
  • Return value:dict[str,any]: a dictionary containing the following keys
  1. return_code (int): a state code 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. WiFi network information
ParameterTypeDescription
rm_wifi_net_tdict[str,any]Dictionary of the WiFi network information, key: field of rm_wifi_net_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_wifi_net())

arm.rm_delete_robot_arm()

Restore the network factory default rm_set_net_default()

  • Method prototype:
python
rm_set_net_default(self) -> int:
  • 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)

print(arm.rm_set_net_default())

arm.rm_delete_robot_arm()

Set the WiFi OFF rm_set_wifi_close()

It will be enabled after the restart.

  • Method prototype:
python
rm_set_wifi_close(self) -> int:
  • 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)

print(arm.rm_set_wifi_close())

arm.rm_delete_robot_arm()