summaryrefslogtreecommitdiff
path: root/digital/beacon
diff options
context:
space:
mode:
authorFlorent Duchon2012-05-16 17:36:32 +0200
committerFlorent Duchon2012-05-16 17:43:11 +0200
commitb4b3abb33cf07fb0ef00c81fc5592e5e7667e717 (patch)
tree5aa4ca0be6839d119bbb3b83b7450c60ecd88bd9 /digital/beacon
parent3e4bd8280a6a19a8dabdf7ee5f17ae7e94baf40c (diff)
digital/beacon: add get coord and get trust API
Diffstat (limited to 'digital/beacon')
-rw-r--r--digital/beacon/src/position.c22
-rw-r--r--digital/beacon/src/position.h15
2 files changed, 35 insertions, 2 deletions
diff --git a/digital/beacon/src/position.c b/digital/beacon/src/position.c
index 75fbad48..f3320321 100644
--- a/digital/beacon/src/position.c
+++ b/digital/beacon/src/position.c
@@ -153,4 +153,26 @@ int update_position(uint16_t beaconID, uint16_t angleID, float angle)
last_ID[0] = beaconID;
}
return 0;
+}
+
+/* This function returns the requested coord according to the opponent number */
+int16_t position_get_coord(TOpponent_ID id, TCoord_type type)
+{
+ switch(type)
+ {
+ case X:
+ return opponent[id].x;
+ break;
+ case Y:
+ return opponent[id].y;
+ break;
+ default:
+ return 0;
+ }
+}
+
+/* This function returns the trust according to opponent number */
+int8_t position_get_trust(TOpponent_ID id)
+{
+ return opponent[id].trust;
} \ No newline at end of file
diff --git a/digital/beacon/src/position.h b/digital/beacon/src/position.h
index 215c64ba..67ec4173 100644
--- a/digital/beacon/src/position.h
+++ b/digital/beacon/src/position.h
@@ -26,7 +26,9 @@
#ifndef _POSITION_H
#define _POSITION_H
-#define MAX_OBSTACLE 2
+#include <stdint.h>
+
+#define MAX_OBSTACLE 1
#define MAX_BEACON 3
#define MAX_TEMP_POSITION MAX_OBSTACLE * 2
#define OBSTACLE_RADIUS 100
@@ -81,6 +83,15 @@ typedef struct
}recovery_s;
/* This function is used to initialize all needed structures */
-void init_struct(void);
+void position_init_struct(void);
+
+/* This function update the opponent position when a new angle is avalaible */
+int update_position(uint16_t beaconID, uint16_t angleID, float angle);
+
+/* This function returns the requested coord according to the opponent number */
+int16_t position_get_coord(TOpponent_ID id, TCoord_type type);
+
+/* This function returns the trust according to opponent number */
+int8_t position_get_trust(TOpponent_ID id);
#endif \ No newline at end of file