From b4b3abb33cf07fb0ef00c81fc5592e5e7667e717 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 16 May 2012 17:36:32 +0200 Subject: digital/beacon: add get coord and get trust API --- digital/beacon/src/position.c | 22 ++++++++++++++++++++++ digital/beacon/src/position.h | 15 +++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'digital/beacon') 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 + +#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 -- cgit v1.2.3