CSSE 120 -- Intro. to Software Development

Homework 13

  1. Complete the assigned reading for the next session (Zelle sections 9.1- 9.6).

    Read it very carefully to understand the top-down design process. Come to class prepared with questions on anything you do not understand. For Session 14, we will assume that you have read and understood whatever you do not ask about; we will spend most of the class time developing another (and more complex) example to reinforce and extend what you learn by reading.

  2. (44 pts) Complete the Angel quiz over the reading assignment. Because of the way we are handling this material in class, this quiz will be a little bit more detailed than most of the ANGEL quizzes have been. You'll find the quiz on the course Angel page, under Lessons → Homework → Homework 13 → Simulation and Design
  3. (60 pts) SmartWander. You should have completed most of these steps in class:
    1. Download the latest copy of the Pycreate library, using insructions available here.
    2. Check out the Session13Robotics project from your repository.
    3. (10 pts) Complete the implementation of sensorLoop.py. This will ensure that you understand how to read data from the SENSORS list. Commit it.
    4. (10 pts) Complete the implementation of moveAndSense.py. This will ensure you understand how to read data from the SENSORS list and respond to it while the robot moves. Commit it.
    5. (40 pts) Complete the implementation of smartWander.py. Your new smartWander() function should cause the robot to wander around randomly (turn then move, repeated 5 times), as in an earlier robot homework, but also move away from any obstacles into which it bumps. Specifically:
      1. You will move for random angles between -180 and 180 degrees (improvement from the earlier wander()), and distances between 10 and 30 cm. Reminder: be sure that the sign on your velocities and distances are the same. Also, do NOT use wait_Angle() or wait_Distance() (or turnTo() or moveTo() which use them), since they monopolize the serial port, which you need for sensor data. Therefore, you will have to use go() and stop() and calculate how long to sleep manually.

      2. If the robot runs straight into an obstacle (left and right bumpers sensed), then back up. Choose a sensible distance to back up: enough to get away from the obstacle, but not enough to back up into another obstacle. You may then go on to the next random turn and move (in other words, you don't have to try to complete the move that was blocked).

      3. If the robot runs into an obstacle at an angle such that only the left bumper senses it, then backup and turn clockwise (for your sensible choice of an angle). Then execute the next random turn and move.

      4. If the robot runs into an obstacle at an angle such that only the right bumper senses it, then backup and turn counter-clockwise (for your sensible choice of an angle). Then execute the next random turn and move.
    6. Commit your work.