Software

The control system used in the P.A.C.M.A.N. project was an Altera DE-2 Development Board with a Cyclone II FPGA. The software (or, more precisely, firmware) was written primarily in the VHSIC Hardware Design Language (VHDL). This language is structured such that bodies of code are grouped into modules that can be connected and graphically "wired together" in the Quartus II development environment.

Primary Modules

  • WiiCameras - Communicates via I2C to the Wii cameras
  • Odometry - Calculates absolute vehicle position and heading from wheel encoders
  • QueueBlock - Determines from the above two the path to follow and stores waypoints
  • CarCommander - Uses the outputs of the QueueBlock to control turning and throttle

WiiCameras

The WiiCameras module is, internally, a large state machine that maintains the current state of communications with each of the Wii remote cameras. It also is responsible for comparing the infrared "blobs" that are reported by the cameras with one another to determine if any vertical pairs exist, how far such a pair would be from the car and at what angle, and provide priority to more sensible pair possibilities and the centermost camera. The PDR presentation contains a slide that explains the distance and angle proportions in great detail.

Odometry

The Odometry module is fed by the pulse trains from the rear wheel encoders. These wheel encoders produce gray code (see PDR presentation) which are counted individually and compared by the Odometry module on a regular basis to determine how far the ACV has traveled in the X and Y direction as well as the change in heading for the ACV. It maintains an absolute coordinate system fixed where the ACV starts up or is reset, and can travel over 4000km before rolling over.

QueueBlock

The QueueBlock module maintains internally a 10-waypoint queue which is used for path following. At a rate of 3 times per second, the position reported by the WiiCameras module is translated into the relative coordinate system used by the queue (in which each waypoint is relative to the one preceding it) and added to the queue if it is not full. Whenever the odometry updates, the queue also updates a local "current position" which is relative to the last waypoint to have been passed by the ACV. The next waypoint and the current position are reported by this module for use in CarCommander.

CarCommander

The CarCommander module uses the current heading from the Odometry module with the next waypoint and current position from the QueueBlock module to determine the heading and distance to the next waypoint. Because the inputs to this module are constantly updated as positions change and as waypoints are reached, it operates entirely without internal state.