Teaching Robotics With ROS

Teach ROS in Luxemburg University

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 advice to use simulated robots.
  3. Whenever a new ROS concept is required for continuing the implementation of some algorithm, then, a class dedicated to that subject is performed.
  4. Continue with the next robotics subject
  5. Add a real robot project where students must apply all that they have learned into 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 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 for them to know about. Deeper knowledge and understanding of ROS will be learned by practicing along 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 deeper into their brain. 

Very important, 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, 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 the 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 is very unlikely you are going to need it in your next robotics class.

2. Explain and implement robotics subject

You can now proceed on teaching your robotics subject. How I recommend is to divide the time of the class into two:

  1. First part will be to explain the theory of the robotics subject
  2. Second part 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 to the student will 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 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 indicates: he creates some exercises with deliberated errors, so the students learn to recognize situations where the system is not performing correctly, and, more important, to create the skills necessary to figure out how to solve those errors. Take that point also into consideration.

3. Add new ROS concept

At some point in time, you may need to create a custom ROS message for the robotics subject 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 it 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 for what this could be useful 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 myself that explaining complex concepts like ROS services when the students don’t need them is very difficult for them to understand, even if you provide good examples of usage. They cannot feel the pain of not using those concepts in their programs. Only when they are in the situation that actually needs to apply the concept, only then is when they are going to feel the pain, and the knowledge is going to 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 the students for implementation. And keep going this way until you finish the whole course.

5. Real robots project

Testing with simulators is good because it provides real life-like experience. However, the real test is when you use a real robot. Usually, Universities do not have a budget for a robot for each student, that is why we have been promoting so much the use of simulations. 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 project comes 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 also the following:

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

Finally, decide a day when you will evaluate the project for 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.

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 the coffee on a real coffee shop of 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.

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 previous day of the exam. Afterward, all are lamentations.

Al LaSalle University, I do an exam of one hour 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 do 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 did 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 on using a practical method to teach robotics using ROS, at this point, you must be concerned about two points:

  1. How the hell I’m going to create all that material!!
  2. How the hell can I provide with my students with a running environment where to execute that bunch of simulations and ROS code

Very good concerns.

Preparing the material is a lot of work. And more important, there is a lot of risks. When you prepare such material, there are a lot of probabilities that what you prepared does not work for the student computer. That is why I propose to use an online platform for preparing all that material, and share 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 you to use the use of the ROS Development Studio. That 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 (even if you can add your own ones). It also provides a Python notebook structure that you can fill with the material for the students. It also 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 whole content, and they will be able to execute it in the exact same conditions as you created the ROSject.

This sharing feature makes very easy also for the students to share with you their program 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 setting up your computer environment. Just tell the students to share with you the ROSject link.

We use the ROSjects at LaSalle to provide the 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 the 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 with 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 finish in the close future as more and more Universities are creating their ROSjects and publishing them online for anybody.

However, if you do not want to wait until they are created, I can recommend you our online academy the Robot Ignite Academy, where we provide already made ROS based courses about ROS basics, ROS2, robot navigation, deep learning, manipulation, robot perception, and else. 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) or 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 also for other countries.

If that is your case, first I would recommend that you reduce the scope of learning programming to the use of Python. Do not go to C++. C++ is too much complex to start teaching it together 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, on the next week, I do an exam to the students about Python and Linux shell. The purpose of the exam is to stress the students on the importance of mastering those programming skills. They are the base of 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. 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 low the bar for your students and create the course notes in your mother language, and only provide documentary resources to your own language. I suggest not to do it. Push your students in English learning! The community needs a common language, and at present it is English. Take this chance to make your students 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.

Share This