-
-#ifdef TEST_BEACON
-
-#define BEACON_MAX_SAMPLES 100
-struct beacon_sample {
- int16_t posx;
- int16_t posy;
- int16_t posa;
- int16_t oppx;
- int16_t oppy;
- uint8_t time;
-};
-
-static struct beacon_sample beacon_sample[BEACON_MAX_SAMPLES];
-static uint8_t beacon_prev_time = 0;
-static uint8_t beacon_cur_idx = 0;
-
-static void beacon_update_samples(void)
-{
- int16_t opp_a, opp_d, opp_x, opp_y;
- int8_t err;
- uint8_t time;
-
- time = time_get_s();
-
- /* one sample per second max */
- if (time <= beacon_prev_time)
- return;
- /* limit max number of samples */
- if (beacon_cur_idx >= BEACON_MAX_SAMPLES)
- return;
-
- memset(&beacon_sample[beacon_cur_idx], 0, sizeof(beacon_sample[beacon_cur_idx]));
- beacon_prev_time = time;
- beacon_sample[beacon_cur_idx].time = time;
-
- /* get opponent pos; if not found, just set struct to 0 */
- err = get_opponent_xyda(&opp_x, &opp_y, &opp_d, &opp_a);
- if (err == -1)
- return;
-
- beacon_sample[beacon_cur_idx].posx = position_get_x_s16(&mainboard.pos);
- beacon_sample[beacon_cur_idx].posy = position_get_y_s16(&mainboard.pos);
- beacon_sample[beacon_cur_idx].posa = position_get_a_deg_s16(&mainboard.pos);
- beacon_sample[beacon_cur_idx].oppx = opp_x;
- beacon_sample[beacon_cur_idx].oppy = opp_y;
- beacon_cur_idx++;
-}
-
-void beacon_dump_samples(void)
-{
- uint16_t i;
-
- for (i=0; i<BEACON_MAX_SAMPLES; i++) {
- printf_P(PSTR("%d: pos=(%d,%d,%d) opp=(%d,%d) time=%d\r\n"),
- i,
- beacon_sample[i].posx,
- beacon_sample[i].posy,
- beacon_sample[i].posa,
- beacon_sample[i].oppx,
- beacon_sample[i].oppy,
- beacon_sample[i].time);
- }
-}
-#endif
-
-struct strat_infos strat_infos = {
- /* conf */
- .conf = {
- .flags = 0,
- /* scanner disabled by default */
- .scan_opp_min_time = 90,
- .delay_between_opp_scan = 90,
- .scan_our_min_time = 90,
- .delay_between_our_scan = 90,
- .wait_opponent = 0,
- .lintel_min_time = 0,
- .scan_opp_angle = -1,
- },
-
- /* static columns */
- .s_cols = {
- .flags = 0,
- .configuration = 0,
- },
-
- /* column dispensers ; be carreful, positions are
- * color-dependent, so COLOR_Y() and COLOR_A() should be
- * used. All angles here are _absolute_ */
- .c1 = {
- .checkpoint_x = 2711 - COL_SCAN_PRE_MARGIN,
- .checkpoint_y = AREA_Y - COL_DISP_MARGIN,
- .scan_left = 0,
- .scan_a = 180,
- .eject_a = 180,
- .recalib_x = 2711,
- .recalib_y = AREA_Y - (ROBOT_LENGTH/2 + DIST_BACK_DISPENSER),
- .pickup_a = 90,
- .name = "col_disp1",
- },
- .c2 = {
- .checkpoint_x = AREA_X - COL_DISP_MARGIN,
- .checkpoint_y = 800 - COL_SCAN_PRE_MARGIN,
- .scan_left = 1,
- .scan_a = -90,
- .eject_a = -90,
- .recalib_x = AREA_X - (ROBOT_LENGTH/2 + DIST_BACK_DISPENSER),
- .recalib_y = 800,
- .pickup_a = 0,
- .name = "col_disp2",
- },
- .c3 = {
- .checkpoint_x = AREA_X-COL_DISP_MARGIN,
- .checkpoint_y = 1300 + COL_SCAN_PRE_MARGIN,
- .scan_a = 90,
- .scan_left = 0,
- .eject_a = -90,
- .recalib_x = AREA_X - (ROBOT_LENGTH/2 + DIST_BACK_DISPENSER),
- .recalib_y = 1300,
- .pickup_a = 0,
- .name = "col_disp3",
- },
-
- /* lintel dispensers */
- .l1 = {
- .x = 912, /* XXX for red only */
- .name = "lin_disp1",
- },
- .l2 = {
- .x = 1312, /* XXX for red only */
- .name = "lin_disp2",
- },
-
- /* build zones */
- .zone_list = {
-#define ZONE_DISC_NUM 0
- {
- .flags = ZONE_F_VALID | ZONE_F_DISC,
- .level = 2,
- .checkpoint_x = 0,
- .checkpoint_x = 0,
- .name = "disc",
- },
-#define ZONE_1A_NUM 1
- {
- .flags = ZONE_F_VALID,
- .level = 1,
- .checkpoint_x = 1385,
- .checkpoint_y = 1700,
- .name = "z1a",
- },
-#define ZONE_1B_NUM 2
- {
- .flags = ZONE_F_VALID,
- .level = 1,
- .checkpoint_x = 1615,
- .checkpoint_y = 1700,
- .name = "z1b",
- },
-#define ZONE_0B_NUM 3
- {
- .flags = ZONE_F_VALID,
- .level = 0,
- .checkpoint_x = 2100,
- .checkpoint_y = 1700,
- .name = "z0b",
- },
-#define ZONE_0A_NUM 4
- {
- .flags = ZONE_F_VALID,
- .level = 0,
- .checkpoint_x = 900,
- .checkpoint_y = 1700,
- .name = "z0a",
- },
- }
-};