CSSE 120 -- Intro. to Software Development

Homework 8

  1. Complete the assigned reading for the next session (Zelle Chapter 6).
  2. (28, 24 pts) Complete two ANGEL quizzes over this reading. You'll find them on the course ANGEL page, under Lessons → Homework → Homework 9 → Defining Functions,  More Functions
  3. (25 points) File Input
    1. Checkout the FuncPlot project from your SVN repository.
    2. Write a program in module funcPlot.py that implements the following design:
      • Prompt the user for a file name
      • Open a file with the given name
      • Display a graphics window with width 720 and height 400.
      • Read each line from the file. For each line, plot a point on the graphics window. You should assume the lines have the format specified in funcDump (treat the first number as the x coordinate and the second number as the y).
      • Close the file
    3. Test your program using your cos.txt output from funcDump. (Note: you must place cos.txt in the same folder as funcPlot.py to read it.) You may also test using the sample outputs for different functions below. (The functions are "upside down" because of the graphics coordinate system. You could fix that by using zellegraphics' win.setCoords() method if you so desired, but we won't require it.)
    4. Commit your solutions to your SVN repository.
  4. (15 points) Robot Sensor Reading
    1. Checkout DistanceTraveled project from your SVN repository
    2. This can be done with your robotics partner or in-class pair programming partner or individually.  Just include all the names in the top of your code.   For this problem you will get the sensor data for distance and use zellegraphics to show the robot moving across the screen.
    3. Run the program to see what code is already included - it should look like this and ask you to enter your com port in the console window:
      Expected starting robot image
    4. Read the program to see what code is already included
    5. Finish the TODO's in the code so that all of the following happens:

      1. The Robot image will be moving across the screen as the robot on the ground moves
      2. Start the iRobot Create moving in a straight line at a slow speed
      3. Poll the robot every 0.1 seconds for 3 seconds to get the distance traveled
      4. Use the distance traveled to move the .gif image across the screen moving to the right
      5. In addition to the moving .gif image moving, update the text object to display the distance traveled
      6. After 3 seconds pass stop the robot moving but leave the window open until a user clicks in the window
      7. Play around with the robot speed and window size, but make sure the robot finishes still on the screen
      When you are finished make sure to commit your code to the repository.  A finished robot run might look like this:
    6. Expected starting robot image