Revision 1988
This is a working version of the code for the demo. It works on Bot 7, and partially on Bot 14. Due to the number of changes here, I'll list them by file:
traffic_navigation.h
I added a #define for sendGraph, so its main won't be compiled unless defined. Uncomment the #define line at the top of this file to turn its main on. Make sure you also comment out the #define for main-new. Also, has the new #define for the node wireless packet type.
readSerial.sh
I changed the output to print to stdout, instead of a file.
sendGraph.c
sendGraph.h
I modified the struct that stores and sends node data so it has a wireless packet type (80), and is 1 byte larger to hold it.
validTurns.c
One of the intersections on the map was placed incorrectly, and the robot drives off the line if it gets there. I added 2 if statements to control how the robot turns if it is at that intersection. The intersection has barcode numbers 13 and 16.
Makefile
I changed the target to main-new because that was what I was testing. If you're testing something else, make sure you change this line.
main-new.c
I changed the speed at which the robot drives at. I lowered it from 200 to 180, although this value depends on which bot it was used on. I also changed all of Alex's #ifdef debugging code into #define that takes up less space and makes the code look cleaner.
validTurns.c | ||
---|---|---|
64 | 64 |
int intersect_type; |
65 | 65 |
int intersect_pos; |
66 | 66 |
intersect_type = getIntersectType(barcode); |
67 |
switch (intersect_type) |
|
67 |
//TEMPORARY CODE FOR TEST MAP |
|
68 |
//INTERSECTION 2 (barcodes 13 and 16) was made incorrectly |
|
69 |
//If the bot reads barcode 16, it must turn left |
|
70 |
//If the bot reads barcode 13, it must go straight |
|
71 |
if(barcode == 16){ |
|
72 |
return ILEFT; |
|
73 |
} |
|
74 |
if(barcode == 13){ |
|
75 |
return ISTRAIGHT; |
|
76 |
} |
|
77 |
//END TEMP CODE |
|
78 |
|
|
79 |
switch (intersect_type) |
|
68 | 80 |
{ |
69 | 81 |
case DOUBLE_C: |
70 | 82 |
{ |
Also available in: Unified diff