Homework 2 - More Robot Operating System (ROS)

Due at 11:59 pm on Friday 10 Monday 13 September 2021

As discussed in class, we will be using the Robot Operating System (ROS) in conjunction with TurtleBots in the course this semester. The point of this homework is to take you through some tutorial exercises to help you learn some of the basic features of ROS and TurtleBots. Note that, as with Homework 1, you will not be programming any robots in this homework. However, you will get to drive them around in simulation a bit!

Computer Resources Note

See the computer resources note from Homework 1. Note that you will also need Gazebo 9.x for this assignment.

The Assignment

Work through the ROS tutorials, completing the following exercises as you go. As you complete these exercises and add items to your completed assignment, number them to correspond to the numbering below as you did with Homework 1. Note that not all exercises will result in answers being added to your completed assignment.

  1. Before starting the tutorials, follow the instructions for setting up your system. This setup is necessary because ROS Melodic does not come configured for TurtleBot 2 robots by default. (This is necessary whether using the departmental computers or your own system.)

  2. Work through the tutorial on bringing up a TurtleBot in Gazebo.

    Note that this tutorial was written for ROS Indigo and has not been updated for later ROS versions. However, it appears to still be valid for ROS Melodic, except that references to Indigo should be replaced with references to Melodic.

    Also note that, if you are using the CSN machines, you should not need to install anything beyond the setup from Step 1, above (you do not need to execute "sudo apt-get install ros-melodic-turtlebot-simulator"). Also, if you properly modified your .*rc file while completing Homework 1, you won’t need to source the setup file (you won’t need to execute "source /opt/ros/melodic/setup.bash"), you’ll just need to launch gazebo with a simulated TurtleBot ("roslaunch turtlebot_gazebo turtlebot_world.launch").

    1. When the Gazebo window appears, zoom in on the robot and orient the view of it in such a way that the words on the robot are right-side up and easily legible. Do a screen capture of the Gazebo window at this point and add this to your completed assignment.
    2. Start rqt_graph. Do a screen capture of the rqt_graph window and add this to your completed assignment.
    3. Describe what Gazebo is in a sentence or two and add this to your assignment. Note that this tutorial does not describe Gazebo. You may need to search elsewhere for this information. Be sure that this description is in your own words. Do not simply copy and paste a description from elsewhere.
    4. Leave Gazebo and rqt_graph running and go on to the next tutorial.

  3. Work through the tutorial on exploring the Gazebo world. (Again, note that you should not need to install software on the CSN machines.)
    1. Explain two differences between controlling the TurtleBot using turtlebot_teleop and kobuki_keyop from the perspective of the person doing the teleoperation.
    2. Do a screen capture of rqt_graph with each teleop program running and add these to your completed assignment. Explain a difference between these two teleop programs from the perspective of interprocess communication.
    3. Note that since you loaded the "TurtleBot world" in the previous tutorial, you won't need to add objects to the world as described in section 5 of this tutorial. Instead, you should already have several objects in the world. Describe these objects and add that description to your completed assignment.
    4. Position the robot to face the cylinder and move toward the cylinder until the curve of the laser on the front of the cylinder is clearly visible in RViz. Do a screen capture of RViz at this point and add this to your completed assignment.
    5. Return to RViz and turn on Image display. Adjust the image controls until a camera image of the cylinder appears in RViz. Do a screen capture of RViz at this point and add this to your completed assignment and explain what you had to adjust in the RViz controls to obtain a camera image in RViz.
    6. Adjust the RViz display controls and move the robot until you obtain a picture of the “rainbow book,” similar to the one shown here.
      Image of RViz showing particular
        sensor readings
      Capture your own similar image and add this to your completed assignment. Explain:
      1. what controls you needed to adjust in RViz to obtain your rainbow book picture,
      2. what movements you needed to have your simulated TurtleBot execute to obtain your rainbow book picture, and
      3. what causes the sensor readings to produce each part of the rainbow book image.

  4. Work through the tutorial on building a map in the TurtleBot simulator.

    Note that when you try to launch the TurtleBot playground world, many of the models may fail to load. If any model fails to load, download and install it manually by doing the following:

    wget http://gazebosim.org/models/<model_name>/model.tar.gz (where <model_name> is the actual name of the missing model.
    tar xvf model.tar.gz -C ~/.gazebo/models
    rm model.tar.gz
    For example, if the dumpster model fails to load, do this:
    wget http://gazebosim.org/models/dumpster/model.tar.gz
    tar xvf model.tar.gz -C ~/.gazebo/models
    rm model.tar.gz

    As you work through the tutorial, don't customize the simulated TurtleBot—just use it as it is in the launch file.
    1. When the Gazebo window appears, position it such that you have a good view of the robot and all of the obstacles in the environment, then do a screen capture of it and include this in your completed assignment.
    2. When the RViz window appears, position it such that you have a good view of the robot at about the same scale as the robot in the Gazebo window, then take a screen capture of the RViz window and include that in your completed assignment.
    3. Drive the robot around using the keyboard to construct the best map that you can of the environment. Make sure to drive on all sides of all objects in the environment. Then take another screen capture of the RViz window to show the map and include that map in your completed assignment.
    4. In your completed assignment, label the screen-captured map from RViz to show the space that is occupied (occluded), empty (free), and unknown. Also label each obstacle with its type.
    5. Be sure to save the map you have created in a form that ROS can use (using rosrun map_server map_saver -f <your map name> as instructed in the tutorial). Note that you will include the saved map files (.pgm and .yaml) in your electronic submission in Canvas. Then close out all of your running ROS/Gazebo processes and move on to the next tutorial.

  5. Work through the tutorial on autonomously navigating a known map with a TurtleBot. However, note that you will be using a simulated TurtleBot for this assignment. So, rather than bringing up the TurtleBot, you will run Gazebo as with the previous tutorial.
    1. When the RViz window appears, position it such that you have a good view of the robot and the map, similar to screen-captured map you have already included in your completed assignment for Part 3, above. Take a new screen capture of the loaded map from RViz and include it in your completed assignment.
    2. Explain the various colors that surround the obstacles in the loaded map in RViz.
    3. Explain the cluster of green arrows around the robot in RViz.
    4. Tell the robot its current (starting) position (location and orientation), following the instructions for how to do so in the tutorial.
    5. Give the robot a goal position, following the the instructions for how to do so in the tutorial. This position should be within the map you created for the robot but not inside (or extremely close to) one of the obstacles.
    6. Take a screen capture of the robot at the goal location and include this in your completed assignment.
    7. Give the robot another goal position. This position should be in the unknown space on your map, outside of the free space. Take a screen capture of the robot after it executes this command and explain whether the robot was able to reach this goal.
    8. Give the robot a third goal position. This position should be inside one of the mapped obstacles. Take a screen capture of the robot after it executes this command and explain whether the robot was able to reach this goal.

What to turn in.

Turn in an electronic copy of this assignment via Canvas.