CSSE 120 — Introduction to Software Development, Robotics

Homework 6

Reminder: for each class session and associated homework:

  • You do all other work in Eclipse in the project that you checked out for that session.
  • You turn in your Eclipse work by committing that project:
    • Right-click on the project name in the Pydev Package Explorer view.
    • Select Team → Commit
    • In the message box that appears, put a message to yourself if you wish (eventually, these messages will be for your teammates) and press OK.
    It is a GOOD idea to COMMIT OFTEN, not just when you finish the homework. Doing so provides easy backups of your work.

Questions? Email csse120-staff@rose-hulman.edu.

Best place and time to do the homework: CSSE lab (Moench Hall, room F-217), 7 p.m. to 9 p.m., Sunday — Thursday.

Today's project: Session06_LoopsAndRobots

Main learning objectives for this homework:

  • Learn about sensor input on the robot
  • Learn how to add an image to a window using Zellegraphics
  • Practice programming with the robot


Do the following exercises. Use today's project: Session06_LoopsAndRobots

  1. Do the TODO's in the m3_distance_traveled.py module of today's project.
    1. 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.
  2. Detailed instructions are within the m3_distance_traveled.py module.  Here is what the opening screen might look like:
    Expected starting robot image
  3. 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 (read 'DISTANCE' sensor)
    2. Start the iRobot Create moving in a straight line at a slow speed
    3. Poll the robot every 0.1 seconds to get the distance traveled (getSensor('DISTANCE') )
    4. Use the distance traveled to move the .gif image across the screen moving to the right (let mm traveled = screen pixels to move)
    5. In addition to the moving .gif image moving, update the text object to display the distance traveled in millimeters
    6. Note:  millimeters (mm) are the sensor's default units when you call getSensor('DISTANCE')
    7. After the given number of seconds, stop the robot moving but leave the window open until a user clicks in the window
    8. Play around with the robot speed, time, and window size, until 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:
  4. Expected starting robot image
  5. Make sure your code has an input statement that ask what COM port to use for the robot for grading purposes