How To Build A Robotics MOOC Based On ROS

Written by Ricardo Tellez

18/01/2018

Many people would like to teach a MOOC about robotics, however the preparation of it can be very long, specially if one wants to provide on the course something more than just a list of facts and concepts.
If the course is based on ROS, the teacher will have access to many concepts working off the shelf. Using ROS speeds up the creation of the MOOC since allows the teacher to demo those concepts without infinite number of preparation hours. Furthermore, it permits to embed student practice in the course itself.

In this article, we are going to show you a way to organize and speed the development of your MOOC robotics course when it is based on ROS. It doesn’t matter the robotics subject, as far as it is about programming robots for doing things. We are leaving from this tutorial MOOCs about robotics hardware.

Introduction

When we talk about robotics MOOCs here, we are talking about courses that teach some theoretical subject of robotics (inverse kinematics, SLAM, visual servoing…) but that make the student practice with real robots at the same time. We believe that it is mandatory to practice with robots at the same time in order to really understand the theory. For this reason, we are going to use the ROS infrastructure as our practical framework.

While explaining the method, we are going to do an example of building a MOOC. Please do the example with me, so you can get the practice of building those courses. In case you have questions, please post them beneath on the comments of the post.

ros-development-studio-version-2-by-the-construct

Steps to build a robotics MOOC based on ROS

This is the list of steps we have defined to build a robotics MOOC using ROS as the base system:

Step 0: setting up the environment

The first step is about deciding which distribution structure we will have for our course. This step is required in order to do the rest of material according to the environment selected. You have to take into account that at the end, the student will have to access your MOOC someway. That access is the distribution structure.

Distribution platforms can be based on Youtube, any of the available MOOC academies, or just your files of the MOOC for download from some personal page.

The whole structure

In this article, we propose you to use a structure based on Jupyter notebooks, because they integrate very well with ROS for practicing. We believe that teaching about robotics must be practice based, and providing videos alone is not the proper way for teaching (even if you can include them as an additional material, more about it below).

Since we are going to use ROS and we want the student to practice, we are going to use robot simulations. Gazebo will be the simulator used here.

Now, having decided that we are going to use Jupyter notebooks+Gazebo simulations, we need to decide the way we are going to pack this and provide it to the student. You have two options for this:

  1. Either you make the students install in their computers the software required to open your content (ROS, Gazebo and any other library you may need for your course) by means of direct installation in their machines, provide a virtual machine or docker.
  2. You use an online platform that already provides the full environment to your students.

Since we want to go fast and want to make easy to the students to access the material, for this course we are going to use the second option. For the online environment, we are going to use the free tier of ROS Development Studio (also known as RDS). Go now and create a free account at rds.theconstructsim.com which we are going to use for the rest of the article.

In case you would like to build a virtual machine or docker, you will have to look for installations instructions over the internet. Even if that is your case, I would ask you to follow the rest of the article now so you can learn the rest of steps which are independent of any installation option selected.

Step 1: decide the subject you are going to teach

You must decide what is the subject of robotics that you want to teach. Remember here that we are talking about how to learn something with ROS based robots from the point of view of programming robots (not about robotics hardware).

As a matter of doing a full example, for the rest of the article, we are going to teach how to make robots autonomously navigate.

Also, you should decide in which programming language you are going to teach the course. We do heavily recommend you do the course in Python language (unless your subject requires explicitly the use of C++) . We do not recommend to use C++ for teaching robotics concepts because your students will have a lot of compilation problems that will slow down the learning of the robotics subject (which is what really matters here).

We decide to do the example of this article in Python.

Screen Shot 2016-10-25 at 18.38.29

Step 2: decide which units our course will cover

We must list the units for each of the subjects to teach and the exercises that we will use in each unit. Additionally we must provide a project that the students must complete during the whole course.

