CSSE 120R Final Python Robotics Project—Winter 2009-2010
Project Requirements
The final project for the Python part of this course is to
implement a GUI for robot control that includes reacting to IR sensor
messages! Your GUI will have functions for controlling the robot and
one button more important than others... the "Musical chairs"
button. The gold standard for Musical Chairs is to be able to
drive circles around a
track while avoiding the teacher robot in the middle. If the teacher
robot (ie the "chair" in Musical Chairs) is sending the IR signal 50
your robot should be doing laps around the track. If the teacher
robot sends IR signal 100 your robot should stop immediately (at least
within 2 seconds). If the teacher robot sends the IR signal 200
your robot should be the first to reach the chair (ie the teacher
robot). Summary: 50 = Music playing go around track, 100 =
Freeze!, 200 = The music is done go for the "chair".
Your project must satisfy these core requirements:
- You must complete the implementation of a GUI to control your
robot.
- You must implement code to receive IR information WHILE line
following around a track then respond to that IR value.
- All team members must contribute to and understand
their project.
Most of the work on your project will be translating the guidelines
provided into a working implementation. If you are having trouble
planning or getting started, get help. It is much better (and easier)
to get help early and start off with a good plan than to try to hack a
poor design into a semi-functional program in the final days before it
is due.
Milestones
To make sure that you are on-track to complete your project, you
must meet the following milestones. Each milestone will contribute to
your overall project grade. Each milestone must be done at the
beginning of the specified class session (no 24-hour extensions).
This is so we can help you in class as needed. For each milestone, you
must commit your work to your repository and include a clear commit
message stating that that milestone is completed.
- Session 16 (mid session) -- Checkout
the project. The name of the repository is
http://svn.cs.rose-hulman.edu/repos/csse120-201010-teamXX
where XX is your team number as announced by your
instructor
- Check out the MusicalChairs project, and find
the module musicalChairs.py within it. Each team member
should independently add his or her name to the comments at the top of
the file. This involves each of you editing the file, so it requires
careful use of SVN. For example, the first team member should update,
edit, then commit, then the second member repeats
this cycle, then the third. Everyone should then
update.
Follow this cycle of update-edit-commit whenever you make
changes to your program.
- Session 17
- Basic GUI. At this stage, you must allow the
user at least to connect to a port and disconnect. You must also allow
them to drive the robot directly (forward, reverse, spin left, spin
right, stop) and follow a line.
- LineFollowing works and is "interruptable" by the
user. That is, you must integrate your line following into the
program's main event loop so if another button (like one of the direct
drive buttons) is pressed during line following, it responds to it.
(Therefore, this requires more than just calling your pre-written line
following function; see the provided code for hints.) Be ready to show
off the basics to your instructor and the TAs.
- Additionally the LineFollowing must stop if a front bumper
is hit
-
Session 18 — IR information send and received to self.
Here, you need to be able to send an IR signal from your robot's IR hat
to your own IR receiver, then update the display.
-
Session 19 — Core functionality completed.
Here, you'll show off your whole program to your instructor and the
TAs. This is a "dry run" of tomorrow's demo, so you have time to make
any needed adjustments. You can earn points today towards your
core functionality
- Session 20 — Program finished and fully functional. You
have 5 minutes per team (only) to demo your robot. Make sure it
works reliably to get the most points you can in your 5 minute demo.
- Session 21 — Team evaluation of your partners. This can
be found in Angel under Lessons.
Grading
Here is the rubric we will
use to grade your program. Note also:
Project grades will be based on both individual and group results.
We will check off each project milestone, to make sure you are
making steady progress.
The final program will be graded based on the proper functioning of
your program.
The program will also be graded on your design, coding style, and
documentation, including SVN commit messages.
The grade can also be bumped up some due to your creativity. While
you can earn an A by following the requirements in this document,
sometimes students think of even cooler things to do to demonstrate
their understanding. What challenges you?
Each team member will be required to complete an evaluation survey
about his or her own performance and that of each of his or her
teammates. We will use these surveys and our own observations to assign
individual project grades.
Details
GUI
Your GUI must support as a minimum:
- Connecting (to the specified port number) and disconnecting from
your robot.
- Driving your robot directly at the specified speeds.
- Line following.
- Sending IR information to your self during any activity.
- Playing the Musical chairs game.
- Playing a very short song.
Example:
This is just a sample of what our GUI looks like. You can use
the given layout or make your GUI look
different, but you shouldn't waste hours moving rectangles. The
capital letter shows the quick key for each button. Focus
on the interesting parts of the project, like robot behavior.
We have included a RobotButton class in the project. This will allow
you to make any additional buttons you'd like. See how we made the
given buttons as an example.
Note: the Re button is for Disconnect and Reconnect. This
button seems worthless but is a good solution to the sensing garbage
problem. Remember that anytime your robot code doesn't reach the
robot.shutdown() command normally, Then next time you run the robot it
will give you sensor garbage. With the reconnect button, if you
see sensor garbage, you can click on the Re
button to disconnect and connect again, which fixed the sensor garbage
for us almost every time.
IR Communication
The IR sensor on the front of the robot can receive a single byte of
information from another source, whether it be another robot, the
docking station, or even a virtual wall. Furthermore, the robot can
repeatedly send a single byte out of its omnidirectional
IR transmitter (below). Between the two, we have the ability for two
robots to communicate with each other. This will be very important when
playing Musical chairs. The teacher robot will be transmitting an
IR signal that your robot must respond to.
Line following Rules
- For line following your robot should stop following the line if
you hit one of the other direct drive buttons.
- Your robot should also stop if a front bumper is hit
- It will be tested by putting your foot on the track in the way
of the robot
- The robot should be able to play a song while line following
- The robot should be able to transmit IR signals and update the
receive IR value while line following.
- Line following will be tested with your IR hat on (to test IR
functionality)
- There will be no teacher robot on the track.
- The robot needs to be able to complete 2 laps in less than 1
minute
Musical chairs Rules
For your project grade you will be playing Musical chairs by
yourself. You must be able to do the following:
- For Musical chairs your robot should stop playing Musical Chairs
if you hit one of the other direct drive buttons.
- For Musical chairs your robot does not need to stop if a front bumper
is hit
- This will be discussed more later
- The robot should be able to play a song while playing Musical
chairs
- The robot should be able to transmit IR signals, respond to them
as appropriate, and update the receive IR value while playing Musical
chairs.
- This one is VERY important for singal robot testing
- While it is important for development and testing, Musical chairs
will be tested with your IR hat off
with a teacher robot providing the IR signal
- There will be teacher
robot on the track.
- The robot still needs to be able to complete 2 laps in less than
1 minute
- The robot must start moving within 2 seconds from the time the
teacher robot starts transmitting 50
- The robot must stop moving within 2 seconds from the time the
teacher robot starts transmitting 100
- The robot must be able to hop off the track and hit the teacher
robot within 5 seconds from the time the teacher robot starts
transmitting 200
- To make your life easier we will only test Musical chairs with
your robots going CCW around the circle (as viewed from above)
- For the competition TWO robots will be playing Musical chairs
against each other in a head-to-head battle
- Your individual musical chairs demo can take place on Session 19
to gaurenty your team the points (one day before the demos)
Musical chairs competition
Mainly for fun on Session 20 there will be a musical chairs
competition! Yes, that's right it's a robot musical chairs
competition. Guessing you have not had one of these before.
;) The rules are this:
- Two robots going around the line following loop CCW with a
teacher robot in the middle
- The game will start with the teacher robot sending 100 for the
robots to stay frozen
- The teacher robot will start the Musical chairs competition by
sending 50
- You must not hit the teacher robot or you lose
- You must not go off the line or you lose
- At some point the teacher robot will send 100 to freeze the robots
- You must freeze within 2 seconds of the freeze command and stay
frozen until 50 is sent again
- Stay frozen or you will lose
- The teacher robot will then go back to sending 50 to start
driving again
- At some point the teacher robot will send 200!
- The first to hit the teacher robot is the winner!
- Additional rule to encourse FAST line following!
- If you drive on the line faster than your competition and catch
them you can trigger the 200 signal
- From the moment you bump your opponent you can head for the
chair
- It won't be a free drive though because 1.5 seconds after the
bump the teacher robot will start transmitting 200
- So if you are FAST on the line follow you will get a 1.5 second
head start
If you want to size up your competition here is the tournament bracket.
The project is worth 1000 points total. The winner of the
tournament will receive 10 bonus points, second place 5 points!
This numbers were intentionally chosen to have no real effect on your
final score. This is to encourage you to realize the tournament
is just for fun. :)
Hardware
- Omnidirectional IR Transmitter. This is the
"hat" with 8 IR LEDs that sits on the BAM (wireless receiver) module.
Place it on top of your BAM and plug the red
wire into +5V (there are
two holes from which to choose) and the black wire
into LD1, both on the back of the BAM.
Demo
Each team will have a short amount of time (~5 min) in class to
demonstrate their program's interaction with another robot to the
instructor and the class. You will be judged on your preparedness, your
program's functionality and how well each of the
team members can explain the code. (This is to encourage you all to
work on the code together and to contribute to it.) Ask me ahead of
time if you want to demo your program with a specific team. The
tournament will happen after the demos.
Suggestions
- Plan first! Think about how to use top-down design and/or
dictionaries. Get help early if you need it!
- Functions are your friends. Well-written ones will make your
life so much easier! Encapsulate functionality!
- You will likely have certain information that many functions
will need to access. You may want to put all this information in a
dictionary object and pass it into the functions. I created a
robotInfo dictionary that contained the robot itself, its direction,
its linear velocity, and if it was currently sending IR information.
That worked well.
- Test early and test often. Don't write more than a handful of
lines of code at a time without testing it. Sometimes, this will
mean writing test code that doesn't make it into your final submission.
Welcome to the real world of software development!
- You will likely want to keep track of the various states your
robot is in, such as whether or not it is currently line following,
playing musical chairs, connected, etc. You can use Boolean variables
for these and check them each
iteration of the event loop to see if you have to do that step, like
drive a tiny bit around the track.