From f0ccf37dce1373d0e3ca70a68772de98ed67d995 Mon Sep 17 00:00:00 2001 From: schodet Date: Wed, 27 Apr 2005 18:37:57 +0000 Subject: Modif des compteurs. Modif de Taz. --- n/asserv/src/taz.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'n/asserv/src/taz.c') diff --git a/n/asserv/src/taz.c b/n/asserv/src/taz.c index 3980ca5..f615ed0 100644 --- a/n/asserv/src/taz.c +++ b/n/asserv/src/taz.c @@ -22,14 +22,21 @@ * Email: * }}} */ -/** FSM state. */ +/** FSM state & substate. */ uint8_t taz_state; uint8_t taz_substate; +/** FSM tempo. */ uint8_t taz_tempo; +/** FSM max state & substate. */ +uint8_t taz_max_state = 0xff; +uint8_t taz_max_substate; + /** Positions. */ //#define taz_scale (1.0/0.05026548245743669181) //#define taz_scale (1.0/.05090591755319148936) -#define taz_scale (1.0/.05132374757503138194) +//#define taz_scale (1.0/.05132374757503138194) +#define taz_scale (1.0/.05124525981346725427) +static const uint32_t taz_rear_angle = 0x00ff90bf; static const uint16_t taz_rear_16 = taz_scale * 270 / 2; static const uint32_t taz_rear_32 = taz_scale * 270 / 2 * 256; static const uint16_t taz_front_16 = taz_scale * 270 / 2; @@ -37,11 +44,12 @@ static const uint32_t taz_front_32 = taz_scale * 270 / 2 * 256; static const uint16_t taz_side_16 = taz_scale * 340 / 2; static const uint32_t taz_side_32 = taz_scale * 340 / 2 * 256; -static const uint16_t taz_start_y_16 = taz_scale * (450 - 50) / 2; +static const uint16_t taz_start_y_16 = taz_scale * 450 / 2; static const uint16_t taz_before_bridge_16 = taz_scale * 1200; -static const uint16_t taz_brige_interval_16 = taz_scale * 140; -#define OR2 (1500 + 22 + 600 + 22) +static const uint16_t taz_brige_interval_16 = taz_scale * 150; +//#define OR2 (1500 + 22 + 600 + 22) +#define OR2 (1500 + 600) static const uint16_t taz_after_bridge_16[4] = { taz_scale * (OR2), @@ -96,6 +104,7 @@ taz_state_0 (void) { taz_substate = 2; /* FTW. */ + speed_restart (); motor_mode = 2; goto_mode = 10; goto_s = -10; @@ -245,7 +254,7 @@ taz_state_1 (void) taz_substate = 6; /* Recalage. */ speed_restart (); - postrack_y = taz_rear_32; + postrack_y = -taz_rear_32; postrack_a = 0x00c00000; /* On avance juste qu'à l'y de traversée de pont. */ motor_mode = 2; @@ -424,6 +433,9 @@ taz_update (void) uint8_t old_state, old_substate; old_state = taz_state; old_substate = taz_substate; + if (taz_state > taz_max_state + || (taz_state == taz_max_state && taz_substate > taz_max_substate)) + return; if (taz_tempo) { taz_tempo--; -- cgit v1.2.3