Revision 1508
Making bom_get_vector() function which should eventually be placed into the library.
trunk/code/behaviors/formation_control/push_pull/main.c | ||
---|---|---|
1 | 1 |
#include <dragonfly_lib.h> |
2 | 2 |
#include <wl_basic.h> |
3 |
#include <stdint.h> |
|
3 | 4 |
|
5 |
/* Struct for storing vector components */ |
|
6 |
typedef struct { |
|
7 |
uint8_t x; |
|
8 |
uint8_t y; |
|
9 |
} Vector; |
|
10 |
|
|
11 |
|
|
12 |
/* Function Prototypes */ |
|
13 |
static const Vector get_bom_vector(); |
|
14 |
|
|
15 |
|
|
16 |
/******************************* |
|
17 |
* BOM Vector Component Tables * |
|
18 |
*******************************/ |
|
19 |
|
|
4 | 20 |
/* |
5 | 21 |
* The x component of each BOM detector (indexed from 0 to 15) |
6 | 22 |
* was calculated using the following formula: |
... | ... | |
11 | 27 |
* this effectively calculates the x component of the emitter vector where |
12 | 28 |
* emitter 0 corresponds to an angle of 0 radians, 4 -> pi/2, 8 -> pi, ect. |
13 | 29 |
*/ |
14 |
static signed int x_comp[16] = { |
|
30 |
static const signed int x_comp[16] = {
|
|
15 | 31 |
100, |
16 | 32 |
92, |
17 | 33 |
71, |
... | ... | |
60 | 76 |
-38 |
61 | 77 |
}; |
62 | 78 |
|
79 |
|
|
80 |
|
|
63 | 81 |
int main (void) { |
64 | 82 |
|
65 | 83 |
/* Store current BOM readings and use them as a weighting factor */ |
... | ... | |
123 | 141 |
usb_puti(normalized_net_y_comp); |
124 | 142 |
usb_puts("\n"); |
125 | 143 |
|
126 |
delay_ms(500);
|
|
144 |
delay_ms(50); |
|
127 | 145 |
|
128 | 146 |
} |
129 | 147 |
|
130 | 148 |
while(1); |
131 | 149 |
|
132 | 150 |
} |
151 |
|
|
152 |
|
|
153 |
static Vector get_bom_vector() { |
|
154 |
|
|
155 |
} |
Also available in: Unified diff