X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fstrat.h;h=42b47dd224f13fd111f6d945a4d3cb65970aed6f;hp=add640a7100633998f1fe3eadfea37084e1cb608;hb=06813a0566192d90e1ad8c891dfb7cc55dedd525;hpb=1714f4ee916fca95ce24120ea6e698237913f947 diff --git a/projects/microb2010/mainboard/strat.h b/projects/microb2010/mainboard/strat.h index add640a..42b47dd 100644 --- a/projects/microb2010/mainboard/strat.h +++ b/projects/microb2010/mainboard/strat.h @@ -23,10 +23,10 @@ #define _STRAT_H_ /* convert coords according to our color */ -#define COLOR_Y(y) ((mainboard.our_color==I2C_COLOR_RED)? (y) : (AREA_Y-(y))) -#define COLOR_A(a) ((mainboard.our_color==I2C_COLOR_RED)? (a) : (-a)) -#define COLOR_SIGN(x) ((mainboard.our_color==I2C_COLOR_RED)? (x) : (-x)) -#define COLOR_INVERT(x) ((mainboard.our_color==I2C_COLOR_RED)? (x) : (!x)) +#define COLOR_Y(y) ((mainboard.our_color==I2C_COLOR_YELLOW)? (y) : (AREA_Y-(y))) +#define COLOR_A(a) ((mainboard.our_color==I2C_COLOR_YELLOW)? (a) : (-a)) +#define COLOR_SIGN(x) ((mainboard.our_color==I2C_COLOR_YELLOW)? (x) : (-x)) +#define COLOR_INVERT(x) ((mainboard.our_color==I2C_COLOR_YELLOW)? (x) : (!x)) /* area */ #define AREA_X 3000 @@ -42,23 +42,51 @@ #define CORNER_X 3000 #define CORNER_Y COLOR_Y(2100) +/* XXX these offset are not related to corn, but to waypoints */ +#define OFFSET_CORN_X 150 +#define OFFSET_CORN_Y 222 +#define STEP_CORN_X 225 +#define STEP_CORN_Y 250 + +#define CORN_NB 18 +#define TOMATO_NB 14 + +#define WAYPOINTS_NBX 13 +#define WAYPOINTS_NBY 8 + /* + * Corn position and lines * + * vertical lines + * O 1 2 3 4 5 + * 2100 +-----|-----|-----|-----|-----|-----|-----+ + * | c5 c9 c14 | + * | c2 c7 c11 c17 | diag + * | c4 c8 c13 | lines + * 0/ c1 c6 c10 c16 \0 + * y | c3 c12 | + * 1/ c0 c15 \1 + * |-----+ +-----| + * 2/ | | \2 + * | | | | + * 0 +-----+-----------------------------+-----+ + * 0 x 3000 * + * Ball (tomato) and i,j coords (for waypoints) * + * 2100 +--0--1--2--3--4--5--6--7--8--9-10-11-12--+ + * 7 t5 t9 | + * 6 t3 t7 t11 | + * 5 t1 t4 t8 t13 | + * 4 t2 t6 t10 | + * y 3 t0 t12 | + * 2 | + * 1-----+ +-----| + * 0 | | | + * | | | | + * 0 +-----+-----------------------------+-----+ + * 0 x 3000 * - * +------------------------------------+ - * | | - * | | - * | | - * | | - * y | | - * | | - * |------ ------| - * | | | | - * | | | | - * +-----+------------------------+-----+ - * x */ /* useful traj flags */ @@ -69,40 +97,30 @@ #define TRAJ_FLAGS_NO_NEAR_NO_TIMER (END_TRAJ|END_BLOCKING|END_OBSTACLE|END_INTR) #define TRAJ_FLAGS_SMALL_DIST (END_TRAJ|END_BLOCKING|END_INTR) +/* default acc */ +#define ACC_DIST 10. +#define ACC_ANGLE 10. + /* default speeds */ -#define SPEED_DIST_FAST 2500 -#define SPEED_ANGLE_FAST 2000 -#define SPEED_DIST_SLOW 1000 -#define SPEED_ANGLE_SLOW 1000 -#define SPEED_DIST_VERY_SLOW 400 -#define SPEED_ANGLE_VERY_SLOW 400 +#define SPEED_DIST_FAST 2500. +#define SPEED_ANGLE_FAST 2000. +#define SPEED_DIST_SLOW 1000. +#define SPEED_ANGLE_SLOW 1000. +#define SPEED_DIST_VERY_SLOW 400. +#define SPEED_ANGLE_VERY_SLOW 400. /* strat infos structures */ +struct strat_conf { + uint8_t dump_enabled; -struct bbox { - int32_t x1; - int32_t y1; - int32_t x2; - int32_t y2; -}; - -struct conf { #define STRAT_CONF_XXX 0x01 uint8_t flags; }; -/* all infos related to strat */ -struct strat_infos { - uint8_t dump_enabled; - struct conf conf; - struct bbox area_bbox; -}; -extern struct strat_infos strat_infos; +extern struct strat_conf strat_conf; /* in strat.c */ -void strat_dump_infos(const char *caller); /* show current known state - of area */ -void strat_dump_conf(void); +void strat_conf_dump(const char *caller); void strat_reset_infos(void); /* reset current known state */ void strat_preinit(void); void strat_init(void);