extern struct rooms[256];
extern int roomcount;

extern int currentportal, targetportal, navtarget; 
struct room {
	int id;
	char* name;
	struct wall* walls;
	int cost;
};

struct wall {
	int id;
	double long1, lat1;
	double long2, lat2;
	int cost;
	struct room* portal;			// NULL if it is a wall
	struct wall* nextwall;			// NULL if this is the last wall
};

struct path {
	struct wall* portal;
	struct path* next;			// NULL if this is the last portal in the path (ie, the destination)
};

struct disk_room {
	int id;
	char name[256];
	int cost;
	int count;				// count of walls
	// FOLLOWING THIS, we write out count walls to the file, and read in that many walls for this room.
};

struct disk_wall {
	int id;
	double long1, lat1;
	double long2, lat2;
	int portal;				// Link to the disk_room->id: -1 if this is NOT a portal, but JUST A wall.
	int cost;
};

extern path findpath(int start, int finish);            // returns ??? when impossible

extern void servo_turn(int direction);			// range: -127 <-> +127 where -127 is full left, and 127 is full right
extern void servo_speed(int speed);			// range: -127 <-> +127 where -127 is full reverse, and 127 is full forward
extern void servo_update();				// update PWM - needs to be called at 50hz. apparently 1ms->2ms wide pulses

extern void steering_check();				// check to make sure that we are steering in the right direction

extern void speed_check();				// check to make sure that speed is appropriate (ie, don't tip over during turns, etc)

extern void find_path();

extern void target_room(const char* room);

extern void load_from_file(char* filename);

extern void open_pipe();				// For incoming data
extern void check_pipe();				// ""  ""       ""

extern void gps_update(struct portal* portal);

extern int main(int argc, char** argv);
