MultiThreading Learning Mode¶
If you are using a Niryo One, please refer to this tutorial.
This documentation contains all the information on how to use the MultiThreading Learning Mode on Ned.
With this application, you are able to control in learning mode a first Ned (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 (but if you can, it’s better to use multiple real Ned). 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, the second one will be simulated. You can use this link to see how to use a Niryo Robot through Simulation.
For this application, you will need to put the two robots on a solid base.
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 “robot_ned.py” 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 “robot_ned.py” 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.