Homework 1 - Robot Operating System (ROS)

Due at 11:59 pm on Wednesday 1 September 2021

As discussed in class, we will be using the Robot Operating System (ROS) in the course this semester. ROS has numerous features to aid users in the development of their robot software. However, these features take some time to learn. The point of this homework is to take you through some tutorial exercises to help you learn some of the basic features of ROS. Note, however, that you will not be programming any robots in this homework.

Computer Resources Note

Note that you may use CSN computers to complete this assignment or you may use your own computer. If you choose to use your own computer, you will need to install ROS Melodic (following the ROS Melodic Installation Instructions) before completing these exercises.

The CSN computers that are available to run ROS are the six "GPEL" computers in DEH 115 and the ten dedicated robotics lab computers that will hopefully be in REPF B4 soon. (GPEL is an anachronistic acronym that stands for "General Purpose Engineering Lab" and hearkens back to the days when the School of Computer Science was housed in the Engineering Lab building. These are the only Linux computers in DEH 115. The other computers in that lab are Windows and Mac machines that will not work for this lab.)

WARNING

It is very possible to mechanically and unthinkingly work your way through these tutorials without actually learning anything. If you do this, you will be able to get the points for Homework 1 and Homework 2, but you will be lost when it comes time for you to apply the knowledge you were supposed to have gained doing these homeworks to Project 1, Project 2, and your Major Project. Because these two homeworks are collectively worth 4% or 2% of your course grade (depending on whether you are in 4023 or 5023, respectively), whereas the assignments that build on these homeworks are worth 70% or 60% of your course grade (depending, respectively), it behooves you to pay careful attention while completing these homeworks and actively attempt to learn the concepts presented in them, so that you'll be able to get both the few short-term points for the homeworks themselves and the very substantial number of longer-term points that rely on the knowledge you gain from these homeworks.

ALERTS
  1. Note that many of the instructions in the tutorials refer to ROS Kinetic whereas we are using ROS Melodic. Please be sure to substitute "melodic" for "kinetic" as you follow the instructions in the tutorials.
  2. Note that there are differences between using Python 2 and Python 3 when setting up and using catkin_make. Please be sure that you know the default version of Python in use on your system. (The desktops in DEH 115 apparently have Python 2.7 as their defaults, for example.) If you have further questions about this issue, please contact the teaching assistant.

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 (e.g., the modified run commands file will be answer 1.1, the return value of echo $ROS_PACKAGE_PATH would be answer 3.1). Note that not all exercises will result in answers being added to your completed assignment.

  1. Set up your environment such that the correct ROS run commands are sourced in your run commands (.*rc) file by your shell on startup. If you are using bash under Ubuntu, with a standard install, you may follow the directions in Step 1.5 of the ROS Melodic installation instructions for Ubuntu directly. Otherwise, you will need to adapt these instructions slightly. Note that if you are using the CSN computers, you only need to follow Step 1.5. The other steps (which include "sudo") have already been taken care of by our CSN systems administrator.
    1. Add your modified run commands file to your completed assignment.
  2. Work through the tutorial on installing and configuring your ROS environment following the option for catkin.
    1. Add the output of export | grep ROS to your completed assignment.
    2. Add the output of catkin_make to your completed assignment.
  3. Work through the tutorial on navigating the ROS file system following the option for catkin but possibly skipping Prerequisite step 1, as this has already been completed on the CSN machines. (Note that on all remaining tutorials for which there are options for catkin or rosbuild, you should follow the catkin option.)
    1. Add the output of echo $ROS_PACKAGE_PATH to your completed assignment.
  4. Work through the tutorial on creating a ROS package. (Note that when you enter rospack depends1 beginner_tutorials you may get the following error message: [rospack] Error: the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'. If you get this message on the CSN machines, check to see if the file /etc/ros/rosdep/sources.list.d/20-default.list exists. If so, you do not have to carry out sudo rosdep init but you do have to carry out rosdep update. If /etc/ros/rosdep/sources.list.d/20-default.list does not exist on the machine you are using, then ROS has not been properly installed on that machine—please contact me and let me know the name of the machine you were using so that ROS can be properly installed on it.)
    1. Add your customized final package.xml file to your completed assignment.
  5. Work through the tutorial of building a ROS package.
    1. Add the output of catkin_make to your completed assignment.
  6. Work through the tutorial on understanding ROS nodes. (On the CSN Linux boxes you may skip Step 1.1 Prerequisites because the simulator has already been installed.)
    1. Do a screen capture of the window that appears when you enter rosrun turtlesim turtlesim_node and add this to your completed assignment.
    2. Add the output of rosnode list (after renaming) to your completed assignment.
  7. Work through the tutorial on understanding ROS topics. (Again, on the CSN Linux boxes you may skip the installation steps as rqt_graph has already been installed.)
    1. Do a screen capture of the window that appears when you enter rqt_graph in Step 1.2.1 and add this to your completed assignment.
    2. Do a screen capture of the rqt_plot window after you select to plot /turtle1/pose/x and /turtle1/pose/y and add this to your completed assignment.
  8. Work through the tutorial on understanding ROS services and parameters.
    1. Do a screen capture of the TurtleSim window when you enter rosparam set background_r 150 and rosservice call clear and add this to your completed assignment.
  9. Work through the tutorial on using rqt_console and roslaunch.
    1. Do a screen capture of your rqt_console window when you enter rosrun turtlesim turtlesim_node and add this to your completed assignment.
    2. Do a screen capture of your rqt_logger_level window when you enter rosrun turtlesim turtlesim_node and add this to your completed assignment.
    3. Do a screen capture of your rqt_graph window when you enter roslaunch beginner_tutorials turtlemimic.launch and rostopic pub /turtlesim1/turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]' and add this to your completed assignment.
  10. Work through the tutorial on using rosed.
  11. Work through the tutorial on creating a ROS msg and srv.
  12. Work through the tutorial on writing a simple publisher and subscriber in C++.
  13. Work through the tutorial on examining the simple publisher and subscriber.
  14. Work through the tutorial on writing a service and client node in C++.
  15. Work through the tutorial on examining the simple service and client.
    1. Add the output of rosrun beginner_tutorials add_two_ints_client 1 3 to your completed assignment.
  16. Work through the tutorial on recording and playing back data.
    1. Add the contents of the bagfile created with rosbag record -O subset /turtle1/command_velocity /turtle1/pose to your completed assignment.
  17. Work through the tutorial on troubleshooting with roswtf.
    1. Add the output of roscd and roswtf in Step 1.2 to your completed assignment.
  18. Work through the tutorial on navigating the wiki.

What to Submit

Turn in an electronic copy of this assignment via Canvas.