Create a Multi-Robot Production Line


create a multirobot production line

Difficulty: hard

Time: ~40 min


This tutorial is working from:
The version v4.1.0 of the ned_ros_stack
The version v4.1.0 of Niryo Studio
The version v1.1.2 of PyNiryo

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


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/Ned2. Click here to see the Github repository used to create a multi robots production line


  • 2 Ned (or 2 Ned2)

  • A Vacuum Pump end effector for Ned/Ned2

  • 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



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/Ned2, 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/Ned2, as seen on the above picture and the following video.

Finally, calibrate the workspace.


Before launching the program, three variables have to be modified in the 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.


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:


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/Ned2:
    • The observation pose in which Ned/Ned2 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/Ned2:
    • 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/Ned2).

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

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



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/Ned2 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.


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 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.


python3 --reset

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


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. If the robot picks the object too high or too low, change the offset. If the robot has trouble recognizing objects and/or colors, you can adjust the brightness settings.