# Purpose

Use the IMU to correct steering on the Sparkfun magician robot. Moreover, IR sensors will be used to avoid and navigate around obstacles.

# Background

PID (proportional-integral-derivative) control can be used to correct error in a system. It uses feedback by measuring a current value and comparing it to a setpoint value. The difference between these values is known as the error. The controller attempts to minimize the error by inputting a correction term to the actuator. The controller uses three constant constant parameters known as P, I, and D. The P (or proportional) term corresponds to the present error. The I (or integral term) corresponds to the accumulation of past errors. The D (or derivative) term corresponds to the prediction of future errors based on the current rate of change. By tuning these three parameters based on the system at hand, the PID controller can minimize the error in the system.

Tuning these parameters can be quite involved and tedious. The naive approach of trial and error may be used. However, this usually leads to many hours of painstaking and tedious work and may not even lead to a desirable outcome. Mathematical modeling is usually used to compute the terms for the controller. This wiki page here (http://developer.mbed.org/cookbook/PID) explains a method of calculating P, I, and D. A simple Google search can also yield a plethora of information on PID control theory.

# Pinouts

MbedH-BridgeMotor
p21PWMB
p22BIN2
p23BIN1
p24AIN1
p25AIN2
p26PWMA
VOUTVCC, STBY
VINVMOT
GNDGND
AO1Right Motor +
AO2Right Motor -
BO1Left Motor +
BO2Left Motor -
MbedIMU
p9SCL
p10SDA
VOUTVDD
GNDGND
MbedIR Filter/Sensor
p18Left IR AIN
p19Right IR AIN
p20Center IR AIN
VIN+5V
GNDGND

# Code

#### Import programRobot_feedback_ir

Use the IMU to correct steering on the Sparkfun magician robot. Moreover, IR sensors will be used to avoid and navigate around obstacles.

# Video Demo

Please log in to post comments.