# Lab 4: In Class

Lab 3 explored exercises with the servo and sensor. It was important to understand how the serial monitor in the Arduino IDE works for later testing and debugging. You were to produce a working code for the Follow the Wall task. In this lab you will begin to build upon this strategy for the more complex navigation challenges given.

# Exercises

# Exercise 1: Follow the Wall Revisited

Goal: Attempt to implement your solution on hardware and understand the different constraints to account for in the real world with the physical robot.

Important Note

Since you completed the initial follow the wall task, the environment has been modified to more accurately represent the actual scale of the physical challenge.

  1. Modify your solution to work in this new environment. (~10 minutes.)
  2. Answer the question found here reflecting on what you expect the differences to be once you implement your solution on hardware. (~5 minutes)
  3. Build your robots and try to implement your solution so that the robot follows the wall for at least 1m. (~25 minutes)
  4. Answer the question found here reflecting on what you observed when trying to implement follow the wall on hardware. (~5 minutes)

# Exercise 2: Class Navigation Challenge

Goal: To begin formulating strategy for solving class navigation challenge 1.

# Pseudocode

  1. Write a rough strategy for completing the task in plain language. Refer to this document for examples on how to write pseudocode. This activity is to be completed for homework, individually.

Some tips for Pseudocode

For looping and selection, some keywords that can be used include:

  • While...End;
  • If...Endif with Else, Elseif;
  • Call ... as in a function with (parameters);
  • Return;

Words written with careful indentation can allow readable, effective pseudocode. Other examples: set, reset, increment, compute, read, write, calculate, generate, add, sum, multiply, ..., print, display, input, output, edit, test, etc.

# Arduino Sketch

  1. Start working on a group code solution to solve the class challenge 1. You should be able to perform this task if the lined-up coin configuration had different positions or distance away from the wall. You should try to avoid using a "hard-coded" strategy for this task but the goal is to complete the challenge in the fastest possible time. The group solution will be submitted for homework.