software design considerations. abstract design and build a compact robot to traverse a maze use...

19
COST ROBOT CAROLINE TRIPPEL Software Design Considerations

Upload: jaime-cunnington

Post on 14-Dec-2015

219 views

Category:

Documents


1 download

TRANSCRIPT

COST ROBOTCAROLINE TRIPPEL

Software Design Considerations

Abstract

Design and build a compact robot to traverse a maze

Use the robot to generate an ASCII representation of the entire maze

Mark light locations on map as they are discovered

Revisit lights intelligently throughout the maze in a user-defined order

Software Design Considerations

PIC18F4550 Microcontroller InterfacesGeneral Purpose I/OA/D sensorsPWM motor controlCommunication with compass via I2CData transfer via USB

“Flag”-driven Design Embedded C

General Purpose I/O

5 registers for general purpose I/O PORTx registers refer to pin TRISx registers:

0 – output1 – input

3X Single-colored LEDs 1X RGB LED (3 pins) 2X Pushbuttons 4X Motor direction control

A/D Sensors

13 A/D Channels Conversion process

Set channel to corresponding ANx pinSet GO_DONE bit to 1Conversion complete when GO_DONE bit = 0

1X RGB Color Sensor (3 pins) 3X Short-range sensor 1X Long-range sensor

PWM

PWM enable by setting bits 2 and 3 of the CCPxCON registerCCP1CCP2

Motor speed control Alter duty cycle to change speed

I2C / USB

Communication between compass and microcontroller via I2C

Data transfer to computer with USBByte-by-byte transfer of dataData structure decoded by PC

Flowchart for Main Loop

Power On / User Input

Power On / User Input

Maze Mapping

Maze Mapping

Maze Mappingtypedef struct _mazeNode {

/* bits 7-5: 000 = normal node 001 = red 010 = green 011 = blue bits 4-0: location from -10 to 10*/

char locX; // holds X location char locY; // holds Y location

// holds the path description /* bits 7 & 6: 00 = nothing 01 = entrance 10 = return 11 = unused

bits 5-0: index of the next node in mazeNode array */ char Npath; char Spath; char Epath; char Wpath;} mazeNode;

Tremaux’s Algorithm

Tremaux’s Algorithm

[1] Tremaux’s Algorithm

Revisit Lights / USB Transfer

Revisit Lights / USB Transfer

Hierarchical Block Diagram of Code Organization

References

[1] David B Suits, “Playing With Mazes,” Rochester, NY, 1994