HW 1
HW 1
HW 1
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 https://gist.github.com/, 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).
1
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
4t
2t
xd (t) = 3 sin
yd (t) = 3 sin
t [0, T ].
T
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.