From fd46754cbe5745febfdda1b366326228d5055e81 Mon Sep 17 00:00:00 2001 From: Filip Jares Date: Wed, 14 Apr 2010 19:36:42 +0200 Subject: [PATCH] remove obsolete code in robodim and update fill_in_known_areas_in_map() method --- src/robodim/robodim.c | 67 ------------------------ src/robodim/robodim.h | 119 +++++++----------------------------------- src/robofsm/robot.c | 44 ++++------------ 3 files changed, 29 insertions(+), 201 deletions(-) diff --git a/src/robodim/robodim.c b/src/robodim/robodim.c index e57bc27d..8900e093 100644 --- a/src/robodim/robodim.c +++ b/src/robodim/robodim.c @@ -21,73 +21,6 @@ const struct beacon_pos beacon_red[BEACON_CNT] = { {-0.062, -0.05}, }; -/* - * EB2009: free puck positions - * 10 configurations given by ballot - * - */ -const char free_puck_present[][4][3] = { - { /* lot 1 */ - {1, 1, 1,}, - {0, 0, 0,}, - {0, 0, 0,}, - {1, 1, 1,}, - }, - { - {1, 0, 1,}, - {0, 0, 1,}, - {0, 0, 1,}, - {1, 0, 1,}, - }, - { - {1, 0, 1,}, - {0, 1, 0,}, - {0, 1, 0,}, - {1, 0, 1,}, - }, - { - {1, 0, 1,}, - {1, 0, 0,}, - {1, 0, 0,}, - {1, 0, 1,}, - }, - { - {1, 1, 0,}, - {0, 0, 1,}, - {0, 0, 1,}, - {1, 1, 0,}, - }, - { /* lot 6 */ - {1, 1, 0,}, - {0, 1, 0,}, - {0, 1, 0,}, - {1, 1, 0,}, - }, - { - {1, 1, 0,}, - {1, 0, 0,}, - {1, 0, 0,}, - {1, 1, 0,}, - }, - { - {1, 0, 0,}, - {0, 1, 1,}, - {0, 1, 1,}, - {1, 0, 0,}, - }, - { - {1, 0, 0,}, - {1, 0, 1,}, - {1, 0, 1,}, - {1, 0, 0,}, - }, - { - {1, 0, 0,}, - {1, 1, 0,}, - {1, 1, 0,}, - {1, 0, 0,}, - }, -}; /* * Ukrizovavse pak jej, rozdelili roucha jeho, mecice o ne los, aby se diff --git a/src/robodim/robodim.h b/src/robodim/robodim.h index baeeccfe..5d189d88 100644 --- a/src/robodim/robodim.h +++ b/src/robodim/robodim.h @@ -1,16 +1,16 @@ /* - * robodim_eb2008.h 08/04/18 + * robodim_eb2010.h * - * Dimensions for the robot, playground and other stuffs. - * Eurobot 2008 + * Dimensions for the robot, playground and other stuff. + * Eurobot 2010 * - * Copyright: (c) 2008 CTU Dragons + * Copyright: (c) 2010 CTU Dragons * CTU FEE - Department of Control Engineering * License: GNU GPL v.2 */ -#ifndef ROBODIM_EB2008_H -#define ROBODIM_EB2008_H +#ifndef ROBODIM_EB2010_H +#define ROBODIM_EB2010_H /** * FIXME: update robot's dimensions !!! @@ -34,7 +34,7 @@ * Sx - Sharp sensor */ -/* FIXME needs update (?) // comment added by Filip */ +/* FIXME update robot's dimensions!!! */ #define ROBOT_WIDTH_MM 290 /* W*/ #define ROBOT_WIDTH_M (ROBOT_WIDTH_MM/1000.0) #define ROBOT_ROTATION_RADIUS_MM (260/2) /* RR */ @@ -52,10 +52,6 @@ #define HOKUYO_CENTER_OFFSET_MM 170 #define HOKUYO_CENTER_OFFSET_M (HOKUYO_CENTER_OFFSET_MM/1000.0) -#define ROBOT_AXIS_TO_PUCK_M 0.2 // puck approach distance -#define PUCK_REACHABLE(x) ((x<0.13)?true:false) -#define PUCK_INSIDE(x) ((x<=0.055)?true:false) - /** * PLAYGROUND DIMENSIONS * @@ -64,107 +60,30 @@ * ^ | [W,H]| * | | | * | | | - * | |^ ^| - * | || G G G G G G || - * | || || - * | |O? G G G G G G || - * | || || - * H | R1+| G G G G G G |+ S1 - * | || || - * | || G G G G G G ?T| - * | || || - * | || || - * | |v v| * | | | * | | | - * v |[0,0] O S | + * | | | + * | | | + * | | | + * H | R1| |S1 + * | | | + * | | | + * | | | + * | | | + * | | | + * | | | + * | | | + * v |[0,0] | * +---------------------------------+---------------------------------+ * S3 R2 * <-----------------------------------------------------------------> * W - * - * G - grid for pucks - * O? - opponent's "travelling" dispenser - * O - opponent's static dispenser - * S - our static dispenser - * ?T - our travelling dispenser - * */ #define PLAYGROUND_WIDTH_MM 3000 #define PLAYGROUND_WIDTH_M (PLAYGROUND_WIDTH_MM/1000.0) #define PLAYGROUND_HEIGHT_MM 2100 #define PLAYGROUND_HEIGHT_M (PLAYGROUND_HEIGHT_MM/1000.0) -#define ACROPOLIS_CENTER_X (PLAYGROUND_WIDTH_M/2.0) -#define ACROPOLIS_CENTER_Y (PLAYGROUND_HEIGHT_M/2.0) -#define ACROPOLIS_RADIUS 0.15 -#define ACROPOLIS_DIAMETER (ACROPOLIS_RADIUS*2.0) - -/** - * PUCK DISPENSERS (= COLUMN ELEMENT DISPENSERS) - */ -#define STATIC_DISPENSER_X_OFFSET 0.289 -#define DISPENSER_TO_CUSHION_DISTANCE 0.04 -#define STATIC_DISPENSER_X (PLAYGROUND_WIDTH_M - STATIC_DISPENSER_X_OFFSET) -#define STATIC_DISPENSER_Y DISPENSER_TO_CUSHION_DISTANCE -#define TRAVELLING_DISPENSER_X (PLAYGROUND_WIDTH - DISPENSER_TO_CUSHION_DISTANCE) // in the "PLAYGROUND DIMENSIONS" ASCII art: O? -/* y coordinate of the travelling dispenser is not known in advance */ -#define OPPONENTS_STATIC_DISPENSER_X STATIC_DISPENSER_X_OFFSET // in the "PLAYGROUND DIMENSIONS" ASCII art: O -#define OPPONENTS_STATIC_DISPENSER_Y DISPENSER_TO_CUSHION_DISTANCE // in the "PLAYGROUND DIMENSIONS" ASCII art: O - -/** - * FREE PUCKS POSITIONS - */ -#define PUCK_GRID_X_OFFSET 0.6 -#define PUCK_GRID_Y_OFFSET 0.925 -#define PUCK_GRID_DELTA_X 0.25 -#define PUCK_GRID_DELTA_Y 0.2 -#define PUCK_GRID_ROWS_NUM 4 -#define PUCK_GRID_COLS_NUM 3 - -struct puck_pos { - float x, y; /* In meters */ -}; - -/* - * boolean: free_puck_present[lot][ny][nx] - */ -extern const char free_puck_present[10][4][3]; - -/* - * tells, whether a puck is placed in grid at nx, ny - * (lot=0..9, nx=0..2, ny=0..3) - */ -#define FREE_PUCK_PRESENT(lot,nx,ny) (free_puck_present[lot][y][x]) - -/* - * returns position of a free puck - * (nx=0..2, ny=0..3) - * - * !WARNING! The positions assume WE_ARE_GREEN - * The pucks are sorted according to growing x, y, - * ie. the nearest puck to the start position is @nx=0,ny=3 - * (yes, a stupid coord system...) - */ -static inline struct puck_pos free_puck_pos(int nx, int ny) { - struct puck_pos pos = {PUCK_GRID_X_OFFSET + nx*PUCK_GRID_DELTA_X, - PUCK_GRID_Y_OFFSET + ny*PUCK_GRID_DELTA_Y}; - return pos; -} - -/** - * BASKET - */ -#define BASKET_WIDTH 0.5 -#define BASKET_HEIGHT 0.34 -#define BASKET_VERT_OFFSET 0.35 - -#define BLUE_BASKET_TARGET_X PLAYGROUND_WIDTH_M -#define BLUE_BASKET_TARGET_Y (BASKET_WIDTH/2.0) - -#define RED_BASKET_TARGET_X 0 -#define RED_BASKET_TARGET_Y (BASKET_WIDTH/2.0) - /* * 3 ultrasonic beacons */ diff --git a/src/robofsm/robot.c b/src/robofsm/robot.c index 309cba65..69a344fb 100644 --- a/src/robofsm/robot.c +++ b/src/robofsm/robot.c @@ -61,42 +61,18 @@ static void int_handler(int sig) void fill_in_known_areas_in_map() { /* Do not plan path close to edges */ -/* ShmapSetRectangleFlag(0.0, 0.0, 0.199, 2.1, MAP_FLAG_WALL, 0); */ -/* ShmapSetRectangleFlag(0.0, 0.0, 3.0, 0.199, MAP_FLAG_WALL, 0); */ -/* ShmapSetRectangleFlag(0.0, 1.901, 3.0, 2.1, MAP_FLAG_WALL, 0); */ -/* ShmapSetRectangleFlag(2.801, 0.0, 3.0, 2.1, MAP_FLAG_WALL, 0); */ - - //ShmapSetRectangleFlag(0, 1.15, 0.4, 1.55, MAP_FLAG_IGNORE_OBST, 0); /* Left white vert. dispenser */ - //ShmapSetRectangleFlag(2.7, 1.25, 3, 1.45, MAP_FLAG_IGNORE_OBST, 0); /* Right white vert. dispenser */ - - //ShmapSetRectangleFlag(0.50, 1.8, 0.95, 2.2, MAP_FLAG_IGNORE_OBST, 0); /* Blue vert. dispenser */ - //ShmapSetRectangleFlag(2.30, 1.8, 2.55, 2.1, MAP_FLAG_IGNORE_OBST, 0); /* Red vert. dispenser */ + //ShmapSetRectangleFlag(0.0, 0.0, 0.199, 2.1, MAP_FLAG_WALL, 0); /* left */ + //ShmapSetRectangleFlag(0.0, 0.0, 3.0, 0.199, MAP_FLAG_WALL, 0); /* bottom */ + //ShmapSetRectangleFlag(0.0, 1.901, 3.0, 2.1, MAP_FLAG_WALL, 0); /* top */ + //ShmapSetRectangleFlag(2.801, 0.0, 3.0, 2.1, MAP_FLAG_WALL, 0); /* right */ /* Ignore other obstacles at edges */ - ShmapSetRectangleFlag(0.0, 0.0, 0.09, 2.1, MAP_FLAG_IGNORE_OBST, 0); /* left */ - ShmapSetRectangleFlag(0.0, 0.0, 3.0, 0.09, MAP_FLAG_IGNORE_OBST, 0); /* bottom */ - ShmapSetRectangleFlag(0.0, 2.01, 3.0, 2.1, MAP_FLAG_IGNORE_OBST, 0); /* top */ - ShmapSetRectangleFlag(2.91, 0.0, 3.0, 2.1, MAP_FLAG_IGNORE_OBST, 0); /* right */ - - //ShmapSetRectangleFlag(0.0, 0.0, 0.2, 0.6, MAP_FLAG_IGNORE_OBST, 0); /* left basket */ - //ShmapSetRectangleFlag(2.8, 0.0, 3.0, 0.6, MAP_FLAG_IGNORE_OBST, 0); /* right basket */ - - /* Construction areas (Building zones) */ - //ShmapSetRectangleFlag(ACROPOLIS_CENTER_X - ACROPOLIS_RADIUS, ACROPOLIS_CENTER_Y - ACROPOLIS_RADIUS, ACROPOLIS_CENTER_X + ACROPOLIS_RADIUS, ACROPOLIS_CENTER_Y + ACROPOLIS_RADIUS, MAP_FLAG_WALL, 0); /* Central construction area */ - //ShmapSetRectangleFlag(1.35, 0.9, 1.65, 1.2, MAP_FLAG_WALL, 0); /* Central construction area */ - - // Enclosure wall - ShmapSetRectangleFlag(0.0, 0.0, 0.199, 2.1, MAP_FLAG_WALL, 0); /* left */ - ShmapSetRectangleFlag(0.0, 0.0, 3.0, 0.199, MAP_FLAG_WALL, 0); /* bottom */ - ShmapSetRectangleFlag(0.0, 1.901, 3.0, 2.1, MAP_FLAG_WALL, 0); /* top */ - ShmapSetRectangleFlag(2.801, 0.0, 3.0, 2.1, MAP_FLAG_WALL, 0); /* right */ - // Bottom-middle unloading area - ShmapSetRectangleFlag(1.0, 0.0, 2.0, 0.3, MAP_FLAG_WALL, 0); /* bottom */ - // Unloading area - dwarf wall - ShmapSetRectangleFlag(0.4, 0.0, 0.8, 0.3, MAP_FLAG_WALL, 0); - ShmapSetRectangleFlag(2.2, 0.0, 2.6, 0.3, MAP_FLAG_WALL, 0); - // Acropolis wall - ShmapSetCircleFlag(ACROPOLIS_CENTER_X, ACROPOLIS_CENTER_Y, ACROPOLIS_DIAMETER + 0.09, MAP_FLAG_WALL, 0); + //ShmapSetRectangleFlag(0.0, 0.0, 0.09, 2.1, MAP_FLAG_IGNORE_OBST, 0); /* left */ + //ShmapSetRectangleFlag(0.0, 0.0, 3.0, 0.09, MAP_FLAG_IGNORE_OBST, 0); /* bottom */ + //ShmapSetRectangleFlag(0.0, 2.01, 3.0, 2.1, MAP_FLAG_IGNORE_OBST, 0); /* top */ + //ShmapSetRectangleFlag(2.91, 0.0, 3.0, 2.1, MAP_FLAG_IGNORE_OBST, 0); /* right */ + + ShmapSetRectangleFlag(0.74, 1.6, 2.259, 2.1, MAP_FLAG_WALL, 0); /* plateau, slopes */ } -- 2.39.2