18-642 Project 1

Page last updated 8/27/19 9:00 pm (changelog)

This project is meant to be an introduction to the ROS (Robot Operating System) interface. You are not expected to become a ROS expert at the end of the course, but you are expected to know how to navigate a ROS workstation and project file structure, build ROS projects, and use ROS messages. The subsequent projects in the course will be based on ROS.

Lab Files:

Hints/Helpful Links:


Part 1: Getting started with ROS

  1. Download the 18-642 VirtualBox image. It runs Ubuntu 16.04 with ROS Kinetic and the ROS Tutorials package installed.
    1. VirtualBox is installed on the lab machines in Hamerschlag 1303, or you can download and install it for free from their website.
    2. Import the VM into VirtualBox by navigating to File -> Import Appliance, navigating to the 18642-ros.ova file you downloaded, pressing next, and pressing import.
    3. Make sure you can log out and log in with the username student and password 18642.
    4. To enable networking on the VM, Navigate to the Devices menu (at the top of the window), and under "Network," make sure "Connect Network Adapter" is checked.
    5. The VM Changelog page includes some hints on optimizing the VM to get it to run faster.
    6. Note: If you do not wish to use the VM, you can run and install ROS natively following the ROS tutorials. Files you need to complete part 2 of the project are linked at the top of the page. We'll provide very limited support to get ROS running if you choose to go this route.
  2. Follow the ROS Nodes tutorial starting from Step 2.
  3. Follow all steps of the Ros Topics tutorial. RQT (beginning of step 2.1) is already installed for you.
    1. In Step 1.3, draw a picture with the turtle. Take a screenshot of your picture. Anything non-trivial (beyond one convex polygon) is acceptable. Call it turtlepic_[AndrewID]_[Family Name]_[First Name].png.
    2. Notes:
      • You might need to un-check the "namespaces" box to make the picture look the same as in the tutorial. This should not matter substantively in terms of getting the tutorial completed.
      • Follow the instructions for "ROS Hydro" and not "ROS Groovy". You are using a ROS distro after Hydro, but the Hydro instructions should work.
  4. Read the ROS Services and params and Create Msg and Srv tutorials. The file modification steps have already been done for you, but this information is useful for understanding ROS.
  5. Follow the ROS Publisher and Subscriber Tutorial, steps 1 and 2. Build your code by typing catkin_make talker listener in the /home/student/catkin_ws directory.
  6. Follow the ROS tutorial to examine your publisher and subscriber.

Part 2: Write your own publisher

  1. Use what you learned in the above tutorials to write your own publisher for the turtle:
    1. The file /home/student/catkin_ws/src/proj1/src/turtle_publisher_18642.cpp has code for you to get started. The code can be built and run as-is. Read the comments thoroughly and be sure you can run it (Step 3 below) before editing the file.
    2. You must use the /turtle1/cmd_vel topic in your code.
    3. Your code shall draw a figure-eight using the turtlebot. A figure-eight consists of two full circles*, tangent to each other. It is drawn by commanding the turtle at constant, non-zero linear and angular velocities until one full circle is drawn, and then negating the angular velocity until another full circle is drawn.
  2. Build your package by typing catkin_make turtle_publisher_18642 in the /home/student/catkin_ws directory.
  3. Execute your code:
    1. In one terminal, type roscore.
    2. In a second terminal, type rosrun turtlesim turtlesim_node to bring up the turtlesim window.
    3. In a third terminal type rosrun proj1 turtle_publisher_18642 to execute your code.
  4. Write a function (i.e., a subscriber) to print the Turtle's pose (that means: x position, y position, linear velocity, angular velocity as a tuple) to the terminal. The code skeleton gives some hints. (Note: if the code skeleton says "extra credit" ignore that -- this is now required because we've found it helps students in later projects to do this.) Call this function every time you move the turtle. Getting this working might take some looking at code, some web research, etc. Getting more comfortable solving problems this way is one of the course objectives. Be sure to use /turtle1/pose
  5. Take a screenshot of your figure eight and at least a few lines of the printed out pose. This will be a single screenshot that shows two different windows: one a graphical window showing the approximate figure 8 track of your turtle, and one a text window displaying the last handful of pose printout lines. Call it fig8_[AndrewID]_[Family name]_[First name].png

*If you're worried that your turtle is only drawing an approximation of a perfect circle on the screen, we understand. For these purposes, a "circle" is defined as an entity drawn by commanding the turtle at a constant, nonzero linear and angular velocity.

Handin checklist:

  1. Screenshot of your turtle picture from Part 1, step 3.a: turtlepic_[AndrewID]_[Family name]_[First name].png.
  2. Screenshot of your figure eight and pose printout windows from Part 2, step 4: fig8_[AndrewID]_[Family name]_[First name].png.
  3. Your turtle_publisher_18642.cpp file, renamed: turpub_[AndrewID]_[Family name]_[First name].cpp.

Zip these three files and turn them in on Canvas as Project01_[Andrew ID]_[Family name]_[First name].zip

The rubric for the project is found here.


Note: in a previous year a student said for 1f "In a third terminal" step 2 command should be: cd ~/catkin_ws/ && source devel/setup.bash && rosrun ece642rtle ece642rtle_student" Please let us know if you encounter this issue so we can sort it out.