Topologie Numerica, affichage debug dans server

server.{hh,cc} :
* Ajout des affichage de trace (DEBUG_T) pour les fonctions qui n'en avaient pas.
* Retouches mineures.

cfg/topo.csv :
* Ajout explications.
* Séparation couloir / palier.

cfg/waypoints.csv :
* Création. Fichier contenant la liste des points de passage.

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@46 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
Matteo Cypriani 2008-06-20 10:37:25 +00:00
parent 269594c26e
commit 03b4143100
5 changed files with 358 additions and 37 deletions

View File

@ -1,4 +1,6 @@
# nom_pièce;X1;Y1;X2;Y2;Z1;Z2
# Liste des zones homogènes du bâtiment (pièces).
# Chaque ligne définit une zone, de la forme :
# Nom de la pièce;X1;Y1;X2;Y2;Z1;Z2
1100;1.00;7.28;6.05;3.70;3.00;6.00
0190;1.00;10.88;6.05;7.28;3.00;6.00
@ -6,9 +8,9 @@
1070;1.00;18.12;6.05;14.48;3.00;6.00
1060;1.00;25.32;6.05;18.12;3.00;6.00
1050;1.00;31.40;6.05;25.32;3.00;6.00
CouloirN1;5.00;3.70;6.05;0.50;3.00;6.00
CouloirN1;6.05;29.50;8.20;0.50;3.00;6.00
CouloirN1;8.20;16.50;10.00;10.88;3.00;6.00
WC;8.20;9.00;10.00;0.50;3.00;6.00
WC N1;8.20;9.00;10.00;0.50;3.00;6.00
1105;8.20;10.88;10.00;9.00;3.00;6.00
1095;8.20;29.30;10.00;24.80;3.00;6.00
Palier N1;5.00;3.70;8.20;0.50;3.00;6.00
Couloir N1 A;6.05;29.50;8.20;3.70;3.00;6.00
Couloir N1 B;8.20;16.50;10.00;10.88;3.00;6.00

1 # nom_pièce # Liste des zones homogènes du bâtiment (pièces). X1 Y1 X2 Y2 Z1 Z2
2 # Chaque ligne définit une zone, de la forme :
3 # Nom de la pièce;X1;Y1;X2;Y2;Z1;Z2
4 1100 1100;1.00;7.28;6.05;3.70;3.00;6.00 1.00 7.28 6.05 3.70 3.00 6.00
5 0190 0190;1.00;10.88;6.05;7.28;3.00;6.00 1.00 10.88 6.05 7.28 3.00 6.00
6 0180 0180;1.00;14.48;6.05;10.88;3.00;6.00 1.00 14.48 6.05 10.88 3.00 6.00
8 1060 1060;1.00;25.32;6.05;18.12;3.00;6.00 1.00 25.32 6.05 18.12 3.00 6.00
9 1050 1050;1.00;31.40;6.05;25.32;3.00;6.00 1.00 31.40 6.05 25.32 3.00 6.00
10 CouloirN1 WC N1;8.20;9.00;10.00;0.50;3.00;6.00 5.00 3.70 6.05 0.50 3.00 6.00
11 CouloirN1 1105;8.20;10.88;10.00;9.00;3.00;6.00 6.05 29.50 8.20 0.50 3.00 6.00
CouloirN1 8.20 16.50 10.00 10.88 3.00 6.00
WC 8.20 9.00 10.00 0.50 3.00 6.00
1105 8.20 10.88 10.00 9.00 3.00 6.00
12 1095 1095;8.20;29.30;10.00;24.80;3.00;6.00 8.20 29.30 10.00 24.80 3.00 6.00
13 Palier N1;5.00;3.70;8.20;0.50;3.00;6.00
14 Couloir N1 A;6.05;29.50;8.20;3.70;3.00;6.00
15 Couloir N1 B;8.20;16.50;10.00;10.88;3.00;6.00
16

View File

