Top Banner
COST ROBOT CAROLINE TRIPPEL Software Design Considerations
19

Software Design Considerations. Abstract Design and build a compact robot to traverse a maze Use the robot to generate an ASCII representation of.

Dec 14, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

COST ROBOTCAROLINE TRIPPEL

Software Design Considerations

Page 2: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

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

Page 3: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

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

Page 4: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

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

Page 5: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

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

Page 6: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

PWM

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

Motor speed control Alter duty cycle to change speed

Page 7: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

I2C / USB

Communication between compass and microcontroller via I2C

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

Page 8: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Flowchart for Main Loop

Page 9: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Power On / User Input

Page 10: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Power On / User Input

Page 11: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Maze Mapping

Page 12: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Maze Mapping

Page 13: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

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;

Page 14: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Tremaux’s Algorithm

Page 15: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Tremaux’s Algorithm

[1] Tremaux’s Algorithm

Page 16: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Revisit Lights / USB Transfer

Page 17: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Revisit Lights / USB Transfer

Page 18: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

Hierarchical Block Diagram of Code Organization

Page 19: Software Design Considerations. Abstract  Design and build a compact robot to traverse a maze  Use the robot to generate an ASCII representation of.

References

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