From 3c8372708ae4c9676c7102358b6858117dae2c78 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 18 Aug 2009 01:55:12 +0200 Subject: * digital/avr/modules/path (closes #81): - added escaping to avoid being blocked if inside an obstacle. - added obstacle factor to avoid a zone. --- digital/avr/modules/path/path.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'digital/avr/modules/path/path.h') diff --git a/digital/avr/modules/path/path.h b/digital/avr/modules/path/path.h index e3ec8322..24fc3e42 100644 --- a/digital/avr/modules/path/path.h +++ b/digital/avr/modules/path/path.h @@ -35,6 +35,9 @@ struct path_obstacle_t int16_t x, y; /** Radius. */ uint16_t r; + /** Factor. If not 0, obstacle is not blocking, but it add weight to path + * crossing it. Warning: if too big, it can make weight overflow. */ + uint8_t factor; /** Validity counter, when this is zero, the obstacle is ignored. */ uint16_t valid; }; @@ -48,10 +51,16 @@ path_init (int16_t border_xmin, int16_t border_ymin, void path_endpoints (int16_t sx, int16_t sy, int16_t dx, int16_t dy); -/** Set up an obstacle at given position with the given radius and validity - * period. */ +/** Try to escape from inside an obstacle. Bigger factor will shorten path + * followed inside the obstacle. Valid until the next update. */ void -path_obstacle (uint8_t i, int16_t x, int16_t y, uint16_t r, uint16_t valid); +path_escape (uint8_t factor); + +/** Set up an obstacle at given position with the given radius, factor and + * validity period. */ +void +path_obstacle (uint8_t i, int16_t x, int16_t y, uint16_t r, uint8_t factor, + uint16_t valid); /** Slowly make the obstacles disappear. */ void -- cgit v1.2.3