summaryrefslogtreecommitdiffhomepage
path: root/digital
diff options
context:
space:
mode:
authorNicolas Schodet2010-04-13 00:22:08 +0200
committerNicolas Schodet2010-04-13 00:22:08 +0200
commitd91aa09bc6744ae8181b8507162c0c0ba94b2f93 (patch)
tree54b770a665724e521406425575eb4b4109466189 /digital
parenta7005814750c04d6e14186760e17effa1fde6898 (diff)
digital/io/src: update robot size
Diffstat (limited to 'digital')
-rw-r--r--digital/io/src/ai_init_cb.c11
-rw-r--r--digital/io/src/ai_move_cb.c2
-rw-r--r--digital/io/src/bot.h14
-rw-r--r--digital/io/src/init.h6
4 files changed, 17 insertions, 16 deletions
diff --git a/digital/io/src/ai_init_cb.c b/digital/io/src/ai_init_cb.c
index 1fb41b64..aa4d58df 100644
--- a/digital/io/src/ai_init_cb.c
+++ b/digital/io/src/ai_init_cb.c
@@ -109,8 +109,7 @@ ai__INIT_WAIT_FOR_HANDS_OUT__state_timeout (void)
fsm_branch_t
ai__INIT_GO_TO_THE_WALL__bot_move_succeed (void)
{
- /* We are against the border of absys Y set to PG_LENGTH. */
- asserv_set_y_position (PG_LENGTH - (BOT_LENGTH / 2));
+ asserv_set_y_position (PG_Y (PG_LENGTH - BOT_SIZE_FRONT));
return ai_next (INIT_GO_TO_THE_WALL, bot_move_succeed);
}
@@ -123,7 +122,7 @@ fsm_branch_t
ai__INIT_SET_Y_POSITION__asserv_last_cmd_ack (void)
{
/* We are facing top border. */
- asserv_set_angle_position (POSITION_A_DEG (90));
+ asserv_set_angle_position (PG_A_DEG (90));
return ai_next (INIT_SET_Y_POSITION, asserv_last_cmd_ack);
}
@@ -185,7 +184,7 @@ ai__INIT_WAIT_AFTER_ROTATION__state_timeout (void)
fsm_branch_t
ai__INIT_GO_TO_THE_WALL_AGAIN__bot_move_succeed (void)
{
- asserv_set_x_position (PG_X (BOT_LENGTH / 2));
+ asserv_set_x_position (PG_X (BOT_SIZE_FRONT));
return ai_next (INIT_GO_TO_THE_WALL_AGAIN, bot_move_succeed);
}
@@ -211,8 +210,8 @@ fsm_branch_t
ai__INIT_GO_AWAY_FROM_THE_WALL_AGAIN__bot_move_succeed (void)
{
/* Move away from the border. */
- asserv_goto_xya (PG_X (PG_START_ZONE_WIDTH - BOT_WIDTH / 2 - 50),
- PG_Y (PG_LENGTH - PG_START_ZONE_LENGTH + BOT_LENGTH / 2 + 50),
+ asserv_goto_xya (PG_X (PG_START_ZONE_WIDTH / 2),
+ PG_Y (PG_LENGTH - PG_START_ZONE_LENGTH / 2),
PG_A_DEG (0), 0);
return ai_next (INIT_GO_AWAY_FROM_THE_WALL_AGAIN, bot_move_succeed);
}
diff --git a/digital/io/src/ai_move_cb.c b/digital/io/src/ai_move_cb.c
index bfa033f6..ffd6f459 100644
--- a/digital/io/src/ai_move_cb.c
+++ b/digital/io/src/ai_move_cb.c
@@ -149,7 +149,7 @@ move_compute_obstacle_position (position_t cur, vect_t *obstacle)
angle = angle << 8;
/* Dirty fix: distance of the obstacle. */
- dist = BOT_LENGTH / 2 + 350;
+ dist = (BOT_SIZE_FRONT + BOT_SIZE_BACK) / 2 + 350;
/* Invert if last movement was backward. */
if (asserv_get_last_moving_direction () == 2)
{
diff --git a/digital/io/src/bot.h b/digital/io/src/bot.h
index 78e9a51f..6a9eef89 100644
--- a/digital/io/src/bot.h
+++ b/digital/io/src/bot.h
@@ -43,11 +43,15 @@
# define BOT_SCALE 0.0413530725332892
#endif
-/**
- * The size of the bot.
- */
-#define BOT_LENGTH 300
-#define BOT_WIDTH 310
+/** Distance from the robot axis to the front. */
+#define BOT_SIZE_FRONT 120
+/** Distance from the robot axis to the back. */
+#define BOT_SIZE_BACK (280 - 120)
+/** Distance from the robot axis to the side. */
+#define BOT_SIZE_SIDE (310 / 2)
+/** Distance from the robot axis to farthest corner, this is the radius of the
+ * circle needed when rotating. */
+#define BOT_SIZE_RADIUS 196
/**
* Distance required to be away from a border to be able to turn freely.
diff --git a/digital/io/src/init.h b/digital/io/src/init.h
index ef3074fb..1615a280 100644
--- a/digital/io/src/init.h
+++ b/digital/io/src/init.h
@@ -25,10 +25,8 @@
*
* }}} */
-/**
- * We want to be at 50mm.
- */
-#define INIT_DIST (PG_START_ZONE_LENGTH - BOT_LENGTH - 50)
+/** Backward distance from the wall. */
+#define INIT_DIST (PG_START_ZONE_LENGTH / 2 - BOT_SIZE_FRONT)
/**
* The match begin!