[Positioner] Fix Autocalibration::sort_reference_aps()
Fix the angle calculation in sort_reference_aps() and better comment the code.
This commit is contained in:
parent
c51d9c1c12
commit
efba4fa09b
|
@ -115,29 +115,39 @@ void Autocalibration::sort_reference_aps()
|
||||||
if (ref == rx)
|
if (ref == rx)
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
// Skip the AP if it is not at the same floor than the
|
/* Skip the AP if it is not at the same floor than the
|
||||||
// receiver AP:
|
* receiver AP */
|
||||||
const Point3D &ref_coord = ref->second.get_coordinates() ;
|
const Point3D &ref_coord = ref->second.get_coordinates() ;
|
||||||
if (ref_coord.get_z() != rx_coord.get_z())
|
if (ref_coord.get_z() != rx_coord.get_z())
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
// Skip the AP if it is not in coverage with the receiver AP:
|
/* Skip the AP if it is not in coverage with the receiver AP */
|
||||||
float coverage =
|
float coverage =
|
||||||
rx->second.received_calibration_from_ap(ref->second) ;
|
rx->second.received_calibration_from_ap(ref->second) ;
|
||||||
if (coverage < 1) // Less than 1% coverage is ridiculous!
|
if (coverage < 1) // Less than 1% coverage is ridiculous!
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
Point3D ref_coord_r(ref_coord) ;
|
/* Angle P-RX-REF */
|
||||||
ref_coord_r.rotate_2d(rx_coord, angle_p) ;
|
double angle = rx_coord.angle_2d(point, ref_coord) ;
|
||||||
|
|
||||||
double angle = rx_coord.angle_2d(point, ref_coord_r) ;
|
/* Weight in the APs' list according to coverage and angle */
|
||||||
double weight = angle / coverage ;
|
double weight = angle / coverage ;
|
||||||
|
/* Note: this weight is used only to sort the APs, it has nothing
|
||||||
|
to do with the angle weight (see weight_aps()) used to compute
|
||||||
|
the SSs. */
|
||||||
|
|
||||||
|
/* Create the list entry */
|
||||||
pair<double,
|
pair<double,
|
||||||
unordered_map<string, AccessPoint>::const_iterator>
|
unordered_map<string, AccessPoint>::const_iterator>
|
||||||
angle_ap(angle, ref) ;
|
angle_ap(angle, ref) ;
|
||||||
pair<double, pair<double,
|
pair<double, pair<double,
|
||||||
unordered_map<string, AccessPoint>::const_iterator> >
|
unordered_map<string, AccessPoint>::const_iterator> >
|
||||||
weight_angle_ap(weight, angle_ap) ;
|
weight_angle_ap(weight, angle_ap) ;
|
||||||
|
|
||||||
|
/* Rotate the AP's coordinates to know the angle direction */
|
||||||
|
Point3D ref_coord_r(ref_coord) ;
|
||||||
|
ref_coord_r.rotate_2d(rx_coord, angle_p) ;
|
||||||
|
// Insert the AP in the right list, according to the direction:
|
||||||
if (ref_coord_r.get_y() < rx_coord.get_y())
|
if (ref_coord_r.get_y() < rx_coord.get_y())
|
||||||
sorted_negative_angles.insert(weight_angle_ap) ;
|
sorted_negative_angles.insert(weight_angle_ap) ;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue