[Positioner] Autocalibration: compute origin angle

The angle P-RX-O (formerly named angle_p) was left uninitialised. This
is fixed, and the variable was renamed origin_angle.
This commit is contained in:
Matteo Cypriani 2012-05-02 16:05:27 +02:00
parent efba4fa09b
commit d2f40bb49e
2 changed files with 9 additions and 2 deletions

View File

@ -86,6 +86,13 @@ void Autocalibration::generate_ss()
if (rx_coord.get_z() != point.get_z())
return ;
/* Compute the origin angle P-RX-O */
Point3D origin(rx_coord) ;
origin.set_x(rx_coord.get_x() + 10) ;
origin_angle = rx_coord.angle_2d(point, origin) ;
if (point.get_y() > rx_coord.get_y())
origin_angle = -origin_angle ;
/* Choose the nearest AP(s) in angle */
sort_reference_aps() ;
// We need at least one reference AP:
@ -146,7 +153,7 @@ void Autocalibration::sort_reference_aps()
/* 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) ;
ref_coord_r.rotate_2d(rx_coord, origin_angle) ;
// Insert the AP in the right list, according to the direction:
if (ref_coord_r.get_y() < rx_coord.get_y())
sorted_negative_angles.insert(weight_angle_ap) ;

View File

@ -32,7 +32,7 @@ private:
/// Current AP to generate a SS for
std::tr1::unordered_map<std::string, AccessPoint>::const_iterator rx ;
/// Angle P-RX-O, O being the origin of the trigonometric circle
float angle_p ;
float origin_angle ;
/// Selected transmitter APs
std::vector<ap> ref_aps ;
/// \brief Angles of the transmitter APs (before M on the trigonometric