Sie sind auf Seite 1von 3

ME495: Embedded Systems in Robotics

Homework 1
Electronic submissions due on Canvas before Friday, October 17 at 11:59 PM
In this homework, you will be exploring many of the ROS concepts that we have covered in class. As
online documentation is a big part of this class (and open-source software in general) you will be expected to
present your solutions to this homework in a way that is thoroughly documented, nicely formatted, and easy
to follow. This does not mean your document needs to be extremely long. Failing to meet these requirements
will impact your grade.
I am giving you two options to turn in this assignment. They are as follows:
1. Via a GitHub Gist (preferred):
If you navigate to, you will be given an interface for creating a new Gist.
A Gist is a GitHub-specific Git concept that allows you to create a simple, temporary git repository.
If you create a file with an .md extension (Id call this file something like ME495: Homework 1 as the
first file created automatically sets the Gist title), then the file should be written in Markdown and it
will automatically be converted into html by GitHub. As an example of this, I posted this file earlier
this year (note you can either clone the repo, or click Raw to view the file before it was converted to
html). This is the preferred route because it will give you good Git practice, and it is how we will
be documenting projects later this year. Here are a couple of useful sites/resources/notes to get you
started on this route:
Rules for GitHub Flavored Markdown
General Markdown syntax and information
There are great Chrome and Firefox extensions for doing Markdown processing and previews.
In Chrome I use MarkView and Markdown Preview Plus, and in Firefox Ive heard good things
about Markdown Viewer.
Gists do not allow subdirectories, so if you need to link to code that is in a Git repo, either just
use external links to a repo on your personal page (GitHub will even let you link to particular lines
or chunks of a file), just include the relevant files in the Gist, or pull the relevant code snippets
out of the files and just include them in fenced code blocks inside your Markdown file.
With Markdown it is trivial to include images, but when you view a Gist on GitHub directly, it
doesnt actually embed the image into the html like normal Markdown would. Thats fine, Ill be
cloning your Gists, and looking at them locally.
Id say the best workflow is to create a Gist, then clone it to your computer. Work in your cloned
repository using a Markdown previewer, and then push changes to the Gist periodically.
Do not post your markdown files on a publicly accessible GitHub repo. Put them on
a secret Gist, and only give me the link. Later on we will be making everything we do public,
but for this type of HW assignment, I dont want your answers publicly available yet. If I find
your Markdown file on your public repository, you will get no better than half-credit on this
assignment. It is okay to have code for this HW available on public repositories, but not your
Markdown file that answers all of the questions.
2. Upload a pdf and zip file to Canvas:
I realized the above option may sound like a lot. So for this homework, I will allow you to upload a
single pdf containing your answers, and a single zip file containing any code and/or data files. Be sure
that the pdf clearly describes all contents of the zip file (especially which files in your zip file are for
which questions).

ROS Command Line Tools and Package Analysis

For this section you will clone a package that I have written in C++, and then it will be up to you to
use a combination of ROS command line tools, code you write, and analysis of the (intentionally) poorly
documented code to answer the questions below. Note that the command line tools should be sufficient
to answer all questions and they provide the easiest path to solutions. The package contains only a single
node, ros cl demo, that can be started with rosrun. Note that the package will have to be compiled with
catkin make to build the executable, and the custom messages. The source repository is located here:
1. The single node contains one publisher and one subscriber.
(a) What are the names of the corresponding topics?
(b) Describe the message definition for each of the topics.
(c) What packages define the messages?
(d) What frequency (approximately) does the publisher publish data at?
(e) Use rqt plot to plot the data being published, what is the data?
(f) Publish a message on the subscribers topic to trigger a callback in the node. What happens in
the terminal where the node is running?
2. The node also contains a single service provider.
(a) What is the name of the service?
(b) Describe the definition of the service request and response.
(c) What does this service do?

Getting Started with GitHub

In this section, you will basically just follow several GitHub tutorials. There is no need to write anything
about this section. You will instead receive credit for this section during the next section when you are
forced to use GitHub. If you get stuck on the next section, at least provide me with your GitHub username
so I can verify you completed this section.
3. Follow the GitHub tutorial on setting up Git:
At the end of the tutorial, they mention that they recommend authenticating with HTTPS. I personally
have had much better luck with SSH authentication as Ive never really gotten the credential helpers
working reliably (especially with two-step authentication on). So when I use HTTPS, I end up having
to type in my password a lot. Its worth at least setting up SSH so that you have the option.
4. Follow the GitHub tutorial on setting up your SSH keys:
5. Follow the GitHub tutorial on creating a new GitHub repo:

Working with the turtlesim package

In this section, you will work with the turtlesim package, a simple package used for teaching basic ROS
concepts. Your goal is to create a ROS package containing a node that controls the turtlesim to follow a
reference trajectory. All code in this problem should be written in Python.
6. Create a ROS package using catkin create pkg. As you answer the rest of the questions be sure to
keep your package.xml and CMakeLists.txt files up-to-date with the packages you depend on.

7. Initialize a Git repository that tracks all relevant files for your package. As you complete the rest of
this section, try to commit as you go.
8. Write the node that makes the turtle follow the reference.
The reference trajectory that you are trying to get the turtle to follow is given by

xd (t) = 3 sin
yd (t) = 3 sin
t [0, T ].
This is a vertically-oriented figure 8 centered at the origin. The turtle should complete one traversal
of the reference in T seconds. Dont worry if your figure 8 isnt oriented perfectly. Here are a few hints:
You will likely want to call the turtle1/teleport absolute service to get the turtle located and
oriented correctly for the t = 0 case.
The turtle essentially follows the standard kinematic-car model (sometimes called the unicycle
model). Which means only two of the values in the cmd vel topic are actually used when
integrating the turtles kinematics.
The turtle is whats called a differentially flat system. For our purposes, this means that given
the reference above, we can analytically calculate the translational and rotational velocities to
command the turtle with to exactly follow the reference.
9. Make your node accept a private parameter that can be used to override the default value for T (the
user can then specify at runtime how fast the turtle should go).
10. Use rosbag to record enough messages on the /turtle1/cmd vel topic to have the turtle complete
one circuit of the reference. Note that the -l option to rosbag can be used to control how many
messages are recorded. You can then use rosbag to play back your recorded messages to control the
turtle without ever starting up your node. Be sure to include a copy your bag file in whatever
you turn in.
11. Create a new repository on GitHub and push your changes. Be sure I know how to find your repo.