If you teach mechatronics, engineering, or if you do some robotics research, you certainly have heard about Matlab.
And maybe you’re already using Niryo One for your teaching activities. If you haven’t heard of Niryo One before: this is a 6 axis robotic arm, made for teaching and learning robotics.
Well, we have some great news : You can now use a Matlab interface to control Niryo One, including a nice feature to practice on system control.
You can simulate almost everything with Matlab: from a motor PID to a complete set of robots controlled by artificial intelligence.
It’s now time to go beyond simulation and work on real physical systems!
The Niryo One Matlab interface
What’s the point of this interface ?
The goal of this Matlab integration is to allow students to learn more about system control. When you move a robot, basically you first create a trajectory, and pass this trajectory to a controller which will try to move the motors accordingly to the given command.
In a perfect world (aka, simulation mode), everything is always running smoothly. But in real life, you have to take into account the gravity, the torque needed for the motor, the PID of the motor, and many other factors.
With the Niryo One – Matlab integration, you can give a trajectory to the robot from the interface, and see both the theoretical trajectory AND the real trajectory executed by the robot. With some plotting utilities you’re able to see the difference between simulation and real life.
As a teacher, this will help you make your students get a better understanding of the concepts behind system control.
How to use the Matlab interface ?
First you will need to run the Niryo One ROS stack.
If you have a Niryo One with you, you just need to start the robot and that’s it!
If you don’t have a robot yet, you can still use the Niryo One simulation mode and do the same experiments (see instructions here to run the simulation on your computer). However, as this is a simulation mode, you won’t be able to really get the main benefits out of the application.
Now, you’ll need to follow this tutorial to install and configure Niryo One – Matlab on your computer.
The configuration requires some time if you are not familiar with command line tools, but is totally doable thanks to the clear instructions.
Once the setup is done, just launch Niryo One and the Matlab interface, and you’re ready to go!
This interface has some common features with Niryo One Studio (official desktop app to control the robot).
You will first connect to the robot.
Then you can give some commands to move the robot joints.
A trajectory will be computed and you can see the result on the “Plot trajectories” panel (see the first photo above).
Technical details behind this interface
First of all, another good news for you: all the Matlab code for Niryo One is open source!
You can find the code and instructions right here on GitHub. Feel free to give us a star if you like the project!
Sarra from our team spent quite a time working on this interface. She has used Matlab a lot during her time studying engineering, so she really knew what would be interesting to do from a student/teacher point of view.
Now we give you more details so you can understand how we technically linked Niryo One ROS stack and the Matlab interface.
Niryo One is powered by ROS. Check out this website if you haven’t heard of ROS before.
The challenge here was to communicate between a ROS application and a Matlab application. For that, we used the ROS functionality of the Matlab Robotics Toolbox. This is a nice add-on that lets you connect any robot powered by ROS with Matlab.
If you want more details about the implementation, check out the code on GitHub. Thanks to the open source license, you can learn from it and share your changes with the open source community.
Another step towards industry 4.0
Industry 4.0 is really here and growing each year.
Education is one of the most important pillar of this new robotics revolution. With adapted teaching materials , today’s students will become tomorrow’s best assets to lead this new robotics era.
Working with real robot is the new things, and it’s become available thanks to many factors – including open source, 3D printing, and fast prototyping.
Using Matlab with Niryo One is a perfect example of a new way of teaching to prepare students for all the challenges that are awaiting them.
So, don’t wait and discover Niryo One with Matlab!