[Positioner] Autocalibration: clean lists

Clean ref_aps and sorted_*_angles between two iterations.
This commit is contained in:
Matteo Cypriani 2012-05-26 12:52:50 +02:00
parent 98085172de
commit 77b0a13896
1 changed files with 10 additions and 2 deletions

View File

@ -115,6 +115,9 @@ void Autocalibration::sort_reference_aps()
{
const Point3D &rx_coord = rx->second.get_coordinates() ;
sorted_negative_angles.clear() ;
sorted_positive_angles.clear() ;
for (unordered_map<string, AccessPoint>::const_iterator
ref = Stock::aps.begin() ; ref != Stock::aps.end() ; ++ref)
{
@ -165,6 +168,7 @@ void Autocalibration::sort_reference_aps()
void Autocalibration::weight_aps()
{
/* Retrieve the reference APs & angles */
ref_aps.clear() ;
map<double, pair<double,
unordered_map<string, AccessPoint>::const_iterator> >
::const_iterator s ;
@ -181,8 +185,12 @@ void Autocalibration::weight_aps()
else if (ref_aps.size() == 2)
weight_2_aps() ;
else
throw autocalibration_error(
"We should not be here... error when sorting the reference APs?") ;
{
ostringstream oss ;
oss << "We should not be here... error when sorting the reference"
<< " APs? (" << ref_aps.size() << " APs sorted)" ;
throw autocalibration_error(oss.str()) ;
}
}