[Positioning] Compute the error if Real is used

If the pseudo-algorithm Real is used, the distance error is computed for
the others algorithms.
This commit is contained in:
Matteo Cypriani 2011-05-03 15:33:12 +02:00
parent 0eef6e8577
commit 506917b5ec
2 changed files with 20 additions and 3 deletions

View File

@ -51,7 +51,11 @@ void Positioning::initialise_algorithms()
i != algo_names.end() ; ++i)
{
if (*i == "Real")
algorithms.push_back(new RealPosition) ;
/* In order to compute the errors of the other algorithms,
* Real must be the first for each request, so we add it at
* the begining.
*/
algorithms.insert(algorithms.begin(), new RealPosition) ;
else if (*i == "FBCM")
{
@ -87,10 +91,23 @@ void Positioning::loop()
if (! request)
continue ;
Point3D real_position ;
bool compute_error = false ;
ResultList results(&request) ;
for (algo = algorithms.begin() ; algo != algorithms.end() ;
++algo)
results.add((*algo)->compute(request)) ;
{
Result res((*algo)->compute(request)) ;
if (compute_error)
res.compute_error(real_position) ;
else if ((*algo)->get_name() == "Real")
{
compute_error = true ;
real_position = res.get_position() ;
}
results.add(res) ;
}
output.write(results) ;
}
}

View File

@ -11,7 +11,7 @@
class RealPosition: public PositioningAlgorithm
{
public:
RealPosition(void): PositioningAlgorithm("RealPosition") {}
RealPosition(void): PositioningAlgorithm("Real") {}
Result compute(const Request &request) ;
} ;