summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon
diff options
context:
space:
mode:
authorFlorent Duchon2012-12-18 23:20:27 +0100
committerFlorent Duchon2012-12-24 17:51:10 +0100
commit6372459a1c3017edf8f0aed694184c11266ad89d (patch)
tree4c179a0b72a6f48c741b20e8459548363cc5a5e1 /digital/beacon
parent7e6833250e5d87a9e12dd4b6ad21641983c1f562 (diff)
digital/beacon: use average value for opponent position
Diffstat (limited to 'digital/beacon')
-rw-r--r--digital/beacon/src/update.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/digital/beacon/src/update.c b/digital/beacon/src/update.c
index aa1614cf..a9d19315 100644
--- a/digital/beacon/src/update.c
+++ b/digital/beacon/src/update.c
@@ -27,6 +27,7 @@
#include "trust.h"
#include "update.h"
#include "debug_simu.h"
+#include "debug_avr.h"
/* Globals Declaration */
extern opponent_s opponent[MAX_OBSTACLE];
@@ -47,10 +48,11 @@ TUpdateStatus update(coord_s * point)
dy = opponent[j].y - point->y;
if (dx * dx + dy * dy < OBSTACLE_RADIUS * OBSTACLE_RADIUS)
{
- DEBUG_UPDATE("Opponent found (%.4d ; %.4d)\n",opponent[j].x,opponent[j].y);
- opponent[j].x = point->x;
- opponent[j].y = point->y;
+// uprintf("Opponent found (%.4d ; %.4d)\r\n",opponent[j].x,opponent[j].y);
+ opponent[j].x = (opponent[j].x + point->x)/2;
+ opponent[j].y = (opponent[j].y + point->y)/2;
trust_increase(j);
+ uprintf("%.4d;%.4d;%d\r\n",opponent[j].x,opponent[j].y,opponent[j].trust);
return UPDATE_OBSTACLE_FOUND;
}
}