Teaching Robotics With ROS

Written by Ricardo Tellez

22/11/2018

A couple of months ago I interviewed Joel Esposito about the state of robotics education for the ROS Developers Podcast #21 (Joel Esposito is a Professor in the System Engineering Department at the United States Naval Academy). On that podcast, Joel talks about his deep research on how robotics is taught around the world. He identifies a set of common robotics subjects that need to be explained in order to make students know about robotics, and a list of resources that people are using to teach them. But most important than that, he points out the importance of practicing with robots what students learn.

From my point of view, robotics is about doing, not about reading. A robotics class cannot be about learning how to compute the Jacobian of a matrix to find the inverse kinematics. Computing the Jacobian has nothing to do with robotics, it is just a mathematical tool that we use to solve a robotics problem. That is why a robotics class should not be focused on how to compute the Jacobian but on how to move the end effector to a given location.

👨‍🎓:I want to move this robotic arm’s end effector to that point, how do I do it?
👨‍🏫:Well, you need to represent the current configuration of the arm in a matrix!
👨‍🎓:Ah, ok, how do I do that?
👨‍🏫:You need to use a matrix to encode its current state. Let’s do it. Take that simulated robot arm and create a ROS node that subscribes to the /joint_states and captures the joint values. From those values, create a matrix storing it. It has to be able to modify the matrix at any time step, so if I move the arm, the matrix must change.
[…]
👨‍🎓:Done it! So what do I have to do now if I want to make the robot put the gripper close to this bottle?
👨‍🏫:Then you need to compute the Jacobian. Let’s do it! Create a program that allows to manually introduce a desired position for the end effector. Then based on that data, compute the Jacobian.
👨‍🎓:How do I compute the Jacobian?
👨‍🏫:I love that you ask me that!☺️

I understand that learning and studying theory is a big part of robotics, but not the biggest. The biggest should be practicing and doing with robots. For that, I propose to use ROS as the base system, the enabler, that allows practical practice (does that exist?!?!) while learning the robotics subjects.

The proposal

Teaching subjects as complex as inverse kinematics or robot navigation should not be (just) a theoretical matter. Practice should be embedded into the teaching of those complex robotics subjects.

I propose to teach ROS at the same time that we teach robotics, and use the former along the whole robotics semester as a tool to build an implement the robotics subject we are teaching. The idea is that we use ROS to allow the student to actually practice what he is learning. For instance, if we are talking about the different algorithms of obstacle avoidance, we also provide a simulated robot and make the student create a ROS program that actually implements the algorithm for that robot. By following this approach, the learning of the student is not only theoretical but instead includes the practice of what is being told.

The advantage of using ROS in this procedure is that ROS already provides a lot of material already done that we can use to provide a working infrastructure, where you as a teacher, can concentrate on teaching the student how to create the small part that is required for the specific subject you are teaching.

We have so many tools at present that were not available just 5 years ago… Let’s make use of them to increase the student quality and quantity of learning! Instead of using Powerpoint slides, let’s use interactive Python notebooks. Instead of using a single robot for the whole class, let’s provide a robot simulation to each student. Instead of providing an equation on the screen, let’s provide students and the implementation of it in a ROS node for them to modify. 

Not a new method

What I preach is what I practice. This is the method that I am using on my class of Robot Navigation at the University of LaSalle in Barcelona. In this class, I teach the basics about how to make a robot autonomously move from one point of the space to another while avoiding obstacles. You know, SLAM, particle filters, Dynamic Window Approaches and the like. As part of the class, students must learn ROS and use it to implement some of the theoretical concepts I explain to them, like for example, how to compute the odometry based on the values provided by the encoders.

However,  I’m not alone on the use of this method for teaching robotics. For example, professor Ross Knepper from Cornell University explained to me on Using ROS to teach the foundations of robotics for the ROS Developers podcast #23. On that interview, Ross explained how he parallelizes the teaching of ROS with the robotics subject. He even goes further, forbidding students to use many ROS software like the ROS navigation stack or MoveIt! His point is very good: he wants the students to actually learn how to do it, not just how to use something that somebody else has done (like the navigation stack). But he uses the ROS infrastructure anyway. 

How to teach robotics with ROS

The method would involve the following steps:

  1. You start with a ROS class that explains the most basic topics of ROS, just what is required to start working.
  2. Then you start explaining the robotics subject of your choice, making the students implement what you are teaching in a ROS program, using robots. I advise using simulated robots.
  3. Whenever a new ROS concept is required for continuing the implementation of some algorithm, then a class dedicated to that subject would be given.
  4. Continue with the next robotics subject.
  5. Add a real robot project where students must apply all that they have learned in a single project with a real ROS-based robot.
  6. Add an exam.

1. Explain the basic ROS concepts

For this step, you should describe the basic subjects of ROS that would allow a student to create ROS programs. Those subjects would include the following:

  • ROS Packages
  • Launching ROS Nodes
  • Basic ROS Line Commands
  • ROS Topic Subscribers
  • Rviz for Visualization and Debugging

