Revision 1504
Updated comments to correctly reflect the meaning of the x and y
coordinates.
main.c | ||
---|---|---|
65 | 65 |
/* Store current BOM readings and use them as a weighting factor */ |
66 | 66 |
int intensity[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
67 | 67 |
|
68 |
/* Arrays for storing the weighted x ("Forwardness") and y ("Rightedness")
|
|
68 |
/* Arrays for storing the weighted x ("Rightness") and y ("Forwardness")
|
|
69 | 69 |
* components. Calculated by multiplying the intensity by the x and y |
70 |
* component respectively (stored in the tables above). */ |
|
70 |
* component respectively (x and y components are stored in the tables |
|
71 |
* above). */ |
|
71 | 72 |
int weighted_x_comp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
72 | 73 |
int weighted_y_comp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
73 | 74 |
|
74 |
/* Accumulators to sum up the net x ("Forwardness") and y ("Rightedness")
|
|
75 |
/* Accumulators to sum up the net x ("Rightness") and y ("Forwardness")
|
|
75 | 76 |
* components for the entire robot. */ |
76 | 77 |
long net_x_comp = 0; |
77 | 78 |
long net_y_comp = 0; |
... | ... | |
102 | 103 |
|
103 | 104 |
bom_refresh(BOM_ALL); |
104 | 105 |
for (i = 0; i < 16; i++) { |
106 |
/* BOM intensity is actually measured as more intense = closer to 0 */ |
|
105 | 107 |
intensity[i] = 255 - bom_get(i); |
106 | 108 |
weighted_x_comp[i] = intensity[i] * x_comp[i]; |
107 | 109 |
weighted_y_comp[i] = intensity[i] * y_comp[i]; |
Also available in: Unified diff