Project

General

Profile

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.

View differences:

sendGraph.h
1 1
#include "intersectData.h"
2
#include "traffic_navigation.h"
2 3

  
3 4
/* Data is sent in the following order
4 5
 * INT0_NUM OUTEDGE_0 OUTEDGE_1 ... \n
......
17 18

  
18 19
/* Representation of an intersection on the graph */
19 20
typedef struct {
20
	char type; 	/* Note that there are at most 5 intersection types */
21
	char packetType; 
22
  char type; 	/* Note that there are at most 5 intersection types */
21 23
	char intNum;	/* What is the intersection number */
22 24
	char numOut;	/* Note that we can have no more than 4 outgoing edges */
23 25
	char outSeen;	/* The number of the outgoing edges that we have seen for this intersection */
......
27 29
/* A union that is used in wireless transmissions */
28 30
typedef union  {
29 31
	node n;
30
	char array[12];
32
	char array[13];
31 33
}node_union;
32 34

  
33 35
/* This array holds all of the intersections that are represented in the graph

Also available in: Unified diff