Instructions for Industry 4.0 Package

Before installing and using the industry 4.0 package, read the Introduction of this robot arm, understand the product, and perform the learning and adjustment of it.

1 Installing the package

Perform initial installation of the package according to Installation Tutorial for myCobot Industry 4.0 Package and by following the instructions. 2. The equipment for the package is updated, so update new equipment and their connection methods by referring to the diagram below. Stand: The new stand supports the cameras of with a wide range, and a new camera is provided. tof port: the position of the tof port is changed. QR code: a QR code is added to divide the range of recognition.

2 Installing Python

The language used herein is Python. If you haven\'t install it, install it by following Installation Tutorial. It is recommended to install the latest version.

PS: If you have installed Python, skip this step.

3 Installing a third-party package

Install a third-party package of Python through a terminal or compilation software. The installation instructions are as follows:

pip install --upgrade pip
pip install opencv-python
pip install opencv-contrib-python
pip install numpy

4 Description of codes

# mode=1, color recognition
# mode=2, image recognition
mode = 1

# If this value is exceeded, there is no object in the box; if it is not exceeded, there is an object in the box.
# to supports the middle box only.

# to set the initial coordinate of the robot arm when the program runs.

# to set the coordinate before gripping the objects on the right

# to set the coordinate for placing the object on the conveyor belt.
PUT_CUBE_X = 210.3
PUT_CUBE_Y = -113.8
PUT_CUBE_Z = 265.9

# to set the coordinate before adsorbing the object on the conveyor belt.

The coordinates above correspond to the coordinates of ready points respectively. The forward direction of X-axis is the front of the robot arm; the forward direction of Y-axis, the left; and the forward direction of Z-axis, the top. The threshold value can be adjusted depending on the height of the object placed.

You can:


Check the current distance value and make proper adjustment to the threshold value.

def run():
    global move_count,mode
    # get which mode should be run
    get_mode = mode
    cap_num = 1
    cap = cv2.VideoCapture(cap_num)
    if not cap.isOpened():

    if get_mode != 1:
        goal = []
        path = os.getcwd()+'/local_photo/img'
        for i,j,k in os.walk(path):
            for l in k:
    # init a class of Object_detect
    detect = Object_detect("COM9", 115200)

1、The value of cap_num in this part of codes corresponds to the computer camera to an externally connected camera.

2、For the part of detect = Object_detect("COM9"), modify it according to the actual serial port number of the robot arm.

3、The path output by path is the place where storing identifiable images are saved during image recognition (modifiable).

5 How to check the serial port number of the robot arm

1、Click \"this computer\" to open management and check


2、Select the device manager and check the port in the right list. Check 查看2


Connect the USB port of the camera directly to the computer, and other devices can be connected to the computer with a transfer port.

results matching ""

    No results matching ""