Page tree
Skip to end of metadata
Go to start of metadata

References and Prerequisites

  • Linux
  • ROS Tutorials
    • Work through the ROS Tutorials: Beginner Level 1-6
      • Note - ROS is installed in the CAVR computers, so you will not need to install ROS if working on the lab computers.  If you are setting up ROS on your own computer, come see me.
      • Note - The tutorials have some variations depending on which distribution of ROS and build environment being used. 
        • Will are using the Indigo Igloo distribution.
        • We will be using the catkin build environment.  The rosbuild environment is on its way out.
      • Note: In the first tutorial on Configuring Your ROS Environment you are asked to run the commands

        source /opt/ros/indigo/setup.bash
        source ~/catkin_ws/devel/setup.bash
        To avoid needing run these commands each time you start a new terminal, you can edit your .bashrc file (gedit ~/.bashrc) and add these two commands at the end of the file.  Now these two command will be executed each time you open a new terminal.  

Git Repository 

This assignment will be submitted as a git repository on the NPS gitlab server.  Create a new repository named "mrc_hw2" using the server's web interface at

When you create repository us on your local machine, do so in your catkin workspace (~/catkin_ws/src).   You can do this by first

cd ~/catkin_ws/src

Then following the directions from the gitlab site which start with...

mkdir mrc_hw2
cd mrc_hw2 
git init 

Exercise 1: Make a Package in Your Git Repository

In this exercise you will create a ROS package in your catkin workspace following the tutorials.  Execute these commands...

cd ~/catkin_ws/src
catkin_create_pkg mrc_hw2 std_msgs
  • What are the two files that are created by this command?

Add those two files to your git repository, commit the changes and push to the origin.

Make the package using the command "catkin_make".

Use rospack to examine the dependencies.  Report the list of dependencies (both first order and indirect).

Record your answers by creating a text file in your mrc_hw2 repository called "ex1.txt".  This file should be at the path ~/catkin_ws/src/mrc_hw2/ex1.txt.  Add the ex1.txt file to the repository; commit and push.

Exercise 2: Using rospack 

Use the following to get help on the rospack command...

rospack help

We can get a list of all the installed packages like this...

rospack list

This should generate a lot of output - there are many packages installed!

We can use a pipeline to connect the output of our command to a program called 'grep' that will search through it...

rospack list | grep PATTERN

where PATTERN is what we are looking for?

What are the names of the installed package that include the word "smach"

Put your answer in a text file called "ex2.txt" withing your mrc_hw2 repository.  Add the file to the repos., commit and push.

Exercise 3: Driving a Turtle

 As an extension to the ROS Tutorial Understanding ROS Topics, write a shell script to control (open-loop) a turtle. 

Make a new directory called "scripts" in your git repository.  Add a new file called "" in the "scripts" directory.  (The location of this file should be ~/catkin_ws/src/mrc_hw2/scripts/ This file is your shell script. If your file looks like this...

rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[4.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]'
rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[5.0, 0.0, 0.0]' '[0.0, 0.0, -4.5]'

You can then execute the script (which just calls each commend sequentially) like this...


If I have my turtle running I should see something like this...

Modify the script to control your turtle to draw the first letter of your name.  

Submit your solution by making sure is part of your repository and commit, push.

  • No labels