Create a Multi-Robot Production Line

create a multirobot production line

Note

This tutorial is working from:
The version v3.0.0 of the ned_ros_stack
The version v3.0.0 of Niryo Studio
The version v3.1.0 of PyNiryo

If you are using a Niryo One, please refer to this tutorial.

Introduction

Learn to simulate a production line in Multi-Robot (threading) with this new application. You will use the Vision Set, the Conveyor Belt, the PyNiryo package and two Ned. Click here to see the Github repository used to create a multi robots production line

Requirements

  • 2 Ned

  • A Vacuum Pump end effector for Ned

  • A Large Gripper

  • Red, blue and green pawns

  • The Vision Set and a workspace for the Conveyor Belt

  • A Conveyor Belt

  • A slope from the Education Set

Set-up

Hardware

Attach the front of the Conveyor Belt to the first Ned and plug the Large Gripper. Then, plug the Vacuum Pump to the other Ned, which is at the back of the Conveyor Belt. Midway between the two Ned, set the slope provided with the Education Set and attach the four landmarks of the workspace at the front of the Conveyor Belt, in front of the first Ned, as seen on the above picture and the following video.

Finally, calibrate the workspace.

Software

Before launching the program, three variables have to be modified in the robot.py file:

  • front_ned_ip_address: IP of the robot at the front

  • back_ned_ip_address: IP of the robot at the back

  • workspace1: workspace’s name. This workspace must exist on the robot.

Note

If the workspace doesn’t exist on the robot, the program will ask you to create one. Calibrate your workspace as usual, and press Enter when on a landmark.

Then, launch:

python3 robot.py

For the first launch, you need to give six positions to the program with the Learning Mode activated (press Enter to confirm a position). Do it in that order:

  • Front Ned:
    • The observation pose in which Ned can see the 4 landmarks of the workspace.

    • A position of a few centimeters above the slope (at the top of the slope).

    • The position from which the robot can drop the pawn on the slope.

  • Back Ned:
    • The position from which the robot can grab the pawn at the bottom of the slope.

    • A position a few centimeters above the previous position.

    • A position at the back of the Conveyor Belt where the robot can drop the pawn (in front of the second Ned).

Those 5 positions are stored in a file named data.txt.

Once it’s done, the Conveyor Belt will start moving, the front Ned will wait for a pawn to appear in its workspace. Once a pawn is seen, the Conveyor Belt is stopped, the front Ned will pick it and place it in the slope, while the Conveyor Belt starts again. Then, the back Ned will pick this pawn in bottom of the slope, and put it back on the Conveyor Belt.

Functioning

Ned

Multithreading allows us to perform several parts of the same program in parallel. You can then perform multiple instructions simultaneously within the same process. The exchange of information between threads is fast and easy, which makes multithreading very practical to control several Ned at the same time.

The program’s main thread launches a thread for each robot to control. Threads communicate with each other through shared variables and with the class threading.Event(). This way we can organize interactions between the two robots as well as we can control the Conveyor Belt and the sharing of the slope. Each thread is connected to a robot and controls it. Threads communicate together through variables located in the mother-class RobotsMains.

Features

The learning mode allows you to save positions. To get new positions at launch, use the argument {–reset}.

You can change settings of the production line:

  • The Conveyor Belt speed can be changed with the conveyor_speed variable in robot.py file.

  • The distance between the pawns can be changed with the conveyor_place_interval variable.

  • The width of pawns’ distribution on the Conveyor Belt can be changed with the rand_drop variable.

{–reset}

python3 robot.py --reset

Deletes the saved positions and launches the acquisition of new positions (similar to deleting or renaming the data.txt file).

FAQ

Why does the robot doesn’t detect objects on the Conveyor Belt ? (The Conveyor Belt does not stop).

If the robot does not detect objects placed on the Conveyor Belt, this might be due to the robot’s camera which cannot see the four landmarks of the workspace. Therefore, adjust the observation pose so the robot can see the four landmarks.

The Conveyor Belt does not stop at the end of the program.

In that case, relaunch the program and stop it again when the Conveyor Belt stops.