# Lab 2: Feedback in Wall-Following and Velocity Control

Assigned: Thursday, September 14, 2006.
Due: Thursday, September 21, 2006.

This lab introduces feedback as an organizing concept for robot activity. Using an optical distance sensor, you will create a control system to drive the robot at a constant distance from the wall. Using built-in DC motor velocity sensors, you will create a control system to drive the robot at constant velocity.

Excerpts from Robotic Explorations, handed out in class.

# Implementation Projects

Three robot bases will have already been provided in lab for carrying around the Blackfin Handy Board. Since we only have 3 BF-HBs at present, these will be all that are needed for starting the labs. You may extend the robots, but please share them.

## Project 2.1: Wall Following

Mount an “ET distance sensor” onto your robot (a.k.a., the Sharp GP2D12) and implement wall-following as described in Robotic Explorations. Implement either the 2-threshold algorithm (too far / too close) or the 3-threshold algorithm (too far / just right / too close).

Experiment with sensor placement and discuss how this affects performance, particularly as the robot goes around corners.

Experiment also with threshold settings and discuss how this affects performance.

In your implementation, does the robot have internal state? Explain.

## Project 2.2: Velocity Control

The Blackfin Handy Board includes a “back EMF” sensor on each DC motor output takes an instantaneous measure of motor velocity. It does this by briefly removing applied power from the motor, allowing it to spin freely and act as a generator. Then, the amount of generated voltage is sampled. This voltage is linearly proportional to the motor velocity. The procedure works whether the motor is powered or not; if the motor is manually turned, it will also generate a voltage that can be measured by the back EMF circuit.

Using this feature, create a program that maintains a constant velocity on a motor regardless of disturbances. Use the proportional-derivative approach described in the Robotic Explorations text. Also, you may experiment with the PID controller primitive included in LabVIEW. Your motor controller should include a way of specifying the velocity setpoint.

Create two copies of the controller (one for each motor) and determine if the robot can drive in a straight line when the left and right wheels are both commanded to the same velocity setpoint.