TCPIP

Controlling the robot arm using TCP/IP

The user can connect the robot arm through the IP address of the robot arm, so as to achieve the effect of remote operation of the robot arm without connecting the USB port

Note: Currently only Python3 uses the robot arm in this way, provided there is a server and it has been enabled.

Action before connecting

Get Robot IP and Port

1 Get the latest Basic and Atom firmware,Burn method

2 Get Robot IP and Port

M5 version:

The display at the bottom of the robot arm selects the third Transponder--and then selects the second WLAN Server

7.6-27.6-3

As shown in the picture, the IP and port number of the robotic arm have been displayed

7.6-2

PI version:

wireless network

Click the WIFI icon, connect to WIFI, and enter the WIFI password, click the Connection Information option 7.6-2

wired network Network cable to connect to the network port of the robotic arm

7.6-2

Click Connection Information to view the current IP

7.6-2

Note: The robotic arm needs to be under the same network segment as the control terminal, that is, under the same WIFI

3 Download the server file Server.py through GitHub and run it on the robotic arm system7.6-2

4 Open a command terminal 7.6-2

5 Enter the following code to run the script:

python Server.py

The operation is successful as shown in the figure: 7.6-2

socket control

connect(serialport, baudrate, timeout)

  • function: Connect the robotic arm via serial port and baud rate(For PI version)
  • parameter
    • serialport: ( str) default/dev/ttyAMA0
    • baudrate: Baud rate default 1000000
    • timeout: default0.1

Example:

from pymycobot import MyCobotSocket
# Use port 9000 by default
# Where "192.168.10.22" is the IP of the robot arm
mc = MyCobotSocket("192.168.10.22","9000")

#The Raspberry Pi version needs to enter the connect function, the default value is ("/dev/ttyAMA0", "1000000"):
#Not required when the machine model is M5 version
#mc.connect()

#After the connections is normal, the robot arm can be controlled.
res = mc.get_angles()
print(res)
mc.send_angles([0,0,0,0,0,0],20)
...

results matching ""

    No results matching ""