Homework Guidelines: ME495 Embedded Systems in Robotics
Guidelines
This document describes expectations for homework submissions. You should aim for a professional level of code in all of your homework assignments, which means providing documentation, using git properly, and providing tests where appropriate.
Git
- Create a git repository using the link provided under the homework assignment in Canvas.
- Your homework will be graded based on what is in the
main
branch when I clone the repository at some point after the deadline.- I recommend working on a separate branch and merging into
main
when you are ready to submit
- I recommend working on a separate branch and merging into
- You should have multiple commits with meaningful commit messages.
- There is no exact number of commits you need, it is more about the appropriateness of each commit.
- Each commit should capture a single "thought" that you coded and tried
- Bugs will be easier to fix if you make small changes and test them frequently
- Committing often frees you to experiment while knowing you can always revert the code.
- Maintain a
.gitignore
file to prevent improperly tracked files.- There should be no backup files your text editor created (such as
file.py~
or.#file
or.vscode
). - There should be no python bytecode files (
file.pyc
) committed. - There should be no files that are generated form source code that you wrote.
- There should be no backup files your text editor created (such as
- The parent directory of your repository should be
ws/src/${pkg}
.- There should be no files from outside the
src/
space. src/CMakeLists.txt
should not be in the repository (or in the.gitignore
since this file is one level above where your repository should be).
- There should be no files from outside the
- Refer to the Git Book and Git Intro for more information on how to use
git
README
- Your
README.md
should be formatted using markdown: see this guide.- Be sure to format any code using the appropriate code formatting
- Some text editors like
atom
orvscode
will preview markdown for you locally. - You can also use tools like
markdown
orpandoc
to generate.html
from.md
files.
- Your
README.md
should contain the following:- Title
- Your Name
- Brief overview (1-2 sentences) describing what the package does
- Usage instructions. What do I need to do to run the code, assuming the user already understands ROS?
- Generally, this consists of the
roslaunch
command to run and an explanation of its important arguments
- Generally, this consists of the
- Configuration instructions:
- What options are available to change the behavior of the program and how are they used?
Documentation
- Each node that you write should start with a python docstring describing its ROS API:
- What topics are published, their type, and what they do.
- What topics are subscribed to, their type, and what the data is used for.
- What services are offered, their type, and what they do
- What parameters are used, their type, and what they do.
- See https://github.com/m-elwin/crazy_turtle for a basic template.
Coding Guidelines
- Strive to follow the PEP8 Style guidelines.
- Every class and function you write should have an associated docstring.
- A brief description of what the class or function does
- What the arguments are
- What the return value is
- What exceptions may be raised
- See the Google Python Style Guide (specifically the section on docstrings) for how to format.
- This format is also described in the Sphinx documentation,
- Other formats that can be understood by Sphinx are also permissible including NumPy style docstrings or the default reStructured text.
- Errors and Warnings should be heeded and fixed
- Your packages should not have any
catkin_lint
errors or warnings
- Your packages should not have any
- In general, refer to
ROS
entities using relative names from within your nodes. - Do not leave debugging statements in code to spew data onto the screen. If the statements may be long-term useful, use `rospy.logdebug`
Asking For Help
- Try to narrow down the problem to a self-contained example
- This is especially important when asking for help on internet forums
- Don't send screenshots for non-graphical items
- The person helping you can't easily copy and paste text from an image!
- For small code snippets, include code inline, formatted as code
- For larger code snippets, provide a link to your github or attach a file
- Use the Discussion Forums in Canvas
Tips
- Read the class notes
- Read the whole assignment prior to starting
- Read the documentation on the ROS wiki
- Read every error message.
- Draw a diagram of what nodes you expect to run and how they are connected prior to coding
- Work on a separate branch from main. But keep main up-to-date with working code, as submissions can be constantly updated and improved until I clone them.
Before doing any other debugging steps:
catkin_make source devel/setup.bash
- It never hurts to run these commands again
- You may have forgotten to, for example, source the workspace in a new terminal window
- Look at the
rosgraph
usingrqt_graph
- If the
rosgraph
looks correct, userostopic echo
to make sure publishers are actually publishing
Checklist
Below is a checklist to use when you are finished and are thinking about turning in your homework.
- Is
catkin_lint
clean (no warnings/errors)? - Does
catkin_make
finish cleanly (no warnings/errors)? - Run the commands in the
README.md
. Do the instructions work? - Is
package.xml
filled in? - Are your debugging statements either removed or logged with rospy.logdebug?
- Do your python node files have a docstring at the top explaining the ROS publishers/subscribers/etc…
- Do your functions have docstrings describing the arguments and return types?
- Clone your repository into a brand new workspace and repeat the checklist.
- This step ensures you are not missing files in git or relying on some weird state in your current workspace to make everything work