2 * Copyright Droids Corporation, Microb Technology (2009)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: strat_utils.h,v 1.5 2009-11-08 17:24:33 zer0 Exp $
28 /* wait traj end flag or cond. return 0 if cond become true, else
29 * return the traj flag */
30 #define WAIT_COND_OR_TRAJ_END(cond, mask) \
33 while ( (! (cond)) && (__err == 0)) { \
34 __err = test_traj_end(TRAJ_FLAGS_NO_NEAR); \
39 int16_t distance_between(int16_t x1, int16_t y1, int16_t x2, int16_t y2);
40 int16_t distance_from_robot(int16_t x, int16_t y);
41 int16_t simple_modulo_360(int16_t a);
42 int16_t angle_abs_to_rel(int16_t a_abs);
43 void rel_da_to_abs_xy(double d_rel, double a_rel_rad, double *x_abs, double *y_abs);
44 double norm(double x, double y);
45 void rel_xy_to_abs_xy(double x_rel, double y_rel, double *x_abs, double *y_abs);
46 void abs_xy_to_rel_da(double x_abs, double y_abs, double *d_rel, double *a_rel_rad);
47 void rotate(double *x, double *y, double rot);
48 uint8_t is_in_area(int16_t x, int16_t y, int16_t margin);
49 uint8_t robot_is_in_area(int16_t margin);
50 uint8_t robot_is_near_disc(void);
51 uint8_t y_is_more_than(int16_t y);
52 uint8_t x_is_more_than(int16_t x);
53 int16_t fast_sin(int16_t deg);
54 int16_t fast_cos(int16_t deg);
55 uint8_t get_color(void);
56 uint8_t get_opponent_color(void);
57 int8_t get_opponent_xy(int16_t *x, int16_t *y);
58 int8_t get_opponent_da(int16_t *d, int16_t *a);
59 int8_t get_opponent_xyda(int16_t *x, int16_t *y, int16_t *d, int16_t *a);
60 uint8_t opponent_is_behind(void);
62 uint8_t get_ball_count(void);
63 uint8_t get_cob_count(void);