Include Z in min-max
This is the ultimate modification by the Geolocation master Fred. In other words, includes z-coordinate to the min-max algorithm (name should change soon) in functions fbcm & fbcm_friis. git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@57 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
parent
bec6fb2549
commit
83c40666a2
|
@ -1068,7 +1068,7 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
|
|||
vector<Point> centres;
|
||||
unsigned int i, ap_idx;
|
||||
float constant_term, minmax_res, minmax_max;
|
||||
float x = MINMAX_X_START, y = MINMAX_Y_START;
|
||||
float x = MINMAX_X_START, y = MINMAX_Y_START, z = MINMAX_Z_START;
|
||||
|
||||
i = 0;
|
||||
//cout << "FBCM: ";
|
||||
|
@ -1092,19 +1092,21 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
|
|||
minmax_res = 1000000;
|
||||
for (x = MINMAX_X_START ; x < MINMAX_X_STOP ; x += MINMAX_STEP)
|
||||
for (y = MINMAX_Y_START ; y < MINMAX_Y_STOP ; y += MINMAX_STEP)
|
||||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if (abs(centres[i].distance(x, y, 3) - dist_vect[i]) > minmax_max)
|
||||
minmax_max = abs(centres[i].distance(x, y, 3) - dist_vect[i]) ;
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
ret.setY(y);
|
||||
minmax_res = minmax_max;
|
||||
}
|
||||
}
|
||||
|
||||
for(z = MINMAX_Z_START ; z <= MINMAX_Z_STOP ; z += MINMAX_Z_STEP)
|
||||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if (abs(centres[i].distance(x, y, z) - dist_vect[i]) > minmax_max)
|
||||
minmax_max = abs(centres[i].distance(x, y, z) - dist_vect[i]) ;
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
ret.setY(y);
|
||||
ret.setZ(z);
|
||||
minmax_res = minmax_max;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear all vectors */
|
||||
addr.clear();
|
||||
dist_vect.clear();
|
||||
|
@ -1131,7 +1133,7 @@ Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> frii
|
|||
vector<Point> centres;
|
||||
unsigned int i, j, ap_idx;
|
||||
float constant_term, minmax_res, minmax_max;
|
||||
float x = MINMAX_X_START, y = MINMAX_Y_START;
|
||||
float x = MINMAX_X_START, y = MINMAX_Y_START, z = MINMAX_Z_START;
|
||||
|
||||
i = 0;
|
||||
//cout << "FBCM: ";
|
||||
|
@ -1152,24 +1154,23 @@ Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> frii
|
|||
}
|
||||
|
||||
/* Then: min-max */
|
||||
minmax_res = 1000000;
|
||||
minmax_res = 1000000;
|
||||
for (x = MINMAX_X_START ; x < MINMAX_X_STOP ; x += MINMAX_STEP)
|
||||
for (y = MINMAX_Y_START ; y < MINMAX_Y_STOP ; y += MINMAX_STEP)
|
||||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if ((std::abs(centres[i].distance(Point(x, y, 3)) - dist_vect[i])) > minmax_max)
|
||||
{
|
||||
minmax_max = std::abs(centres[i].distance(Point(x, y, 3)) - dist_vect[i]);
|
||||
//cout << "minmax_max: " << minmax_max << endl;
|
||||
}
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
ret.setY(y);
|
||||
minmax_res = minmax_max;
|
||||
}
|
||||
}
|
||||
for(z = MINMAX_Z_START ; z <= MINMAX_Z_STOP ; z += MINMAX_Z_STEP)
|
||||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if (abs(centres[i].distance(x, y, z) - dist_vect[i]) > minmax_max)
|
||||
minmax_max = abs(centres[i].distance(x, y, z) - dist_vect[i]) ;
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
ret.setY(y);
|
||||
ret.setZ(z);
|
||||
minmax_res = minmax_max;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear all vectors */
|
||||
addr.clear();
|
||||
|
|
|
@ -40,10 +40,13 @@ typedef ClientInfo::float_index float_index ;
|
|||
#define DEFAULT_LISTEN_PORT 7777
|
||||
#define LIGHT_SPEED 300000000
|
||||
#define MINMAX_STEP 0.5
|
||||
#define MINMAX_Z_STEP 3
|
||||
#define MINMAX_X_START -1
|
||||
#define MINMAX_Y_START -1
|
||||
#define MINMAX_Z_START 0
|
||||
#define MINMAX_X_STOP 15
|
||||
#define MINMAX_Y_STOP 45
|
||||
#define MINMAX_Z_STOP 3
|
||||
#define BUFFER_LENGTH 5000
|
||||
//#define DEFAULT_Z 3 // Décommenter pour utiliser des fichiers d'entrée avec des coordonnées dans un seul plan (X, Y).
|
||||
//#define FRED_CSV_FORMAT // Décommenter pour utiliser les fichiers CSV au « format Fred » (plusieurs lignes par mesure, avec un AP par ligne).
|
||||
|
|
Loading…
Reference in New Issue