[Positioner] Autocalibration: single packet if error

When generating multi-packets RPs, if the RPs associated with the two
APs have no packet in common, we fall back to generating a single-packet
(averaged) RP.
This commit is contained in:
Matteo Cypriani 2012-05-31 19:08:26 +02:00
parent ecae107163
commit 6e40e14863
2 changed files with 19 additions and 6 deletions

View File

@ -264,9 +264,20 @@ void Autocalibration::compute_multi_packet_ss()
assert(rx_measurement) ;
/* Generate the SS for each packet */
bool packet_generated = false ;
for (pkt_id_t pkt_id = 1 ; pkt_id <= (*cr)->get_nb_packets() ;
++pkt_id)
compute_single_packet_ss(pkt_id) ;
if (compute_single_packet_ss(pkt_id))
packet_generated = true ;
if (! packet_generated)
{
if (Configuration::is_configured("verbose"))
cerr << "No packet has been generated for RX AP " << rx_mac
<< "... failing back to single packet request. Calibration"
<< " request involved : " << **cr << "\n" ;
compute_single_packet_ss(0) ;
}
}
@ -274,7 +285,7 @@ void Autocalibration::compute_multi_packet_ss()
* @arg pkt_id The number of the packet to create. Must be 0 if all
* the generated reference points contain only one packet.
*/
void Autocalibration::compute_single_packet_ss(pkt_id_t pkt_id)
bool Autocalibration::compute_single_packet_ss(pkt_id_t pkt_id)
{
/* Distance RX-P */
const Point3D &rx_coord = rx->second.get_coordinates() ;
@ -286,7 +297,7 @@ void Autocalibration::compute_single_packet_ss(pkt_id_t pkt_id)
{
double tmp_ss = compute_weighted_ss(i, pkt_id, point_dst) ;
if (tmp_ss > 0) // error
return ;
return false ;
rx_ss += tmp_ss ;
}
@ -301,6 +312,8 @@ void Autocalibration::compute_single_packet_ss(pkt_id_t pkt_id)
// Useful only if the measurement was just created, but it is not
// worth a test:
measurements[rx_mac].set_ap(&rx->second) ;
return true ;
}

View File

@ -77,13 +77,13 @@ protected:
void weight_2_aps(void) ;
/// Computes the SS of the virtual mobile
void compute_ss(void) ;
/// Computes a SS with several packets in it
void compute_multi_packet_ss(void) ;
/// Computes a SS with only one packet in it
void compute_single_packet_ss(pkt_id_t pkt_id) ;
bool compute_single_packet_ss(pkt_id_t pkt_id) ;
/// Computes a SS according to the weight of the AP
double compute_weighted_ss(
unsigned int ap_idx, pkt_id_t pkt_id, float point_dst) ;
/// Computes a SS with several packets in it
void compute_multi_packet_ss(void) ;
public:
Autocalibration(const Point3D &_point): point(_point) {}