MultiThreading Learning Mode


Multithreading Learning mode application

Difficulty: medium

Time: ~20 min


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.

ROS Logo Ned


This documentation contains all the information on how to use the MultiThreading Learning Mode on Ned/Ned2.

With this application, you are able to control in learning mode a first Ned/Ned2 (called “leader”) and have a second one (called “follower”) doing the same movements as the leader one.

It is also possible to use the MultiThreading learning mode with multiple followers.


To run this application, you will need at least one real Ned/Ned2 (but if you can, it’s better to use multiple real Ned/Ned2). A first one is the leader and the other ones are the followers. Make sure that every robot is connected to internet (it is preferable to have an ethernet connection for speed purposes).

If you are using just one real Ned/Ned2, the second one will be simulated. You can use this link to see how to use a Niryo Robot through Simulation.

Hardware part


For this application, you will need to put the two robots on a solid base.

Software part

  • Install the PyNiryo library:

With the following command:

pip install pyniryo
  • How to connect to the robots:

To do that, you just need to put the IP addresses of the robots you are using in the script called “” like this:

robot_leader_ip = "ip_of_the_leading_robot" # ip of the Leading robot
robot_clients_ip = ["list_of_all_the_follower_ip"] # list of ips of the followers

How to run the application


Before running the application, make sure the environment around the real robots is clear and that robots are correctly calibrated (you can use Niryo Studio for that).

To run the application, you need to open a terminal and go in the repository where you have the script “” and launch it.


How it works

This application is using the MultiThreading system explained in this tutorial: threading lib. In this application there are two types of robots: the leader one and the followers. The leader one measures multiple times per second the value of the joints and send it to the followers robots.

The followers robots read continuously the values given by the leader and use the “jog_joints()” function to follow as far as possible the movements of the leader robot.

Tips for Multi Threading Learning Mode

To have a fluid movement, we advise you to use an Ethernet connexion with the two robots. This allows to have a low latency between the computer and the robots.