From bed39ab7e7b82dac49befaa9dcc6a672a64fe897 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 14 May 2012 13:29:47 +0200 Subject: digital/io-hub/src/guybrush: lower speed when approaching --- digital/io-hub/src/guybrush/bot.h | 2 ++ digital/io-hub/src/guybrush/top.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'digital') diff --git a/digital/io-hub/src/guybrush/bot.h b/digital/io-hub/src/guybrush/bot.h index b2dd2634..aef18b3b 100644 --- a/digital/io-hub/src/guybrush/bot.h +++ b/digital/io-hub/src/guybrush/bot.h @@ -58,5 +58,7 @@ #endif /** Normal cruise speed. */ #define BOT_SPEED_NORMAL 0x50, 0x60, 0x20, 0x20 +/** Approach speed. */ +#define BOT_SPEED_APPROACH 0x20, 0x30, 0x20, 0x20 #endif /* bot_h */ diff --git a/digital/io-hub/src/guybrush/top.c b/digital/io-hub/src/guybrush/top.c index a1cc246d..2197b0f3 100644 --- a/digital/io-hub/src/guybrush/top.c +++ b/digital/io-hub/src/guybrush/top.c @@ -152,6 +152,7 @@ top_go_unload (void) static uint8_t top_decision (void) { + asserv_set_speed (BOT_SPEED_NORMAL); uint8_t decision = strat_decision (&top.decision_pos); switch (decision) { @@ -218,6 +219,7 @@ FSM_TRANS (TOP_TOTEM_CLEAN_STARTING, clamps_ready, TOP_TOTEM_CLEAN_APPROACHING) { int16_t move = top.totem_distance - BOT_SIZE_LOWER_CLAMP_FRONT - 140; top.totem_distance -= move; + asserv_set_speed (BOT_SPEED_APPROACH); asserv_move_linearly (move); return FSM_NEXT (TOP_TOTEM_CLEAN_STARTING, clamps_ready); } @@ -343,6 +345,7 @@ FSM_TRANS (TOP_TOTEM_ERROR_GOING_BACK, move_failure, TOP_TOTEM_CLAMP_UPPING) FSM_TRANS (TOP_BOTTLE_GOING, move_success, TOP_BOTTLE_APPROACHING) { int16_t move = top.decision_pos.y - BOT_SIZE_BACK - 22 - 30; + asserv_set_speed (BOT_SPEED_APPROACH); asserv_move_linearly (-move); return FSM_NEXT (TOP_BOTTLE_GOING, move_success); } -- cgit v1.2.3