aboutsummaryrefslogtreecommitdiff
path: root/robot/mode_grid.h
blob: b13cc4cfe4647adf71920681311d38a5d51d0974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once

/** @file mode_grid.h */

/**
 * warehouse mode
 *
 * processes orders from the order buffer
 */

enum orientation{
    North,
    East,
    South,
    West
} direction;

typedef struct {
    int x;
    int y;
} coordinates;

coordinates order[4];
coordinates location;
coordinates destination;

char xLocation;
char yLocation;

//LINE 25-68 CAN BE TAKEN AWAY WHEN USED WITH MODE_MAZE

// The 3pi include file must be at the beginning of any program that
// uses the Pololu AVR library and 3pi.
#include <pololu/3pi.h>

// This include file allows data to be stored in program space.  The
// ATmega168 has 16k of program space compared to 1k of RAM, so large
// pieces of static data should be stored in program space.
#include <avr/pgmspace.h>

unsigned int sensors[5]; // an array to hold sensor values
unsigned int position;
// Introductory messages.  The "PROGMEM" identifier causes the data to
// go into program space.
const char welcome_line1[] PROGMEM = " Pololu";
const char welcome_line2[] PROGMEM = "3\xf7 Robot";
const char demo_name_line1[] PROGMEM = "PID Line";
const char demo_name_line2[] PROGMEM = "follower";

// A couple of simple tunes, stored in program space.
const char welcome[] PROGMEM = ">g32>>c32";
const char go[] PROGMEM = "L16 cdegreg4";

// Data for generating the characters used in load_custom_characters
// and display_readings.  By reading levels[] starting at various
// offsets, we can generate all of the 7 extra characters needed for a
// bargraph.  This is also stored in program space.
const char levels[] PROGMEM = {
    0b00000,
    0b00000,
    0b00000,
    0b00000,
    0b00000,
    0b00000,
    0b00000,
    0b11111,
    0b11111,
    0b11111,
    0b11111,
    0b11111,
    0b11111,
    0b11111
};

void w2_mode_grid();
void initialize();
void full_rotation();
void grid_rotation_left();
void grid_rotation_right();
void grid_crossway_detection();
void gridFollowLine();
void orderOne();
void orderTwo();
void orderThree();
void orderFour();
void beginLocation();
void turn_North();
void turn_West();
void turn_South();
void turn_East();
void locationMessage();
void arrivedMessage();