CSSE 120 -- Intro. to Software Development

Homework 5

  1. Complete the assigned reading for the next session, Zelle sections 5.1- 5.7, 5.9 (skim 5.8 as reference).
  2. (26 pts) Complete the Angel quiz over this reading. You'll find this on the course Angel page, under Lessons → Homework → Homework 5 → Graphics and Objects
  3. (30 pts) File output and string formatting: Storing information in files is a very important exercise for engineers running experiments that generate a large quantity of useful data.  The stored data can later be analyzed, categorized, and manipulated to allow engineers to draw useful conclusions. 

    Often, the generated data is formatted so that another program can automate the process of analyzing, categorizing, and manipulating the data. In this problem you are to write a program, funcDump.py, that implements the following design:

    Submit your Python source file and the generated output to the funcDump Drop Box in the Homework 5 folder on ANGEL.

  4. If you didn't do this for bonus points last session, you need to do it now (for no bonus)... In the next session, we will begin using a new development environment called PyDev that runs inside Eclipse. Freshman laptops have some of these steps done, as noted below:
    1. Install Eclipse by following these instructions. (Upperclassmen need to update to Eclipse 3.4; freshmen can skip this.)
    2. Install and configure PyDev for Eclipse by following these instructions. (Upperclassmen need to do all of this; freshmen can skip the beginning and start at step 3 of Install the PyDev plug-in for Eclipse.)
    3.  Install and configure Subclipse for Eclipse by following these instructions. (Everyone needs to do this.)
    4. You must show us in class next session (if you haven't already):
      1. Launch Eclipse and show us your Hello World Python program running.
      2. In Eclipse, show us your modified "spam.py" file that you checked out using Subclipse. If you didn't get this working, instead choose Window > Open Perspective > Other..., and show us that "SVN Repository Exploring" appears in the list.
  5. RobotPathViaPoints. (Due Session7) You will write a module, via.py, that will drive the robot through an environment using moves to via points stored in a file. We will use feedback from the encoders to drive a certain distance. An encoder is a mechanical device attached the robot's wheels to measure how far it has traveled. The program will:
    1. Prompt the user for the file name and open the file with that name.
    2. Play your warning sound from the last robot homework.
    3. Read each line of the file. Each line will contain 4 values (turn_angle_in_deg, turn_speed, fwd_distance_in_cm, fwd_velocity)
    4. For each line, turn the robot based upon the turn angle and speed, then drive the robot forward based upon the forward distance and velocity. For example (this is box.txt):
    Hints:
    1. You will likely use the go() and sleep() functions to move the robot, as you did last time. Another option instead of sleep is to use the wait_angle() and wait_dist() functions; see pycreate.pdf for details.
    2. Don't forget to close both the file and the connection to the robot at the end of your code!
    3. What you notice is that the more the robot moves the less accurate it will become in moving the prescribed distance or returning to the same point. This robot drifting is called odometry error. Odometery error means that the longer the robot travels, the sensor used to calculate the distance traveled (i.e. encoder) begins to accumulate error. This error is based upon wheel slippage, friction, uneven surfaces, wobbling wheels or sensor inaccuracy. In other words, the robot may “think” it is at a different place in the world than it actually is. This is a common problem in robotics research and it is necessary to add hardware or write control algorithms to combat this. For your homework, it is important to recognize the problem but you will not modify your program to compensate for it.
    Test your program using simple.txt, box.txt, box2.txt, and complicated.txt. Note, you must place these files in the same folder as via.py in order to read them. Submit your Python source file only (not the test files) to the ViaPoint Drop Box in ANGEL.
  6. Challenge Problem: This problem is not required, but is an interesting extension that you might like to try.
    1. Create a version of funcDump.py that prompts the user to enter the function for column 2 instead of hard-coding the function.
  7. Web links, bacon, eggs, and spam: One of today's in-class examples was a reference to the Penguin sketch. We hope you enjoy this four minute cultural experience!