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.
Virtualbox image (Updated 8/19/18 4:00pm.
Caution -- this is a big file. Mind your download bandwidth quota if you are
off campus! (We recommend you DIS-connect from CMU VPN to make this transfer.
It is a publicly available Internet file.)
- VirtualBox software
standalone for Part 2. (This file already loaded onto the VM, so downloading is
optional.) Updated 8/19/18 4:00pm.
- Look for the Project 1 hand-in assignment on Canvas. That's where you hand
in the project materials.
- Please follow the handin naming convention: every filename (before the
file extension) must end in [AndrewID]_[Family Name]_[First Name].
- Access the ROS tutorials here: ROS Tutorials.
- Before attempting `roscd beginner_tutorials`, first run `source
~/catkin_ws/devel/setup.bash`. This only needs to be done once. This file is
generated by running 'catkin_make' under 'catkin_ws' according to the
- If ROS isn't finding some packages, type source
- Be sure to start the roscore command before using rosrun.
- Be sure to run catkin_make in the /home/student/catkin_ws
- Some students have had problems with full screen mode overflowing their
monitor. Try checking View ->Auto-resize Guest Display
- Some students have better luck with VMWare compared to VirtualBox. It is OK
to use either one. (VMWare requires a license, but CMU has a site license.)
Part 1: Getting started with ROS
- Download the 18-642
image. It runs Ubuntu 16.04 with ROS Kinetic and the ROS Tutorials package
- VirtualBox is installed on the lab machines in Hamerschlag 1303, or you
can download and install it for free from their
- 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.
- Make sure you can log out and log in with the username student and
- 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.
Changelog page includes some hints on optimizing the VM to get it to run
- 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.
- Follow the ROS Nodes
tutorial starting from Step 2.
- Follow all steps of the
tutorial. RQT (beginning of step 2.1) is already installed for you.
- 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.
- 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.
- Read the ROS
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.
- Follow the ROS
and Subscriber Tutorial, steps 1 and 2. Build your code by typing
catkin_make talker listener in the /home/student/catkin_ws
- Note: Tutorial 1.0: The instructions say to call `roscd
beginner_tutorials`. You might a message that says no package available. If
that happens, try this: `cd ~/catkin_ws/src/beginner_tutorials`
- Note: Tutorial 3.0: The modifications to CMAkeLists.txt are already
included in the VM.
- Follow the ROS tutorial to
your publisher and subscriber.
Part 2: Write your own publisher
- Use what you learned in the above tutorials to write your own publisher
for the turtle:
- The file
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
- You must use the /turtle1/cmd_vel topic in your code.
- 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.
- Build your package by typing catkin_make turtle_publisher_18642
in the /home/student/catkin_ws directory.
- Execute your code:
- In one terminal, type roscore.
- In a second terminal, type rosrun turtlesim turtlesim_node to
bring up the turtlesim window.
- In a third terminal type rosrun proj1 turtle_publisher_18642 to
execute your code.
- 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
- 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.
- Screenshot of your turtle picture from Part 1, step 3.a:
turtlepic_[AndrewID]_[Family name]_[First name].png.
- Screenshot of your figure eight and pose printout windows from Part 2,
step 4: fig8_[AndrewID]_[Family name]_[First name].png.
- 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.
- If you have trouble getting ROS set up, use remote login to one of the ECE
educational machines (or visit a cluster in person). Complete the homework on
those machines, then come to office hours to ask a TA about help getting things
set up on your machine.
- Some students have reported a problem with the publisher/subscriber
tutorial. This was resolved by logging out of the VM image and then logging
- If you get an error regarding "Vt-x/AMD-V hardware acceleration is not
available" see this posting:
- Some of you might be running into make errors while even after getting the
build done correctly the first time. If yes, delete the 'build/' and 'devel/'
directories from the 'catkin_ws/' directory and run make (listener or
turtle_publisher_18642) twice. This should help you in building the code.
- The ECE servers have been changing how they deal with URLs. If you have
trouble accessing web resources try the following. Let us know if something
weird happens and we'll look into it, but hopefully these hints will get you up
- Try manually changing the URL host to both "www.ece.cmu.edu" and
"www.archive.ece.cmu.edu" in the browser URL field if you get a
"not found" or similar error.
- Try accessing via CMU VPN. With that VPN
try "General Use Campus" first, but if that doesn't work try
the"Library Resources VPN" option.
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.
- 8/23/2019 5:00pm: Page published
- 8/26/2019 8:00pm: Added hint about logging out and then back in to VM
- 8/27/2019 9:00pm: Added a hint about VT-x/AMD-V error message