It is not necessary to dedicate too much time to those subjects, just the necessary amount for a basic understanding. Deeper knowledge and understanding of ROS will be learned by practicing during the different classes of the semester. While they are trying to create the software for the implementation of the theoretical concepts, they will have to practice those concepts, and ingrain them deeply into their brains.

Importantly, explain those concepts by using simulated robots and making the students apply the concepts to the simulated robot. For example, make the students read from a topic, in order to get the distance to the closest obstacle. Or make them write to a topic to make the robot move around. Do not just explain what a topic is and provide a code on a slide. Make them actually connect to a producer of data, that is, the simulated robot.

I would also recommend that at this step you forget teaching about creating custom messages, or what are services or action clients. That is too much for such an introductory class and it is very unlikely that you are going to need it in your next robotics class.

* Resource: As a reference, you can check the syllabus of this ROS Basics In 5 Days course we created. Through our many years of ROS training, we summarized this ROS basics course, including the essential concepts and tools that can help the user understand and create any basic project related to ROS.

2. Explain and implement robotics subject

You can now proceed to teaching your robotics subject. I recommend dividing the class into two parts:

  1. The first part will be to explain the theory of the robotics subject
  2. The second part is to actually implement that theory. Create a program that actually does what you explained.

It may happen that in order to implement that theoretical part, the student needs a lot of pre-made code that supports the specific point you are teaching. That will mean that you have to prepare your class even harder and provide each student with all that support code. The good news is that, by using ROS, it is very likely that you will find that code already done by someone. Hence, find or develop that code, and provide it as a ROS package to your students. More about where to find the code and how to provide it to your students below.

An interesting point to include here is what Professor Knepper indicated: He creates some exercises with deliberate errors, so the students learn to recognize situations where the system is not performing correctly, and, more importantly, to create the skills necessary to figure out how to solve those errors. Take that point into consideration as well.

3. Add the new ROS concept

At some point in time, you may need to create a custom ROS message for the robotics subject that you are teaching. Or you may need to use a ROS service because you need to provide a service for face recognition. Whatever you need to explain about ROS, now is the best moment. Use that necessity to explain the concept. What I mean is that explaining a concept like ROS action servers when the student has no idea what they would be used for is a bad idea. The optimal moment to explain that new ROS concept is when it is so clear for everyone that the concept is needed.

I have found that explaining complex concepts like ROS services when the students don’t need them makes it very difficult for them to understand, even if you provide good usage examples. They cannot feel the pain of not using those concepts in their programs. Only when they are in a situation where they actually need to apply the concept, when they are feeling the pain, will the knowledge be integrated into their heads.

4. Continue with the next robotics subject

Keep pushing this way. Move to the next subject. Provide a different robot simulation. Request that the students implement. And keep going this way until you finish the whole course.

5. Real robots project

Testing with simulators is good because it provides a real life-like experience. However, the real test is when you use a real robot. Usually, universities do not have the budget for a robot for each student. That is why we have been promoting the use of simulations so much. However, some real robot experience is necessary, and most universities can afford to have a few robots for the whole class. That is the point where the robotics projects come into action.

Define a robotics project that encapsulates all the knowledge of the whole course. Make the students create groups that will test their results on the real robot. This approach has many advantages: students will have to summarize all the lessons into a single application. They will have to make it work in a real robot. Additionally, they will have to work in teams.

In order to provide this step to the students, you will need to prepare the following:

  • A simulation of the environment where the real robot will be executing. This allows the students to practice most of the code in the simulator, in a faster way. It also allows you to have some rest (otherwise, the students may require your presence all the time at the real robot’s lab). 😉
  • You cannot escape providing some hours per week for the students to practice with the real robot. So schedule that.

Costa Coffee Gazebo ROS simulation

Finally, decide on a day when you will evaluate the project from each team. That is going to be called demo day. On demo day, each group has to show how their code is able to make the robot perform as it is supposed to.

For example, at LaSalle University, we use two Turtlebots for 15 students. The students must do teams of two people in order to do the project. Then, on demo day, their robot has to be able to serve coffee at a real coffee shop in Barcelona (thank you, Costa Coffee, for your support!). All the students go to the coffee shop with their programs, and we bring the two robots. Then, while one team is demonstrating on one robot, the other is preparing.

In case you need ROS certified robots, let me recommend you the online shop of my friends: ROS Components shop. There is where I buy robots or pieces when I need them. No commission for me for recommending it! I just think they are great.

* Resources: If your course is affected by the coronavirus and you need to move your course online, then I suggest that you check out this article, in which I share how I teach robotics from home to students.

6. Evaluation

One very important point in the whole process is how to evaluate the students. In my opinion, the evaluation must be continuous, otherwise, the students just do nothing until the  day before the exam. Afterward, all are lamentations. 

At LaSalle University, I do a one-hour exam every month, covering the topics I have taught during that month, and the previous months, too. 

In our case, the exams are completely practical. They have to have the robot perform something related to the subjects taught. For example, they have to make the robot create a map of the environment using an extended Kalman filter. I may provide the implementation of the extended Kalman filter for straight usage, but the student must know how to use it, how to capture the proper data from the robot, how to provide that to the filter, and how to use the output to build the map. 

