AME 3623: Project 2: Microcontrollers and Finite State Machines

In project 2, we designed a robot controller that was capable of orienting to and then moving toward an infrared beacon. The control outputs were direct, logical functions of the sensor inputs. However, it is often desirable for the control signals to not only be functions of the current sensory inputs, but to also take into account some aspect of the history of the inputs. We often refer to this representation of history as the context or state.

Continuing our VOR example from project 1, suppose our aircraft is to follow a particular path by successively finding and locking onto a sequence of VOR beacons. How one searches for the next beacon in the sequence depends not only on the information being received from the current beacon, but also upon where one is in the sequence.

The goals for this project include:

Project Due Dates


Robot Task

In the full task, the robot will operate in two primary phases:

Within either of these phases, an exception may occur if the robot loses sight of the forward beacon (as defined by both the left and right sensor signal strengths dropping to "00"). If this exception occurs, then:

Test Courses

We will use a set of standard test courses for demonstration purposes (these will be available prior to demonstration). Once the first group is ready to begin testing, we will make sure to always have at least one test setup in the lab.


Design Process

Part 1: Basic Control

Due: March 23rd at 5:00

This part requires the following:

The required functions are as follows. Do not change these prototypes without first obtaining permission.

The first three functions should be the only direct interface to the pins (i.e., only references to PORTx, PINx should be within these first three functions).

Robot Command

void command_robot(uint8_t command)

where command is an integer in the range of [0 .. 6] as defined in project 1. Note that unit8_t is an 8-bit unsigned integer.

Turret Command

void command_turret(uint8_t command)

where command is an integer in the range of [0 .. 2] as defined in project 1.

Sensor Reading

void read_sensors(uint8_t sensor[4])

After the call to this function, sensor[i] will contain the value corresponding to infrared sensor i (values will be in the range of [0 .. 3]).

Tracking the Beacon

uint8_t track_beacon(uint8_t sensor[4])

The array sensor[4] is an input to this function. If at least one of the forward sensors is receiving a signal, then this function will command the robot to turn to and move toward the beacon (implementing the key logic that you designed for project 1). In this case, a 1 will be returned.

Otherwise (no signals), the function does not change the command state of the robot and will return a 0.

In either case, this function should return quickly (and not do any sleeping)

Orienting Toward a New Beacon

uint8_t orient_new_beacon(uint8_t sensor[4])

We will assume that when this function is called, the robot is already oriented toward a beacon (the beacon is in front of the robot), and a second beacon has been located to either the left or the right. This function should only return once the robot is facing the second beacon.

Notes:


Part 2: Finite State Machine

Due: March 30th at 5:00

You must complete the following steps:

  1. Design

  2. Implementation
  3. Demonstrate your working code.

  4. Hand-in your code, your group report, and your personal report through D2L.


Hints


Robot Interface

The interface to the robot is identical to that which you used in project 1.


What to Hand In

Project Report

Your report should include the following: The reports are due at 5:00 on March 30th. Please turn these in using the D2L dropbox (one copy per group) in either postscript or pdf format.

Personal Reports

Your personal report must include the following information: The personal reports are due at 5:00 on March 30th. These must be turned in via D2L in raw text format.


fagg at ou.edu

Last modified: Tue Mar 21 14:39:26 2006