From 3c39fcfa75ee61b2c823f96d57ecb0891062d5d0 Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Thu, 1 May 2008 02:35:40 +0200 Subject: * digital/io/src - add flag for homologation to stop the bot when it finds an obstacle rather than trying to avoid it. --- digital/io/src/main.c | 15 +++++++++++++++ digital/io/src/main.h | 6 ++++++ digital/io/src/move_cb.c | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'digital/io/src') diff --git a/digital/io/src/main.c b/digital/io/src/main.c index b40eefd5..7d323ea6 100644 --- a/digital/io/src/main.c +++ b/digital/io/src/main.c @@ -75,6 +75,12 @@ uint8_t main_post_event_for_top_fsm = 0xFF; */ uint16_t main_sharp_ignore_event; +/** + * Flag for homologation, to disable the path finding and always stop in front + * of an obstacle and wait. + */ +uint8_t main_always_stop_for_obstacle; + /** * Post an event for the main loop to wake up the move FSM in a certain count * of cycles. @@ -571,6 +577,15 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) } } break; + case c ('o', 1): + { + /* Omo-logo-ation flag, to prevent avoiding obstacle and stop + * instead. + * - 1b: state of the flag (0 to disable, 1 to enable). + */ + main_always_stop_for_obstacle = args[0]; + } + break; default: /* Unknown commands */ proto_send0 ('?'); diff --git a/digital/io/src/main.h b/digital/io/src/main.h index 96efb10a..51ab2c9a 100644 --- a/digital/io/src/main.h +++ b/digital/io/src/main.h @@ -48,4 +48,10 @@ extern uint16_t main_sharp_ignore_event; */ extern uint16_t main_move_wait_cycle; +/** + * Flag for homologation, to disable the path finding and always stop in front + * of an obstacle and wait. + */ +extern uint8_t main_always_stop_for_obstacle; + #endif /* main_h */ diff --git a/digital/io/src/move_cb.c b/digital/io/src/move_cb.c index 6490ba7c..de7ce204 100644 --- a/digital/io/src/move_cb.c +++ b/digital/io/src/move_cb.c @@ -101,7 +101,7 @@ move_get_next_position (move_position_t *dst) path_update (); /* Retrieve next path coordinate */ - if (!path_get_next (&dst->x, &dst->y)) + if (main_always_stop_for_obstacle || !path_get_next (&dst->x, &dst->y)) { DPRINTF ("Could not compute any path to avoid obstacle!\n"); return 0; -- cgit v1.2.3