From 18a1c04ba9b61d484c745b075bfbaad101629a2c Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 31 May 2011 22:34:26 +0200 Subject: digital/io-hub: add green zone width define --- digital/io-hub/src/robospierre/path.c | 6 ++--- digital/io-hub/src/robospierre/playground_2011.h | 33 ++++++++++++++++++++++++ digital/io-hub/src/robospierre/top.c | 4 +-- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 digital/io-hub/src/robospierre/playground_2011.h diff --git a/digital/io-hub/src/robospierre/path.c b/digital/io-hub/src/robospierre/path.c index bf6c2471..61ea9293 100644 --- a/digital/io-hub/src/robospierre/path.c +++ b/digital/io-hub/src/robospierre/path.c @@ -26,7 +26,7 @@ #include "defs.h" #include "path.h" #include "bot.h" -#include "playground.h" +#include "playground_2011.h" #include "modules/path/astar/astar.h" #include "modules/utils/utils.h" @@ -213,8 +213,8 @@ path_blocking (uint8_t a, uint8_t b, int16_t *dp) path_pos (b, &vb); /* Test for green zone. */ uint8_t a_green, b_green; - a_green = va.x < 400 || va.x > PG_WIDTH - 400; - b_green = vb.x < 400 || vb.x > PG_WIDTH - 400; + a_green = va.x < PG_GREEN_WIDTH_MM || va.x > PG_WIDTH - PG_GREEN_WIDTH_MM; + b_green = vb.x < PG_GREEN_WIDTH_MM || vb.x > PG_WIDTH - PG_GREEN_WIDTH_MM; if ((va.x < BOT_GREEN_ELEMENT_PLACE_DISTANCE_MM && vb.x > BOT_GREEN_ELEMENT_PLACE_DISTANCE_MM) || (va.x > BOT_GREEN_ELEMENT_PLACE_DISTANCE_MM diff --git a/digital/io-hub/src/robospierre/playground_2011.h b/digital/io-hub/src/robospierre/playground_2011.h new file mode 100644 index 00000000..a9963e34 --- /dev/null +++ b/digital/io-hub/src/robospierre/playground_2011.h @@ -0,0 +1,33 @@ +#ifndef playground_2011_h +#define playground_2011_h +/* playground_2011.h */ +/* robospierre - Eurobot 2011 AI. {{{ + * + * Copyright (C) 2011 Nicolas Schodet + * + * APBTeam: + * Web: http://apbteam.org/ + * Email: team AT apbteam DOT org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * }}} */ + +#include "playground.h" + +/** Width of a green zone. */ +#define PG_GREEN_WIDTH_MM 400 + +#endif /* playground_2011_h */ diff --git a/digital/io-hub/src/robospierre/top.c b/digital/io-hub/src/robospierre/top.c index 92e42b1c..5756d38e 100644 --- a/digital/io-hub/src/robospierre/top.c +++ b/digital/io-hub/src/robospierre/top.c @@ -24,7 +24,7 @@ * }}} */ #include "common.h" -#include "playground.h" +#include "playground_2011.h" #include "asserv.h" #define FSM_NAME AI @@ -69,7 +69,7 @@ struct top_t top_global; FSM_TRANS (TOP_START, init_start_round, TOP_GOING_OUT1) { element_init (); - asserv_goto (PG_X (400 + 100), PG_Y (PG_LENGTH - 200), 0); + asserv_goto (PG_X (PG_GREEN_WIDTH_MM + 100), PG_Y (PG_LENGTH - 200), 0); return FSM_NEXT (TOP_START, init_start_round); } -- cgit v1.2.3