summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJérémy Dufour2008-05-01 02:35:40 +0200
committerJérémy Dufour2008-05-01 02:35:40 +0200
commit3c39fcfa75ee61b2c823f96d57ecb0891062d5d0 (patch)
tree0e04bce64af245864b159cfa96268fe080082ad5
parent27b286afcc596fee6c45f90190a2f67997732f3b (diff)
* digital/io/src
- add flag for homologation to stop the bot when it finds an obstacle rather than trying to avoid it.
-rw-r--r--digital/io/src/main.c15
-rw-r--r--digital/io/src/main.h6
-rw-r--r--digital/io/src/move_cb.c2
3 files changed, 22 insertions, 1 deletions
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
@@ -76,6 +76,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;