Just as a matter of example, here you can find a ROSject containing the last exam I gave to the students about dead reckoning navigation. The ROSject contains everything they needed to do the exam, including instructions, scores, and robot simulations. That leads us to the next point. 

How to provide the material to the students

If I have convinced you to use a practical method to teach robotics using ROS, at this point, you must be concerned about two points: 

  1. How the hell am I going to create all that material?!
  2. How the hell can I provide my students with a running environment where they can execute those simulations and ROS code?

Very good concerns.

Preparing the material is a lot of work. And more importantly, there is a lot of risks. When you prepare such material, there are a lot of probabilities that what you prepare does not work with the student’s computer. That is why I propose using an online platform for preparing all that material, and sharing the material inside the same platform, so you will be 100% sure that it will work no matter who is going to use it. 

I propose that you use the ROS Development Studio. This is a platform that we have developed at our company, The Construct, for the easy creation, testing, and distribution of ROS code. 

The ROS Development Studio (or ROSDS, for short) allows you to create the material using a web browser on any type of computer. It already provides the simulations you may need (and you can also add your own). It also provides a Python notebook structure that you can fill with the material for the students. It allows you to include any code that your students may require in the form of ROS packages. 

But the most interesting point of the ROSDS is that it allows you to share all your material by sending a simple web link to the students. That is what we call a ROSject. A ROSject is a complete ROS project that includes simulations, notebooks, and code in a single web link. Whenever you provide this link to anybody, they will get a copy of the entire content, and they will be able to execute it in the exact same conditions in which you created the ROSject. 

This sharing feature makes it very easy for the students to share their programs with you for evaluation, in case of exams, or for help in case they are stuck while studying. Since the ROSject contains all the material, it will be very easy for you to correct the exam in the conditions the student created the program, without requiring you to copy files or set up your computer environment. Just tell the students to share the ROSject link with you. 

We use the ROSjects at LaSalle to provide different lessons and practices. For example, we have a ROSject with the simulation of the coffee shop where the students will do the project evaluation. Also, we use a ROSject to create the exams (as you can see in the previous section). 

Summarizing: ROSjects allow you to encapsulate your lessons in a complete unit that includes the explanations with the simulations and the code. And all that for free. 

Still, you will have to create your ROSjects for your classes. This is something that is going to end in the near future as more and more universities are creating their ROSjects and publishing them online for everybody. 

However, if you do not want to wait until they are created, I can recommend our online academy, the Robot Ignite Academy, where we provide ready-made ROS-based courses about ROS basics, ROS2, robot navigation, deep learning, manipulation, robot perception, and more. The only drawback is that the academy has a certain cost per student. However, it is highly recommended because it simplifies your preparation. We use the Robot Ignite Academy at LaSalle, but many other universities use it around the world, like Clarkson University (USA), University of Michigan (USA), Chukyo University (Japan), University of Sydney (Australia), Universite of Luxembourg (Luxembourg), Universite de Reims (France), and University of Alicante (Spain). 

Additional topics you may need to cover

Finally, I would like to make a point on a problem that I have identified when using this method. 

I find that most of the people that come to our Robot Navigation class have zero knowledge about programming in either Python or C++nor any knowledge on how to use Linux shell. After interviewing several robotics teachers around the world, I found that this is the case for other countries as well. 

If that is your situation, first I would recommend that you reduce the scope of the programming you teach to just the use of Python. Do not go into C++. C++ is too complex to start teaching along with robotics. Also, Python is very, very powerful and easy to learn. 

I usually create an initial class about Python and Linux shell. I do this class and immediately, the very next week, I give an exam to the students about Python and Linux shell. The purpose of the exam is to stress to the students the importance of mastering those programming skills. They are the basis for all the rest. 

Here you can find a free online course for learning Python, and here, another one for learning Linux shell

Additional problems that you may find is that the students have problems understanding English (if you are not in an English-speaking country). Most of ROS documentation is in English. The way to communicate in the ROS community is in English (whether we like it or not). You may be feeling tempted to lower the bar for your students and create the course notes in your mother language, and only provide documentary resources in your own language. I suggest not doing it. Push your students in English learning! The community needs a common language, and at present, it is English. Take this chance to push your students to grow and force them to read the documentation sources in English. 

Conclusion

I started this post talking about the findings of Joel Esposito. Even if you listed to the podcast interview, you will see that his final conclusion is that not to use ROS for teaching robotics. I’m sure there are other teachers with the same opinion. Other teachers like professor Knepper do advocate for just the opposite. Those are points of view, like mine in this article. I recommend you to listen to the podcast interview to Joel so you can understand why he suggests that.

It is up to you to decide. Now you have several opinions here. Which one is best for you? Please leave your answer into the comments so we can start a debate about it.

For teachers

A Full ROS & Robotics Teaching Solution

Trusted by hundreds of universities

0 Comments

Trackbacks/Pingbacks

  1. Some great links for 12/12/2018 – Pito Salas' Blog - […] Teaching Robotics With ROS | The Construct […]

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This