6 Pages

cs1301-hw04-baseConversions-avoidWalls

Course: CS 1301, Fall 2008
School: Georgia Tech
Rating:
 
 
 
 
 

Word Count: 1412

Document Preview

1301 CS Summer 2009 Homework 4 Avoiding Obstacles / Binary Conversion Due: Friday, June 5th, before 6 PM (10% late penalty if turned in before Monday, June 8th, before 6 pm) Scored out of 100 points Files to submit: hw4.py This is a PAIR PROGRAMMING Assignment: Work with your partner! For pair programming assignments, you and your partner should turn in identical assignments. Your submission must not be...

Register Now

Unformatted Document Excerpt

Coursehero >> Georgia >> Georgia Tech >> CS 1301

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
1301 CS Summer 2009 Homework 4 Avoiding Obstacles / Binary Conversion Due: Friday, June 5th, before 6 PM (10% late penalty if turned in before Monday, June 8th, before 6 pm) Scored out of 100 points Files to submit: hw4.py This is a PAIR PROGRAMMING Assignment: Work with your partner! For pair programming assignments, you and your partner should turn in identical assignments. Your submission must not be substantially similar to another pairs submission. Collaboration at a reasonable level will not result in substantially similar code. Students may only collaborate with fellow students currently taking CS 1301, the TA's and the lecturer. Collaboration means talking through problems, assisting with debugging, explaining a concept, etc. You should not exchange code or write code for others. For Help: - TA Helpdesk Schedule posted on class website. - Email TAs Notes: Don't forget to include the required comments and collaboration statement (as outlined on the course syllabus). Do not wait until the last minute to do this assignment in case you run into problems. If you find a significant error in the homework assignment, please let a TA know immediately. Part one --- Avoid Walls 65 points There are five kinds of sensors on the robot: light sensor (detect the how bright the light is), proximity sensor (see whether there is anything around the robot), stall sensor, the camera, and the battery voltage. We are going to use the robot's proximity sensors for this homework. Be sure to read all of the information below. It explains many functions that are vital to the successful completion of this assignment. Mission: Your robot will be randomly placed in an arena of size 5 x 3 (Unit: 11 in). You need to write a function called avoidWalls() to move your robot around for one minute (+/- 5 seconds) without hitting walls. The robot needs to be moving at a minimum of 1/3 of it's maximum speed. (Your robot may drive "backwards" if you want to use the getIR() sensors instead of the getObstacle() sensors.) The robot should also celebrate after finishing the mission successfully. How it is going to celebrate is up to you, although it must be recognizable. We suggest moving around and beeping at a minimum. For more information on the arena, see the posted file. --- What's on the robot? --Proximity Sensors: Proximity sensors are used to detect objects that are close to the robot. The robot has two sets of proximity sensors: one set is on the robot and the other set is on the fluke. The IR sensors on the robot: There are two infrared (IR) sensors on the back of the robot (Assuming the fluke is facing forwards). You use the sensors by calling the getIR(<position>) function. Examples: >>> getIR() [1, 0] >>> getIR('left') 1 >>> getIR(0) 1 >>> getIR('right') 0 >>> getIR(1) 0 getIR(<POSITION>) Returns a integer value in the <POSITION> IR sensor. <POSITION> can either be 'left' or 'right' or one of the numbers 0, 1, which correspond to "left", and "right". IR sensors return either a 1 or a 0. A value of 1 implies that there is nothing in close proximity of the front of the sensor and a 0 implies that there is something right in front of it. The proximity sensors on the Fluke: There are three proximity sensors on the fluke: one front sensor and two side sensors. They give different values than the ones on the robot. To use this set of sensors, you need to call getObstacle(<position>). getObstacle() return a list that contains the values from all three sensors. To get a value from a specific sensor, you can call getObstacle(<position>). <position> can be "left", "right" or "center". <position> can also be number 0, 1, or 2, which correspond to "left", "center", and "right". Examples: >>> getObstacle() [1703, 1128, 142] >>> getObstacle('left') 1703 >>> getObstacle(0) 1703 >>> getObstacle('center') 1128 >>> getObstacle(1) 1128 >>> getObstacle('right') 142 >>> getObstacle(2) 142 getObstacle(<position>) returns a integer value between 0 and 7000. A zero (0) indicates there is nothing in close proximity of the sensor. Higher value implies the presence of objects in front of the sensor(s). Note that the center sensor is the most accurate. The side sensors will detect objects located at about a 45 degree angle, but not those directly to the sides of the robot. More details about the sensors can found: be <http://wiki.roboteducation.org/Learning_Computing_With_Robots Chapter 5 Sensing the World> Reminder: Robot needs to be moving at a minimum of 1/3 speed. Internal Clock function: To keep track of time, you can use the myro internal clock function. To get the current time, call currentTime() function. The function returns the number of seconds past since sometime in the past. [Epoch or Unix time if you're interested.] Example: >>> currentTime() 1222374008.360949 To keep track of time, you need to call currentTime() and save the time to a variable (e.g. time). You can get the time that has passed since you last called currentTime() by subtracting time from currentTime(). Example: time = currentTime() doing something..... doing something..... timePast = currentTime() - time More detail about the internal clock function: http://wiki.roboteducation.org/Learning_Computing_With_Robots Chapter 4 Sensing From Within If you want, you may use the timeRemaining() function and a while loop instead of the currentTime() function to time your robots motion. If you need help with the move functions, go to http://wiki.roboteducation.org/Learning_Computing_With_Robots Chapter 2 Personal Robots Turning it in, and Demo. Be sure to put the lines from myro import * and initialize() or init() at the beginning of the file (after the required comments). Be sure not to specify the port parameter in your initialize command, such as initialize("com4"). This makes it very time consuming to grade if we have to go into your code and change the com port to the one that works on our specific system. The TA will type avoidWalls() to start your robot moving, so you don't need to include a call to that function in your hw4.py file. Reminder on collaboration statement: This is a group assignment. Each group member need to turn in the identical hw4.py to T-square before the deadline. Please include your name, and all your group members' name in the header and collaboration statement. Demo: Each group (All members) needs to come to the recitation (tues/wed) the week following the due date to demo your robot to your grading TA. If that is not possible, you may demo to a different TA at the TA helpdesk at some other time, but this may delay your grade slightly as that TA will have to give the grading sheet to your grading TA. All group members will be asked questions about your code at the demo. The TA you demo to will fill out the (attached) grading sheet and give it to your grading TA (if they are not the same person). Be sure your program works as you want before you do the demo, because your grade will be based upon the Demo! The TA observing your demo may give you an extra chance if the robot hits a wall, at their discretion. Print out the attached grading sheet and bring it to your TA when you do your demo. Part 1 Avoid Walls Grading Criteria: Demo (See attached grading sheet) File named correctly Uses iteration correctly Uses IR sensors to detect obstacles (Walls) Celebration in the end 30pt 5 pt 10pt 10pt 10pt Part 2 Binary Conversion Your group will write a function dec2binary( decNum ) that will return a string made up of 1's and 0's corresponding to the (positive) decimal number that is the argument. For example: dec2binary(255) should return the string "11111111", dec2binary(0) should return the string "0", and dec2binary(5) should return the string "101". Your function must work for decimal numbers of any size! You may assume that only positive integers will be used as input. Include this function in your hw4.py file. When you demo your robot and the avoidWall() code, your TA may also ask any group member questions about this binary conversion code, so all group members should understand how it works. Part 2 Binary Conversion Grading Criteria: Produces correct results for all inputs Function named correctly & returns a string (instead of printing) Randomly chosen group member could explain (see attached demo sheet) 20pt 5 pt 10pt Robot Avoiding Walls / Binary Conversion TA Demonstration Grading Sheet Group Members: ___________________ ___________________ ___________________ Demo TA: Grading TA (if different) : ___________________ ___________________ 10 pts ________ Robot moved for aprox 60 seconds, without hitting obstacles! 20 pts ________ All group members understood and could explain the code. Part 2 Binary Conversion: 10 pts ________ A randomly chosen group member can successfully explain how the dec2binary function works. Total: ________ / 40
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Allan Hancock College - JMAH - 3796
C n ev gE eg - aia t na dS c e s o s ri n ry S tfci n u c s n s oS s ia l P r r n eR p r u t n be ef ma c e ot a o : T ed s ns g o teCH b i igwa a re as - a rt g( r h e i t e fh g a 2 ul n d s wad d is rai wol xt n d la e s ts b teGre B i igCo n i f
Allan Hancock College - JMAH - 3796
E/09 S/04 S/04E/09 S/04E/09 S/04E/092,50010,0002,50012,500 10,000 1,3002,50012,500 7,0003,0002,95010,450StorageFloor Area5,500 5,500Wet AreaStorageFloor AreaDesk AreaComputers1,3003,200 4,5005,700 5,700
NYU - B - 012303
The Global Economy Class NotesSources of Economic GrowthRevised: January 13, 2009 You will hear many reasons why countries differ widely in their levels and growth rates of output, most of it speculation. We impose some discipline on our thinking
Cal Poly - CSC - 347
Final - section 1100% (130.0 pts)-| | XXXXX | XXXXXXXX | XXXXXXXXXX &lt;= Class Average | XXX 50% (65.0 pts)-| XX | |
Cal Poly - CSC - 347
Midterm 2, Section 1100% (60.0 pts)-| | XX | XXXXXXXXXXXXXX | XXXXXXX &lt;= Class Average | XXXXXX 50% (30.0 pts)-| XX |
Cal Poly - CSC - 347
CSC347-1 Quiz1 Histogram 100% (20.0 pts)-| X | XXXXXXXX | XXXXX | XXXX | XXXX &lt;= Class Average 50% (10.0 pts)-| XX | XXXX
Cal Poly - CSC - 347
CSC347-1 Quiz2100% (20.0 pts)-| XX | XXXXXXXXXXX | XXXXXXXXXXX &lt;= Class Average | XXX | XX 50% (10.0 pts)-| | X
Cal Poly - CSC - 347
Winter 98 CSC347-2 Class Grades FINAL ( Letter grades are not posted; please email me if you wish to know what your grade is.) HWS QZ1 QZ2 QZ3 QZ4 MT1 MT2 PROJ b
Cal Poly - CSC - 347
Cal Poly State University Computer Science 347 Winter 1996Professor Mei-Ling L. Liu Office 14-208, x6460e-mail: mliu@csc.calpoly.eduHours: MW 14:10 to 15:00, Th 1:10 to 4:00Other times by appo
Cal Poly - CSC - 347
%!PS-Adobe-2.0 %Creator: dvipsk 5.58f Copyright 1986, 1994 Radical Eye Software %Title: dance_club.dvi %Pages: 1 -1 %PageOrder: Descend %BoundingBox: 0 0 612 792 %EndComments %DVIPSCommandLine: dvips -o dance_club.ps dance_club.dvi %DVIPSParameters:
Cal Poly - CSC - 347
&lt;h2&gt;Cal Poly State University &lt;/h2&gt;&lt;h3&gt;Computer Science 374, Spring 1997&lt;/h3&gt;Mei-Ling L. Liu, Professor&lt;hr&gt;&lt;h4&gt;Homework 2 Solutions&lt;/h4&gt;posted: 4/17, 8:10am1. (4 points) A screen of colored video display contains 1,000*1,000*30 bits of
Cal Poly - CSC - 347
&lt;h2&gt;Cal Poly State University &lt;/h2&gt;&lt;h3&gt;Computer Science 374, Spring 1997&lt;/h3&gt;Mei-Ling L. Liu, ProfessorHomework 3 SolutionsAssigned: April 16, 1997 - Revised April 17Due: 4/23 (Wednesday), 1997Total points: 200NOTE: latex notation used in
Cal Poly - CSC - 347
%!PS-Adobe-2.0 %Creator: dvipsk 5.58f Copyright 1986, 1994 Radical Eye Software %Title: proj.dvi %Pages: 2 -1 %PageOrder: Descend %BoundingBox: 0 0 612 792 %EndComments %DVIPSCommandLine: dvips -o proj.ps proj.dvi %DVIPSParameters: dpi=300, comments
Georgia Tech - CS - 4440
CS4440 Fall 2008 Course Reading Summaries Last 4 digit of GTID: 9523Paper #: 1.7.Title: Fast Nearest Neighbor Search on Road Networks.(1) ProblemsCalculating the shortest path (or distance to the nearest neighborhood) on network structure
Cal Poly - CSC - 347
load datareplaceinto table agentsfields terminated by &quot;,&quot;(aid, aname, city, commission)
Cal Poly - CSC - 347
a01,Smith,Los Angeles,6a02,Jones,Los Osos,6a03,Brown,Hong Kong,7a04,Gray,Los Angeles,6a05,Otassi,San Luis Obispo,5a06,Storms,San Luis Obispo,5a07,Smith,Santa Barbara,5a08,Booch,San Luis Obispo,5
Cal Poly - CSC - 347
/* *//* CSc 347 *//*-*//* This SQL*Plus script creates a demo database for CSc 347 *//* Use this script to create/re-create the CAPS database *//* */prompt Building CAP database. Please wait.set feedback offdrop ta
Cal Poly - CSC - 347
/*-*//* This SQL*Plus script creates the CAPS database for CSc 347 *//* Use this script and sqlload to create/re-create the CAPS *//* database *//* */drop table customers;create table c
Cal Poly - CSC - 347
load datareplaceinto table customersfields terminated by &quot;,&quot;(cid, cname, city, discount)
Cal Poly - CSC - 347
c001,Pic-N-Save,Los Angeles,10.0c002,WalMart,Santa Barbara,12.0c003,Swapmeet,Nipomo,8.0c004,K-Mart,Templeton,8.0c006,K-Mart,Hong Kong,0.0
Cal Poly - CSC - 347
load datareplaceinto table ordersfields terminated by &quot;,&quot;(ordno, month, cid, aid, pid, qty, dollars)
Cal Poly - CSC - 347
1011,jan,c001,a01,p01,1000,450.001012,jan,c001,a01,p01,1000,450.001019,feb,c001,a02,p02,400,180.001017,feb,c001,a06,p03,600,540.001018,feb,c001,a03,p04,600,540.001023,mar,c001,a04,p05,500,450.001022,mar,c001,a05,p06,400,720.001025,apr,c001,a05
Cal Poly - CSC - 347
load datareplaceinto table productsfields terminated by &quot;,&quot;(pid, pname, city, quantity, price)
Minnesota - M - 4428
Math 4428 Homework 7due April 9, 2007 1. We study the growth of a population with a pure birth process as in 5.3. (a) Is it realistic to consider a constant birth rate for a population growth model ? Why ? (b) We make the simple assumption that bi =
Minnesota - M - 4428
Math 4428 Homework 9due April 30, 2007 This is a variation of exercise 7.4. The bookseller now has reasons to believe that the demand is two times more likely to fall between 120 and 360 than elsewhere in [0, 480]. He wants to compute how much books
Minnesota - M - 4428
Some hints for homework 21. Write down the components (u(x, y), v(x, y) which correspond to (2.12) for each case. For example, for the Lokta-Volterra equation of section 1.4, u(x, y) = (a1 - b1 y)x and v(x, y) = (-a2 + b2 x)y, with all coefficients
Minnesota - M - 4428
Math 4428 Homework 2due February 2, 2007 1. Problem 2.3. 2. Problem 2.4. Additional: plot (by hand or computer) the curve y = v(x) as well as the the one corresponding to (2.28) (or given during the course). You could take vmax = 90, xc = 0.1 and xm
Minnesota - M - 4428
Math 4428 Homework 6due March 26, 2007 This is a study of the competing species dynamics described in Section 4.11. Consider the four possible situations in Figure 4.10. (i) Of the 4 possible models, explain the pros and cons of each model briefly.
Georgia Tech - CS - 6260
Home work 2 Implement the AES algorithm in a language of your choice. State clearly the assumptions that made you decide about the details of your implementation. Compare your implementation against existing ones (including other languages implementa
CSU Fresno - ZIMMER - 250
California State University, Fresno - Fall 2009 MATH 250, Perspectives In Algebra T Th 5:30 - 6:45 PM (Room S2 307) Instructor: Office: Phone: e-mail: Course webpage: Office Hours: Oscar V ega P eters Business Building Room 352. 278 - 4903 ovega@csuf
CSU Fresno - ZIMMER - 250
Perspectives in Algebra MATH 250 Lecture Notes California State University, FresnoOscar Vega Fall '08iiContents1 Groups Symmetries of polygons . . . . . . . . . . Permutations . . . . . . . . . . . . . . . . Definition and basic properties of
Georgia Tech - MATH - 1502
Georgia Tech - MATH - 1502
Georgia Tech - MATH - 1502
Georgia Tech - MATH - 1502
42342230&quot;%('2$1#'$'0&quot;$&amp; ) !
Georgia Tech - MATH - 1502
A695858587 @(1'0344'0'0) 2!$#&amp;##&quot; % 4)2(1(1(1
Georgia Tech - MATH - 1502
584747476 9'0'0&amp;)&amp;)'022&amp;)&amp;)&amp;)&amp;)( 1&amp;)&amp;)( 1( 3 1%!$## &quot;
Georgia Tech - MATH - 1502
%$#&quot; ! %(%($$''11$$''$$
Arizona - SECTION - 505
Orbit Theory: Lagrangian:L = T -W = L (q, q, t )Here T is the kinetic energy of the system and W is the potential energy (= GBE for our problem). We assume W = W(r) only, where r is the separation from the origin. Assume a single particle of mass
Arizona - SECTION - 505
Orbit Theory: Lagrangian:Here T is the kinetic energy of the system and W is the potential energy (= GBE for our problem). We assume W = W(r) only, where r is the separation from the origin. Assume a single particle of mass m moves in this central-
Arizona - SECTION - 505
Tidal Q:v + (v t)v = - P + 2v + ( + 1 ) ( 3v) + F m[Compare eqn. of motion in the Mar. 6, p.11 lecture without the viscosity terms.] Here v is the vector velocity of a fluid parcel in a fixed coordinate frame, F is the external force
Virginia Tech - CS - 1044
CS 1044 Programming in C+ Spring 2001Test 2 Form B Page 1 of 9READ THIS NOW!Failure to read and follow the instructions below may result in severe penalties. Failure to adhere to these directions will not constitute an excuse or defense. Print
Virginia Tech - CS - 1044
CS 1044 Programming in C+Test 2 Form AREAD THIS NOW!Failure to read and follow the instructions below may result in severe penalties. Failure to adhere to these directions will not constitute an excuse or defense. = = Print your name in the spac
Virginia Tech - CS - 1044
CS 1044 Test 2 Form A Key Spring 2000 Q A Explanation1. 3 The value of I J: Prior to the loop: 6 0 In the first iteration: 5 -5 In the second iteration: 4 -9 In the third iteration
Virginia Tech - CS - 1044
READ THIS NOW!Failure to read and follow the instructions below may result in severe penalties. Failure to adhere to these directions will not constitute an excuse or defense. Print your name in the space provided below. Print your name and ID num
Virginia Tech - CS - 1044
CS 1044 Programming in C+Test 1 Form AREAD THIS NOW!Failure to read and follow the instructions below may result in severe penalties. Failure to adhere to these directions will not constitute an excuse or defense. = = Print your name in the spac
CofC - RM - 210
Page 1/5Safety Data SheetAccording to 91/155 EECPrinting date 09.05.2007 Revision: 24.04.20071 Identification of substance: Product details: Trade name: 50X Tris/Acetic Acid/EDTA Buffer Article number: 1610743, 1610773, 9704629, 9703685, 970
CofC - RM - 210
SIGMA-ALDRICH MATERIAL SAFETY DATA SHEET Date Printed: 12/11/2008 Date Updated: 01/26/2006 Version 1.8 Section 1 - Product and Company Information Product Name Product Number Brand Company Address Technical Phone: Fax: Emergency Phone: SODIUM ACETATE
Virginia Tech - CS - 1044
Programming Assignment 1A Few NotesProgramming Assignment 1!Purpose: Familiarize yourself with Visual C+ 6.0 The Curator The compilation process2Programming Assignment 11Programming Assignment 1! ! !Replace &lt;put your name here&gt;
Virginia Tech - CS - 1044
The Development ProcessCompilationProgramming ProcessProblem Solving Phase We will spend significant time on this next week. Implementation Phase Create a concrete solution Test your solution Fix errors, add features, and test again.2Comp
Virginia Tech - CS - 1044
The C+ LanguageLanguage OverviewBrief History of C+! ! ! !Derives from the C programming language by Kernighan and Ritchie Created and developed by Bjarne Stroustrup in the 1980s Standardized in 1998 Added object-oriented features, additional
Virginia Tech - CS - 1044
The C+ LanguageInput and OutputOutput! ! !Output is information generated by a program. Frequently sent the screen or a file. An output stream is used to send information. Another type supplied by C+ Very complex, made up of several simple
Virginia Tech - CS - 1044
The C+ LanguageBooleans and SelectionBooleans!Recall that C+ has a bool type for storing Boolean values true falsebool isEmpty = name.empty();!Example2Booleans. - Struble1Comparisons! !Used to express logical conditions. Sev
Virginia Tech - CS - 1044
DebuggingProgram TracingProgram Tracing! !Recall that an important step in program development is to walk through your algorithm. It's also important to execute or trace your C+ programs by hand. To verify your program executes properly. T
Virginia Tech - CS - 1044
The C+ LanguageFunctionsProgram Design!Small Programs Easily understood in a single sequence of steps Little refinement A single algorithm is sufficient Difficult to understand and remember a long sequence of steps Usually consist of sever
Virginia Tech - CS - 1044
The C+ LanguageArraysStructure Data Types! !Collections of component itemsEach item can be accessed individually Arrays Structs Unions ClassesIn C+ 2Struble - Arrays1Motivation!Suppose you wanted to read in 100 temperatures.
Wisconsin - ENGR - 191
Operations Research &amp; Decision ScienceResearched By: Cory Markwardt Kyung Gu Lee Ketan Patel Dong Kyun NohCurrent Uses &amp; Activities Complex problems - many solutions Maximize - Minimize - Optimize Applied mathematics - Probability - and Stochas
Laurentian - CHEM - 200803
Contour Map of Electron DensitiesSecond lowest (antibonding) molecular orbital of the H2+ cation.Lowest (bonding) molecular orbital of the H2+ cation.*** *1s H2+ B.D.E. r0 Configuration Bond Order1s 1s H21s 1s He2+1s 1s
Laurentian - CHEM - 200803
Doing your own MO calculations with HyperChemMarc R. Roussel Department of Chemistry and Biochemistry University of Lethbridge January 2, 2008This note is intended to give you a tiny introduction to doing simple ab initio MO calculations in HyperCh
Laurentian - CHEM - 200803
CHEM 2000 Organic Chemistry: Functional Group and Nomenclature List (Fall 2008) Functional GroupsFunctional Group Alkene Look forC CC CAlkyneArene (aka &quot;aromatic ring&quot;)AlcoholC OHEtherC O CAmineC NOKetoneCCCOAldehyde
Laurentian - CHEM - 200803
Chemistry 2000 (Fall 2008) Problem Set #2: Molecular Orbital Theory and Larger MoleculesReading (Petrucci text) Chapter 11 Sections 11.6 11.7 and pages 462-463 (photoelectron spectroscopy) Textbook Questions Chapter 11 #37 41, 43 44, 46 48, 50