In our case we are going to include the following units:

  1. Odometry based navigation. Basic concepts of robot navigation. Exercise: make the robot move doing a perfect 1m square.
  2. Sensors for robot navigation. Sensors used on navigation. Exercise: make the robot move around selecting the direction that has less obstacles.
  3. SLAM: How to build a map of the environment. Exercise: make the robot build the map of an environment using the ROS navigation stack.
  4. Monte Carlo Localization. Robot localization on a map. Exercise: make the robot localise in the map built on the previous unit.
  5. Rapid Random Trees: Robot path planning. Exercise: make the robot create paths on the map built on the unit 3 while the robot is localised.
  6. Dynamic Window Approach. Obstacle Avoidance. Exercise: make the robot move autonomously using the map, localization and path planning while avoiding new obstacles in its way
  7. Project. Make a robot patrol a zone. For that, the student must create the map, localize the robot, and create a package that sends a sequence of points the robot has to visit, one after another, endlessly.

We are going to create an RDS project for each one of the units. Let’s start with the first unit now:

  • Go now to the RDS and create the project for the first Unit. Just press the button Create New Project.
  • Call the project Unit1_Odometry_Based_Navigation. You can add a description of the project if you want. When done, press Create.
  • You have now created the shell of the Unit.

Step 3: decide which robots to use

Next step would be to decide which robots are we going to use for each of the units. It is convenient to provide different robots to the students to practice with. What we recommend is to use one type of robot per each unit, if possible. This is interesting for the student because he will have as many different points of view as possible of the same concepts.

As indicated, we will use simulations of the robots for demonstration and practice. The selected robots will have to be prepared for the concepts to teach. For example, if you are giving a course about manipulators, you will need to use simulations of robots that have arms and grippers.

For our example of robot navigation, we are going to use wheeled robots that have odometry and laser data. We decided the following robot assignment for each unit:

  • Unit 1 – Turtlebot 3
  • Unit 2 – Husky
  • Unit 3 – Turtlebot 2
  • Unit 4 – Jackal
  • Unit 5 – Summit XL
  • Unit 6 – RB-1
  • Project – Turtlebot 2

Since our course is based on ROS, we are going to use Gazebo simulations for our courses. In order to get the simulations, you could build them yourself, but actually, unless you are doing a very strange subject, you can find many Gazebo simulations of robots on the Internet, ready to be used.

For instance, you can download all The Construct simulations from our public repo, which contains many simulations of different types of robots. The simulations of the repo are guaranteed to work with ROS Indigo and Gazebo 7 (as for January 2018). Our public repo is available here:
https://bitbucket.org/account/user/theconstructcore/projects/PS

Screenshot from 2017-03-01 17:08:01

Now let’s start populating our course with the simulation for the Unit 1 (Turtlebot 3)

For that, let’s open the first unit we created previously on RDS. Then, let’s assign to this Unit 1 the simulation that we are going to use for it. In this case, it is going to be the Turtlebot 3 from Robotis. For the Turtlebot 3 we are going to download the simulation from the official documentation page of Robotis. The steps are the following:

  • Press the Open Project option of the project you just created on the previous step.
  • When the RDS main desktop appears, open a shell (top menu->Tools->Shell) and go to the simulations_ws/src directory (cd simulations_ws/src). You must place your simulations always on that directory.
  • Clone the Turtlebot 3 simulation from the official repo on that directory. For this robot, this step requires to clone three different repos:
  1. git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
  2. git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
  3. git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
  • Now, go to the simulations_ws (cd ..) and compile it with catkin_make.
  • Before we launch the simulation, we need to do a small modification to the launch file. Please, open a webshell (top menu->Tools->Shell). Then  go to the turtlebot3_gazebo/launch directory  (roscd turtlebot3_gazebo/launch), then open the turtlebot3_world.launch file (vi turtlebot3_world.launch). On line number 2 of that file you have to set the actual value of the parameter model. Remove the current content of the default value, and set it to burguer.
  • We can now launch the simulation and see how it looks like. For launching the simulation in RDS, select the Simulations option on the top menu, and then press the Select Launch File option. On the pop up that appears, we need to select the actual launch file that we want to launch. For our example we will use the launch file that we modified on the previous step: turtlebot3_gazebo/turtlebot3_world.launch.
  • By selecting that launch, a new window will appear loading the simulation, which will show the Turtlebot 3 simulation.

