From 94ed449899985636256b5228d5e0f6bba5af2971 Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Thu, 1 May 2008 00:57:16 +0200 Subject: * digital/io/src - add a function to the sharp module to know if there is a obstacle in front of us (by taking in account the current moving direction of the bot). --- digital/io/src/sharp.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'digital/io/src/sharp.h') diff --git a/digital/io/src/sharp.h b/digital/io/src/sharp.h index 2417856e..3011e095 100644 --- a/digital/io/src/sharp.h +++ b/digital/io/src/sharp.h @@ -110,4 +110,18 @@ void sharp_set_threshold (uint8_t sharp_id, uint16_t low, uint16_t high); */ uint8_t sharp_get_interpreted (uint8_t sharp_id); +/** + * Is there an obstacle in front of the bot? + * This function correctly handles the moving direction of the bot to check + * only the necessary sharps. + * @param moving_direction + * - 1 when moving forward ; + * - 2 when moving backward. + * @return + * - 0 if there is nothing in front ; + * - 1 if there is an obstacle in front of the bot. + */ +uint8_t +sharp_path_obstrued (uint8_t moving_direction); + #endif /* sharp_h */ -- cgit v1.2.3