@ -0,0 +1,39 @@
# Liste des points de passage.
# Chaque ligne définit les trois coordonnées d'un point, de la forme :
# X;Y;Z
# 1100
6.05;6.50;3.00
# 0190
6.05;7.50;3.00
# 0180
6.05;13.50;3.00
# 1070
6.05;14.50;3.00
# 1060
6.05;21.00;3.00
# 1050
6.05;27.75;3.00
# WC N1
8.20;5.00;3.00
# 1105
8.20;9.50;3.00
# 1095
8.20;26.00;3.00
# Couloir N1 A / B
8.20;11.50;3.00
8.20;13.00;3.00
8.20;14.50;3.00
8.20;16.00;3.00
# Palier N1
7.50;3.70;3.00
1 # Liste des points de passage.
2 # Chaque ligne définit les trois coordonnées d'un point, de la forme :
3 # X;Y;Z
4 # 1100
5 6.05;6.50;3.00
6 # 0190
7 6.05;7.50;3.00
8 # 0180
9 6.05;13.50;3.00
10 # 1070
11 6.05;14.50;3.00
12 # 1060
13 6.05;21.00;3.00
14 # 1050
15 6.05;27.75;3.00
16 # WC N1
17 8.20;5.00;3.00
18 # 1105
19 8.20;9.50;3.00
20 # 1095
21 8.20;26.00;3.00
22 # Couloir N1 A / B
23 8.20;11.50;3.00
24 8.20;13.00;3.00
25 8.20;14.50;3.00
26 8.20;16.00;3.00
27 # Palier N1
28 7.50;3.70;3.00

View File

@ -2,10 +2,10 @@
#define _GUINUMO_HH_
#define TEST // Décommenter si on teste le serveur avec des fichiers de mesures (commenter pour utiliser des mesures instantanées transmises par le réseau (NON-IMPLÉMENTÉ).
#define DEBUG // Décommenter pour avoir de l'affichage en plus.
//#define DEBUG_2 // Décommenter pour avoir encore plus d'affichage.
#define DEBUG_T // Décommenter pour afficher chaque entrée et sortie de méthode (trace).
#define TEST // Décommenter si on teste le serveur avec des fichiers de mesures (commenter pour utiliser des mesures instantanées transmises par le réseau (NON-IMPLÉMENTÉ).
#define DEBUG // Décommenter pour avoir de l'affichage en plus.
//#define DEBUG_2 // Décommenter pour avoir encore plus d'affichage.
//#define DEBUG_T // Décommenter pour afficher chaque entrée et sortie de méthode (trace).
#endif // _GUINUMO_HH_

View File