Screenshot from 2018-01-16 09:55:48

NOTE: In case you have problems with the instructions to install the simulation, please watch the following video that shows step by step how to do it.

Step 4: create the notebook

Let’s create the notebook that will contain the explanatory text of the unit. That is the text that teaches the student about the unit subject. For the notebook we use the Jupyter notebooks. Jupyter notebooks allow us to embed text with Python, code, images, videos, and results in real time obtained from the simulation.

Write the notebook on RDS

You should now open the Jupyter notebook and start writing your unit content.
For the sake of speed, let’s use a notebook file I have previously created for this course. Let’s use this file as if we had already written the notebook content for the students. You can also use this as a way of learning the type of content you can embed in a notebook.

You can get this file from the link of the webinar where we explained all the details of this post (https://youtu.be/Z8d1TY8gJ3Q). Go to the webinar link, and there, look at the notes of the video, and look for the Notebook example for download link. Please download the file on the link and then let’s do the following steps together to set that file as the notebook of the first Unit.

  • Go to the link of the webinar.
  • Download the zipped iypnb file that contains the notebook of the Unit 1.
  • Go to the RDS and open the IDE  Jupyter notebook in RDS.
  • Select Upload and upload the notebook file.
  • Uncompress it using a webshell. Go to the notebook_ws and type unzip <file_name>.
  • Open the uploaded file from the Jupyter notebook tool of RDS.
  • Now you have the notebook of Unit 1.

NOTE: In this example we have used an already created notebook for the sake of simplicity and demonstration purposes. However, you can create your own notebook inside the RDS starting from scratch  (instead of using  the file provided here). For doing that, you only need to open the Jupyter notebook (top menu->Tools->Jupyter Notebook). On the new window that will appear just press the New button, and then the Python 2 option under the Notebooks option. A new and empty notebook will appear that you can populate. Play with all the options there. You can rename the file and add all the content you want. Remember that all the notebooks that you create there are going to be stored in the notebooks_ws, so they will be shipped with the whole project.

When doing your own material for your course, you can write all the content by yourself. Let me show you some of the things you can do with a notebook, by following the content of the file already provided:

  • In this cell we have the text explaining to the user some of the context

Screenshot from 2018-01-16 10:04:14

  • In this cell we have included a video from Youtube that permits to include dynamic explanations and examples of what we mean, so it is easier to the student to understand the concepts.

Screenshot from 2018-01-16 15:52:53

  • In those cells we have code that can be copied and executed on the Linux shells.

Screenshot from 2018-01-16 10:18:27

  • In this cell we have some code that directly affects the simulation of the robot.

Screenshot from 2018-01-16 10:19:24

Some important points to take into consideration:

  • You can modify the whole notebook at will, or you can create new ones.
  • Your Jupyter notebooks must be stored in the notebook_ws workspace.
  • Your notebooks must contain exercises for the student.

Now let’s save the current status of the whole unit. For that, press the save icon on the top menu. This saves everything from all the workspaces of the project.

Step 5: provide some example code to the students

We may want to provide some code already done to the students, so they have to modify it or use it as an example for their exercises.

In that case, the code must be put in the catkin_ws, and make reference to it in the notebook.
For the Unit 1 of our MOOC, the student has to do an exercise for moving the robot exactly a square of 1 meter. In order to help him a little, we provide a code example with which the robot reads odometry and moves the robot forward.

Let’s add this example code into the project of Unit 1. In order to get that example code, go to the webinar page again and download the tar.gz file containing the code for the student (look for the link which says Example of package with ROS code for the course). Follow the next steps to include the package in the Unit 1.

  • Download the file from the webinar page.
  • Go to the IDE of RDS (top menu->Tools->Code Editor), and select the catkin_ws workspace.  Then, browse the  directories until you open the src directory.
  • Right-click on that directory and select Upload. Then upload the compressed file you downloaded from the webinar.
  • Now the code file is at the RDS inside your project. Use a webshell and visit the catkin_ws/src directory. Once there, uncompress the file with tar xvfzp <name_of_file>. You have now the example code in your catkin_ws and can be used to execute it on the robot. Since it is Python code, you do not need to compile it.
  • To launch that code, type rosrun t3_basics basics.py. The Turtlebot 3 robot should start moving.
  • You can now delete the compressed file you uploaded.

Once you have the code done, go and save everything again. The Save icon will save all your changes made in any of your three workspaces: catkin_ws, simulation_ws or notebook_ws.

At this point in time we have the whole information for the Unit 1 done.

Screenshot from 2017-07-04 12:05:17

Step 6: continue with next unit

Move to the next Unit until you got all of them done. We recommend that you create a project per each Unit, but it is also possible to have all the Units in a single project. The drawback of putting everything together is that the final file will be too large and confusing, since the code, notebooks and simulations provided for each unit will be mixed all around the project. So not recommended at all. Additionally, by separating in projects each Unit, you can share each Unit separately at different times (for example, you do not get Unit 2 until exercise of Unit 1 is sent).

Step 7: share with students

At this point, you should have the whole MOOC built. You can now share the MOOC with your students. In order to share, you have three options:

  • First option, you share the units inside the RDS platform. Sharing inside the RDS is very simple and prevents having to make students install and configure their equipments. That is as easy as having a list of all the participants, and pushing the share button. For sharing, do the following:
    • Got to the page that lists all your RDS projects (world icon on the top menu).
    • Press the Share option on your project.
    • On the dialog that appears, paste the emails of the students and press Share Files.
    • That’s it! Your students will receive the units in their own area in RDS and will be able to open and execute the exact same thing that you did.
  • Second option, download your project from the RDS and put it in a link somewhere (may be at your University server) so anybody with the link can download it. You can download at any point in time your content at RDS. For doing that, just use the IDE to go to the workspace you would like to download, press Right-click and then Download Files. This will download the whole workspace that you can put in a local machine or else to work in the same way as it was working on RDS.
  • Third option, if you want your course to be provided automatically to the whole world (with no work from your side), you can send us your packages to courses@robotingiteacademy.com and we will publish it at our academy (the Robot Ignite Academy). If your course is included in our catalogue of courses, you will receive a payment based on the use of your course.

Screenshot from 2017-11-09 19:35:45

Done!

Did you got the instructions clear? Did it work for you? In case you had some trouble with the written instructions, we have created a webinar explaining all those steps. You can watch how the steps are performed by following the video of the webinar, below.

Conclusion

Traditionally, MOOC courses have been based on video tutorials where a person explains the subject, and the student… does what it can to understand. Here we propose a more dynamic and interesting way of creating your MOOC by building interactive elements.

As you can see, working with ROS, Gazebo and Python notebooks is a powerful and fast way of creating an engaging MOOC for the students. All the tools explained here are free, so there is no excuse to not start creating your MOOC right now.

Additionally, if you are still interested on the video path, you can record yourself while explaining through the notebook and simulations. That is the way we have done at Robot Ignite Academy for more than a year already, with a huge success, because the teacher supports his explanation with the notebook, and the students engage in the explanation with the practice while listening the teacher.

As an example, in the video above you can see how I’m teaching Robot Navigation at LaSalle University using Robot Ignite Academy. Every student is practicing at the same time I explain the lesson to them. Additionally, they can do that from any place, with any computer. As you can see on the video, we brought the whole class to the cafeteria where our Barista robot is serving coffees, and they were able to keep practising, programming and testing prior to send their programs to the real robot.

Let us know your thoughts on the comments below!

Topics:
Masterclass 2023 batch2 blog banner

Check Out These Related Posts

129. ros2ai

129. ros2ai

I would like to dedicate this episode to all the ROS Developers who believe that ChatGPT or...

read more

0 Comments

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