20100416
[aversive.git] / projects / microb2010 / mainboard / strat.h
index add640a..0a31073 100644 (file)
 #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
 /*
  *
  *
- *
- *
- *     +------------------------------------+
- *     |                                   |
- *     |                                   |
- *     |                                   |
- *     |                                   | 
- *  y  |                                   |
- *     |                                   |  
- *     |------                       ------| 
- *     |     |                       |     | 
- *     |     |                       |     | 
- *     +-----+------------------------+-----+
- *                       x
+ *           vertical lines
+ *            O     1     2     3     4     5
+ * 2100 +-----|-----|-----|-----|-----|-----|-----+
+ *      |        o           o           o        |
+ *      |  o           o           o           o  |   diag
+ *      |        o           o           o        |   lines
+ *     0/  o           o           o           o  \0
+ *  y   |        o                       o        |
+ *     1/  o                                   o  \1
+ *      |                                         |
+ *     2/------                             ------\2
+ *      |     |                             |     |
+ *      |     |                             |     |
+ *   0  +-----+-----------------------------+-----+
+ *     0                  x                      3000
  */
 
 /* useful traj flags */
 #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 bbox {
+struct strat_bbox {
        int32_t x1;
        int32_t y1;
        int32_t x2;
        int32_t y2;
 };
 
-struct conf {
+struct strat_conf {
 #define STRAT_CONF_XXX   0x01
        uint8_t flags;
 };
 
+struct strat_status {
+#define STRAT_STATUS_LHARVEST 0x01
+#define STRAT_STATUS_RHARVEST 0x02
+       uint8_t flags;
+};
+
 /* all infos related to strat */
 struct strat_infos {
        uint8_t dump_enabled;
-       struct conf conf;
-       struct bbox area_bbox;
+       struct strat_conf conf;
+       struct strat_bbox area_bbox;
+       struct strat_status status;
 };
 extern struct strat_infos strat_infos;