@ -272,7 +272,17 @@ int Server::receive_data()
* Recherche un point de coordonnées (x;y;z) dans la liste reference_point_list, retourne true s'il existe, false sinon. */
bool Server::pointExists(const float &x, const float &y, const float &z)const
{
return pointExists(reference_point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
bool ret = pointExists(reference_point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret ;
}
@ -281,7 +291,17 @@ bool Server::pointExists(const float &x, const float &y, const float &z)const
* Recherche un Point dans la liste reference_point_list, retourne true s'il existe, false sinon. */
bool Server::pointExists(const Point &p)const
{
return pointExists(reference_point_list, p) ;
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
bool ret = pointExists(reference_point_list, p) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret ;
}
@ -289,7 +309,17 @@ bool Server::pointExists(const Point &p)const
/* Recherche un point de coordonnées (x;y;z) dans la liste "point_list", retourne true s'il existe, false sinon. */
bool Server::pointExists(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const
{
return pointExists(point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
bool ret = pointExists(point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret ;
}
@ -297,11 +327,24 @@ bool Server::pointExists(const vector<ReferencePoint> &point_list, const float &
/* Recherche un Point dans la liste "point_list", retourne true s'il existe, false sinon. */
bool Server::pointExists(const vector<ReferencePoint> &point_list, const Point &p) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int i;
for (i = 0 ; i < point_list.size() ; i++)
if (p == point_list[i].getCoordinates())
return true;
{
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return true;
}
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return false;
}
@ -311,7 +354,17 @@ bool Server::pointExists(const vector<ReferencePoint> &point_list, const Point &
/* Do not forget to call pointExists() before this one */
unsigned int Server::pointIndex(const float &x, const float &y, const float &z)const
{
return pointIndex(reference_point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int ret = pointIndex(reference_point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret ;
}
@ -319,25 +372,58 @@ unsigned int Server::pointIndex(const float &x, const float &y, const float &z)c
/* Do not forget to call pointExists() before this one */
unsigned int Server::pointIndex(const Point &p)const
{
return pointIndex(reference_point_list, p) ;
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int ret = pointIndex(reference_point_list, p) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret ;
}
unsigned int Server::pointIndex(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const
{
return pointIndex(point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int ret = pointIndex(point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret ;
}
unsigned int Server::pointIndex(const vector<ReferencePoint> &point_list, const Point &p) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int i;
for (i = 0 ; i < reference_point_list.size() ; i++)
if (p == reference_point_list[i].getCoordinates())
return i;
{
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return i ;
}
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return 0; // Should never happen
}
@ -346,32 +432,57 @@ unsigned int Server::pointIndex(const vector<ReferencePoint> &point_list, const
bool Server::apExists(const string &ap_addr)const
{
unsigned int i;
#ifdef DEBUG_T
cout << "//--> Server::apExists()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
string str;
for (i = 0 ; i < access_point_list.size() ; i++){
str=access_point_list[i].getApAddr();
const int length=str.length();
for(int j=0; j < length; ++j)
{
str[j] = std::tolower(str[j]);
}
for (i = 0 ; i < access_point_list.size() ; i++)
if (str == ap_addr)
return true;
}
return false;
for (unsigned int i = 0 ; i < access_point_list.size() ; i++)
{
str = access_point_list[i].getApAddr() ;
const int length = str.length() ;
for (int j = 0 ; j < length ; ++j)
str[j] = std::tolower(str[j]) ;
for (i = 0 ; i < access_point_list.size() ; i++)
if (str == ap_addr)
{
#ifdef DEBUG_T
cout << "//<-- Server::apExists()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return true ;
}
}
#ifdef DEBUG_T
cout << "//<-- Server::apExists()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return false ;
}
unsigned int Server::apIndex(const string &ap_addr)const
{
#ifdef DEBUG_T
cout << "//--> Server::apIndex()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int i;
for (i = 0 ; i < access_point_list.size() ; i++)
if (access_point_list[i].getApAddr() == ap_addr)
return i;
{
#ifdef DEBUG_T
cout << "//<-- Server::apIndex()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return i;
}
#ifdef DEBUG_T
cout << "//<-- Server::apIndex()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return 0; // Should never happen
}
@ -383,6 +494,12 @@ unsigned int Server::apIndex(const string &ap_addr)const
*/
vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsigned int &k)const
{
#ifdef DEBUG_T
cout << "//--> Server::getkClosestInSs(&vector<Measurement>, &unsigned int)" << endl ;
cout << "//<-- Server::getkClosestInSs(&vector<Measurement>, &unsigned int)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return getkClosestInSs(m, k, NULL) ;
}
@ -394,6 +511,10 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
*/
vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const
{
#ifdef DEBUG_T
cout << "//--> Server::getkClosestInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int i, j, min_idx;
vector<float> distances_vector;
vector<Point> points_vector;
@ -475,6 +596,10 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
cout << distances_vector[i] << " : " << points_vector[i] << endl ;
#endif // DEBUG
#ifdef DEBUG_T
cout << "//<-- Server::getkClosestInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return points_vector;
}
@ -482,7 +607,17 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k)const
{
return getkWeightedInSs(m, k, NULL) ;
#ifdef DEBUG_T
cout << "//--> Server::getkWeightedInSs(&vector<Measurement>, &unsigned int)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
Point ret = getkWeightedInSs(m, k, NULL) ;
#ifdef DEBUG_T
cout << "//<-- Server::getkWeightedInSs(&vector<Measurement>, &unsigned int)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret ;
}
@ -491,6 +626,10 @@ Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int
*/
Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const
{
#ifdef DEBUG_T
cout << "//--> Server::getkWeightedInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int i, j;
vector<float> distances_vector;
vector<Point> points_vector;
@ -543,6 +682,10 @@ Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int
ret.setY(y);
ret.setZ(z);
#ifdef DEBUG_T
cout << "//<-- Server::getkWeightedInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ret;
}
@ -550,6 +693,10 @@ Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int
Point Server::kPointsAverage(const vector<Point> &vp)const
{
#ifdef DEBUG_T
cout << "//--> Server::kPointsAverage()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
unsigned int i;
float x=0, y=0, z=0;
Point p;
@ -564,6 +711,10 @@ Point Server::kPointsAverage(const vector<Point> &vp)const
p.setY(y / (float) vp.size());
p.setZ(z / (float) vp.size());
#ifdef DEBUG_T
cout << "//<-- Server::kPointsAverage()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return p;
}
@ -571,6 +722,10 @@ Point Server::kPointsAverage(const vector<Point> &vp)const
Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
{
#ifdef DEBUG_T
cout << "//--> Server::fbcm()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
Point ret(0, 0, 0);
vector<string> addr;
vector<float> dist_vect;
@ -619,6 +774,10 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
dist_vect.clear();
centres.clear();
#ifdef DEBUG_T
cout << "//<-- Server::fbcm()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
/* Return position */
return ret;
}
@ -626,6 +785,10 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
/*second version of fbcm with as parameter vector<Measurement> &m and a list of friis index*/
Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list)const
{
#ifdef DEBUG_T
cout << "//--> Server::fbcm_friis()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
Point ret(0, 0, 0);
vector<string> addr;
vector<float> dist_vect;
@ -673,7 +836,12 @@ Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> frii
addr.clear();
dist_vect.clear();
centres.clear();
cout<<"RESULTAT DU FRBHM ---> "<<ret<<endl;
cout << "RESULTAT DU FRBHM ---> " << ret << endl ;
#ifdef DEBUG_T
cout << "//<-- Server::fbcm_friis()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
/* Return position */
return ret;
}
@ -681,6 +849,10 @@ Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> frii
Point Server::interlink(const vector<Measurement> &m, const int &client_idx)const
{
#ifdef DEBUG_T
cout << "//--> Server::interlink()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
Point ret(0, 0, 0);
vector<string> addr;
vector<float> dist_vect;
@ -726,6 +898,10 @@ Point Server::interlink(const vector<Measurement> &m, const int &client_idx)cons
/* Return position */
return ret;
#ifdef DEBUG_T
cout << "//<-- Server::interlink()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
@ -734,14 +910,30 @@ Point Server::interlink(const vector<Measurement> &m, const int &client_idx)cons
* Crée la liste des points de référence dans la liste reference_point_list. */
void Server::makeReferencePointListFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makePointListFromFile(&string)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
makePointListFromFile(reference_point_list, filename, true) ;
#ifdef DEBUG_T
cout << "//<-- Server::makePointListFromFile(&string)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makePointListFromFile(&vector<ReferencePoint>, &string)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
makePointListFromFile(dest_point_list, filename, true) ;
#ifdef DEBUG_T
cout << "//<-- Server::makePointListFromFile(&vector<ReferencePoint>, &string)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
@ -752,6 +944,10 @@ void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, cons
*/
void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename, const bool uniq_point)
{
#ifdef DEBUG_T
cout << "//--> Server::makePointListFromFile(&vector<ReferencePoint>, &string, bool)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
ifstream input_file ; // Flux d'entrée du fichier.
char buffer[BUFFER_LENGTH]; // Buffer lu dans le fichier.
string cpp_buffer ; // Buffer au format string.
@ -858,12 +1054,20 @@ void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, cons
input_file.close();
infos.clear() ;
#ifdef DEBUG_T
cout << "//<-- Server::makePointListFromFile(&vector<ReferencePoint>, &string, bool)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
void Server::makeApListFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makeApListFromFile()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
ifstream input_file;
char buffer[BUFFER_LENGTH];
vector<string> ap_infos;
@ -914,12 +1118,20 @@ void Server::makeApListFromFile(const string &filename)
input_file.close();
#ifdef DEBUG_T
cout << "//<-- Server::makeApListFromFile()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
void Server::makeTopologyFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makeTopologyFromFile()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
ifstream input_file ;
char buffer[BUFFER_LENGTH] ;
vector<string> infos ;
@ -967,12 +1179,20 @@ void Server::makeTopologyFromFile(const string &filename)
#endif // DEBUG
input_file.close() ;
#ifdef DEBUG_T
cout << "//<-- Server::makeTopologyFromFile()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
void Server::makeWaypointDistancesFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makeWaypointDistancesFromFile()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
ifstream input_file ;
char buffer[BUFFER_LENGTH] ;
vector<string> infos ;
@ -1103,6 +1323,11 @@ void Server::makeWaypointDistancesFromFile(const string &filename)
cout << endl ;
#endif // DEBUG
#ifdef DEBUG_T
cout << "//<-- Server::makeWaypointDistancesFromFile()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
@ -1111,7 +1336,15 @@ void Server::makeWaypointDistancesFromFile(const string &filename)
* Affiche la liste des points de référence (reference_point_list). */
void Server::printReferencePointList()
{
#ifdef DEBUG_T
cout << "//--> Server::printReferencePointList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
printPointList(reference_point_list) ;
#ifdef DEBUG_T
cout << "//<-- Server::printReferencePointList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
@ -1119,22 +1352,42 @@ void Server::printReferencePointList()
/* Affiche une liste de points (point_list). */
void Server::printPointList(vector<ReferencePoint> &point_list)
{
#ifdef DEBUG_T
cout << "//--> Server::printPointList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
for (unsigned int i = 0 ; i < point_list.size() ; i++)
cout << point_list[i] << endl ;
#ifdef DEBUG_T
cout << "//<-- Server::printPointList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
void Server::printAccessPointList()
{
#ifdef DEBUG_T
cout << "//--> Server::printAccessPointList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
for (unsigned int i = 0 ; i < access_point_list.size() ; i++)
cout << access_point_list[i] << endl;
#ifdef DEBUG_T
cout << "//<-- Server::printAccessPointList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
void Server::computeFriisFromRefList()
{
#ifdef DEBUG_T
cout << "//--> Server::computeFriisFromRefList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
vector<float> friis_idx_list;
Point pt_coords, ap_coords;
float ap_power, ap_gain, calib_gain = 2, const_term, mes_power, friis_sum;
@ -1172,11 +1425,21 @@ void Server::computeFriisFromRefList()
friis_idx_list.clear();
}
#ifdef DEBUG_T
cout << "//<-- Server::computeFriisFromRefList()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
}
/*Deuxième version de computeFriisFromRefList qui prend en entrée un point et retourne la liste d'index de friis équivalent*/
vector<float> Server::computeFriisFromRefList(const Point &p, const vector<Measurement> &m)
{
#ifdef DEBUG_T
cout << "//--> Server::computeFriisFromRefList(&Point, &vector<Measurement>)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
vector<float> friis_idx_list;
Point pt_coords, ap_coords;
float ap_power, ap_gain, calib_gain = 2, const_term, mes_power/*, friis_sum*/;
@ -1212,6 +1475,10 @@ vector<float> Server::computeFriisFromRefList(const Point &p, const vector<Measu
}
for (unsigned int k=0; k < friis_idx_list.size();k++)
cout<<"friis_idx_list"<< k <<": "<<friis_idx_list[k]<<endl;//
#ifdef DEBUG_T
cout << "//<-- Server::computeFriisFromRefList(&Point, &vector<Measurement>)" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return friis_idx_list;
}
@ -1221,21 +1488,31 @@ vector<float> Server::computeFriisFromRefList(const Point &p, const vector<Measu
/* Ajoute un client (ClientInfo) à la liste "client_list", et renvoie une référence sur l'élément ajouté. */
ClientInfo& Server::createClient()
{
#ifdef DEBUG_T
cout << "//--> Server::createClient()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
client_list.push_back(ClientInfo()) ;
#ifdef DEBUG_T
cout << "//<-- Server::createClient()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return client_list.back() ;
}
/* Localise le client d'identifiant "client_id" en appliquant l'algorithme voulu. */
void Server::monitorClient(const unsigned int &client_id, ALGORITHM algo)
void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
{
Point pointFastViterbi;
vector<float> friisFromList;
#ifdef DEBUG_T
cout << "//--> Server::monitorClient()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
Point pointFastViterbi;
vector<float> friisFromList;
vector<Point>
&E_current = client_list[client_id].getRef_viterbi_Ecurrent(),
&E_previous = client_list[client_id].getRef_viterbi_Eprevious() ;
@ -1243,6 +1520,9 @@ void Server::monitorClient(const unsigned int &client_id, ALGORITHM algo)
if (VITERBI_N < 2)
{
cerr << "monitorClient() : N ne peut être inférieur à 2 !" << endl ;
#ifdef DEBUG_T
cout << "//<-- Server::monitorClient()" << endl ; fflush(stdout) ;
#endif // DEBUG_T
return ;
}

View File

@ -112,7 +112,7 @@ public:
unsigned int getNbReferencePoints()const { return reference_point_list.size(); };
void monitorClient(const unsigned int &client_id, ALGORITHM algo) ;
void monitorClient(const unsigned int &client_id, const ALGORITHM &algo) ;
Point fastViterbiLike(const unsigned int &id_client, float **distance_matrix) ;
/* For experimentation purpose only ! */