Description
Welcome to CS101: Preview of Computer Science!
Computer science is not programming: programming is just one of several of the computer scientist's tools. The class will introduce you to a variety of computer science topics, taught both by the professor and by various faculty in the department and other guest lecturers.
Computer science is not programming: programming is just one of several of the computer scientist's tools. The class will introduce you to a variety of computer science topics, taught both by the professor and by various faculty in the department and other guest lecturers.
General Information
Requirements to Take this Class
1. You must be a CS or Applied CS major. Likely majors may take the class with permission of the instructor.
2. All new CS or Applied CS majors must take this class at the same time as their first CS class (typically CS112, CS211, CS310, or CS367). We will teach CS101 in the Spring semester.
3. If your first CS class is not CS112, you may need to learn some basic Python. The professor will be glad to assist you in this.
2. All new CS or Applied CS majors must take this class at the same time as their first CS class (typically CS112, CS211, CS310, or CS367). We will teach CS101 in the Spring semester.
3. If your first CS class is not CS112, you may need to learn some basic Python. The professor will be glad to assist you in this.
Grading
Grading will be based on a combination of the following factors, each weighted approximately the same:
1. Class attendance and participation.
2. Participation in various sanctioned external activities and lectures related to computer science.
3. Seeing your academic advisor at some point during the semester.
4. A group project, with some possible warm-up exercises.
1. Class attendance and participation.
2. Participation in various sanctioned external activities and lectures related to computer science.
3. Seeing your academic advisor at some point during the semester.
4. A group project, with some possible warm-up exercises.
Announcements
Assignment #2
3/20/13 6:18 PM
Demo Deadline: April 4th, 2013 during the TA hours. You can demo it earlier if you have completed the assignment before the deadline.
Assignment:
Below are three options, each with a bonus section.
• Group A will implement one option without the bonus.
• Group B will implement one option with its bonus, OR two options without their bonus.
• Group C will implement two options AND at least ONE bonus, OR will implement all three options without their bonus.
Note: If you're in a mixed group, do the assignment which reflects the majority of your team (e.g. if your group has more As than Bs, do the A assignment).
Hint. All three of the options below are likely to be implemented with code in the following pattern:
Loop:
Get the sensors
Based on the sensors, decide how to move the robot
Move the robot a bit
Sleep a bit (maybe 50 or 100 ms)
1. BUMP AND RUN:
The Create has two bump sensors on its front. You will have the robot move forward until it senses a bump.
• If the left bump sensor was hit, the robot will turn 90 degrees to the right and continue forward.
• If the right bump sensor was hit, the robot will turn 90 degrees to the left and continue forward.
• If BOTH bump sensors were hit, the robot will turn 180 degrees and continue forward.
The robot will continue this behavior indefinitely. I suggest using a loop (with a small sleep in it) which queries the sensors and use turn() to rotate. Don't use move() to go forward; instead try go(), because move() turns off sensors while it's moving.
Bonus: The robot will also play some notes depending on what bump sensor got hit.
2. WALL FOLLOWING:
The Create has an infrared distance sensor on its right side, called the Wall sensor. Using the Wall sensor, have the robot move forward along a wall to its right while maintaining about the same distance from the wall. Suggestion for how to do this: make a big loop (with a small sleep in it) which queries the sensors and then changes the wheel motor values using the go() function. Each time in the loop you might check:
• If the wall is too far away, curve to the right a bit.
• If the wall is too close, curve a bit to the left.
• If the wall distances is within an acceptable range, go forward.
Ideally your robot should be able to handle outside corners as well using these rules. I suggest using only go(), not move() or turn().
Bonus: Inside Corners. What if the robot has to handle inside corners? As it's following the wall it hits the wall turning in front of it. Modify your code to handle inside turns as well as outside turns. To facilitate inside turns you might use turn() a bit in addition to go().
3. LINE FOLLOWING:
The Create has four "top hat" ("CLIFF") infrared sensors underneath, which point straight down and are used to detect whether the Create has reached a stair (a "cliff") or not. Here's how they work. The sensors beam some infrared light onto the floor. Then they detect how much light is reflected. If the floor is close, a lot of light is reflected. If the floor is far away, not much light is reflected. That's how they detect that he Create has come to a cliff -- the sensor is reporting very little light returning.
However, the sensors are also sensitive to material color. If their beam hits a light colored or highly reflective floor material, a lot of light will come back. If the beam hits a dark material, not much light will come back. In fact, the Roomba can be easily fooled by black carpets, thinking that they're actually stairs!
You can take advantage of this to have the Create follow a black line. Consider its middle-left and middle-right top hat sensors. Place the robot on the line so that the sensors are on opposite sides of the line. Then you might do a loop like this (again, with a little sleep):
• If the left sensor indicates that the black line is beneath it, curve a bit to the left.
• If the right sensor indicates that the black line is beneath it, curve a bit to the right.
• If NEITHER sensor indicates that the black line is beneath it, just go forward.
• If BOTH sensors indicate that the black line is beneath them, just go forward (this handles loops in the line)
The robot will continue this behavior indefinitely. Again, I suggest using only go(), not move() or turn().
PLEASE NOTE: To demo this, you need to bring your own line! A large sheet of white paper w/ black tape/marker is probably the best option.
Bonus: Calibrate.
Add a calibration routine: before starting along the line, place the robot on lines and on non-lines so it can determine what a line reading is and what a non-line reading is. From this, the robot should determine the point at which a sensor is assumed to be a line versus not a line (rather than using a hard-coded number).
Assignment:
Below are three options, each with a bonus section.
• Group A will implement one option without the bonus.
• Group B will implement one option with its bonus, OR two options without their bonus.
• Group C will implement two options AND at least ONE bonus, OR will implement all three options without their bonus.
Note: If you're in a mixed group, do the assignment which reflects the majority of your team (e.g. if your group has more As than Bs, do the A assignment).
Hint. All three of the options below are likely to be implemented with code in the following pattern:
Loop:
Get the sensors
Based on the sensors, decide how to move the robot
Move the robot a bit
Sleep a bit (maybe 50 or 100 ms)
1. BUMP AND RUN:
The Create has two bump sensors on its front. You will have the robot move forward until it senses a bump.
• If the left bump sensor was hit, the robot will turn 90 degrees to the right and continue forward.
• If the right bump sensor was hit, the robot will turn 90 degrees to the left and continue forward.
• If BOTH bump sensors were hit, the robot will turn 180 degrees and continue forward.
The robot will continue this behavior indefinitely. I suggest using a loop (with a small sleep in it) which queries the sensors and use turn() to rotate. Don't use move() to go forward; instead try go(), because move() turns off sensors while it's moving.
Bonus: The robot will also play some notes depending on what bump sensor got hit.
2. WALL FOLLOWING:
The Create has an infrared distance sensor on its right side, called the Wall sensor. Using the Wall sensor, have the robot move forward along a wall to its right while maintaining about the same distance from the wall. Suggestion for how to do this: make a big loop (with a small sleep in it) which queries the sensors and then changes the wheel motor values using the go() function. Each time in the loop you might check:
• If the wall is too far away, curve to the right a bit.
• If the wall is too close, curve a bit to the left.
• If the wall distances is within an acceptable range, go forward.
Ideally your robot should be able to handle outside corners as well using these rules. I suggest using only go(), not move() or turn().
Bonus: Inside Corners. What if the robot has to handle inside corners? As it's following the wall it hits the wall turning in front of it. Modify your code to handle inside turns as well as outside turns. To facilitate inside turns you might use turn() a bit in addition to go().
3. LINE FOLLOWING:
The Create has four "top hat" ("CLIFF") infrared sensors underneath, which point straight down and are used to detect whether the Create has reached a stair (a "cliff") or not. Here's how they work. The sensors beam some infrared light onto the floor. Then they detect how much light is reflected. If the floor is close, a lot of light is reflected. If the floor is far away, not much light is reflected. That's how they detect that he Create has come to a cliff -- the sensor is reporting very little light returning.
However, the sensors are also sensitive to material color. If their beam hits a light colored or highly reflective floor material, a lot of light will come back. If the beam hits a dark material, not much light will come back. In fact, the Roomba can be easily fooled by black carpets, thinking that they're actually stairs!
You can take advantage of this to have the Create follow a black line. Consider its middle-left and middle-right top hat sensors. Place the robot on the line so that the sensors are on opposite sides of the line. Then you might do a loop like this (again, with a little sleep):
• If the left sensor indicates that the black line is beneath it, curve a bit to the left.
• If the right sensor indicates that the black line is beneath it, curve a bit to the right.
• If NEITHER sensor indicates that the black line is beneath it, just go forward.
• If BOTH sensors indicate that the black line is beneath them, just go forward (this handles loops in the line)
The robot will continue this behavior indefinitely. Again, I suggest using only go(), not move() or turn().
PLEASE NOTE: To demo this, you need to bring your own line! A large sheet of white paper w/ black tape/marker is probably the best option.
Bonus: Calibrate.
Add a calibration routine: before starting along the line, place the robot on lines and on non-lines so it can determine what a line reading is and what a non-line reading is. From this, the robot should determine the point at which a sensor is assumed to be a line versus not a line (rather than using a hard-coded number).
Name | Office Hours | |
---|---|---|
Zoran Duric | When? Where? | |
Bryan Hoyle | When? Where? |
Lecture Notes
Lecture Notes
Lecture Date
Apr 18, 2013
Feb 28, 2013
Mar 7, 2013
Feb 7, 2013
Feb 19, 2013
Feb 21, 2013
Feb 26, 2013
Mar 19, 2013
Mar 21, 2013
Mar 26, 2013
Apr 2, 2013
Apr 2, 2013
Feb 5, 2013
Jan 29, 2013
Jan 29, 2013
Jan 29, 2013
Jan 24, 2013
Jan 22, 2013
Feb 5, 2013
Jan 31, 2013
Mar 28, 2013