[Positioner] Autocalibration: handle levels

To generate the reference points, use only the APs at the same level as
the virtual mobile. This is very basic for now, please refer to the TODO
update for more details on what should be done.
This commit is contained in:
Matteo Cypriani 2012-01-09 10:31:12 +01:00
parent 055dca7711
commit 94b9cf281f
4 changed files with 34 additions and 9 deletions

3
TODO
View File

@ -124,6 +124,9 @@
° Find why some CalibrationRequest were not deleted when ° Find why some CalibrationRequest were not deleted when
calling Stock::delete_calibration_request() (via calling Stock::delete_calibration_request() (via
ReferencePoint::delete_requests()). ReferencePoint::delete_requests()).
° Option z-level-number: the Z coordinate represents the number of
the building's level. If unactivated, the topology is used to
determine a change of level.
- Refactoring - Refactoring
° Split Stock::generate_reference_point() into several functions. ° Split Stock::generate_reference_point() into several functions.

View File

@ -87,6 +87,8 @@ csv-file = /tmp/owlps-positioner.log
# Since MinMax is currently the only multilateration method implemented # Since MinMax is currently the only multilateration method implemented
# in OwlPS, you should define these parameters if you use any of the # in OwlPS, you should define these parameters if you use any of the
# multilateration-based algorithms (InterlinkNetworks, FBCM, FRBHM). # multilateration-based algorithms (InterlinkNetworks, FBCM, FRBHM).
# With the autocalibration, the Z coordinate is the level's number, not
# a true coordinate in meters.
# They are declared as strings (X;Y;Z). Do not quote! # They are declared as strings (X;Y;Z). Do not quote!
#area-start = -2;-2;0 #area-start = -2;-2;0
#area-stop = 20;30;6 #area-stop = 20;30;6
@ -106,6 +108,9 @@ csv-file = /tmp/owlps-positioner.log
# and Y axis. # and Y axis.
#generated-meshing-grain-x = 0.5 #generated-meshing-grain-x = 0.5
#generated-meshing-grain-y = 0.5 #generated-meshing-grain-y = 0.5
# The Z option is currently a level number instead of a vertical
# coordinate in meters.
#generated-meshing-grain-z = 1
# This option allows the calibration requests sent during the # This option allows the calibration requests sent during the
# positioning phase to be added to the calibration request's list. They # positioning phase to be added to the calibration request's list. They

View File

@ -456,14 +456,15 @@ void Stock::regenerate_reference_points()
Configuration::float_value("positioning.generated-meshing-grain-x") ; Configuration::float_value("positioning.generated-meshing-grain-x") ;
float step_y = float step_y =
Configuration::float_value("positioning.generated-meshing-grain-y") ; Configuration::float_value("positioning.generated-meshing-grain-y") ;
float z = 1 ; // FIXME float step_z =
Configuration::float_value("positioning.generated-meshing-grain-z") ;
for (float x = start.get_x() ; x <= stop.get_x() ; x += step_x) for (float x = start.get_x() ; x <= stop.get_x() ; x += step_x)
for (float y = start.get_y() ; y <= stop.get_y() ; y += step_y) for (float y = start.get_y() ; y <= stop.get_y() ; y += step_y)
//for (float z = start.get_z() ; z <= stop.get_z() ; z += step_z) for (float z = start.get_z() ; z <= stop.get_z() ; z += step_z)
{ {
Point3D current_point(x,y,z) ; Point3D current_point(x,y,z) ;
generate_reference_point(current_point) ; generate_reference_point(current_point) ;
} }
} }
@ -507,12 +508,16 @@ void Stock::generate_reference_point(const Point3D &point)
for (unordered_map<string, AccessPoint>::const_iterator for (unordered_map<string, AccessPoint>::const_iterator
rx = aps.begin() ; rx != aps.end() ; ++rx) rx = aps.begin() ; rx != aps.end() ; ++rx)
{ {
/* Skip the AP if it is not at the good level */
const Point3D &rx_coord = rx->second.get_coordinates() ;
if (rx_coord.get_z() != point.get_z())
continue ;
/* Update the mobile's attributes */ /* Update the mobile's attributes */
vmob_gain += rx->second.get_antenna_gain() / aps.size() ; vmob_gain += rx->second.get_antenna_gain() / aps.size() ;
vmob_pow += rx->second.get_trx_power() / aps.size() ; vmob_pow += rx->second.get_trx_power() / aps.size() ;
/* Choose the 2 nearest APs in angle */ /* Choose the 2 nearest APs in angle */
const Point3D &rx_coord = rx->second.get_coordinates() ;
multimap<double, pair<double, multimap<double, pair<double,
unordered_map<string, AccessPoint>::const_iterator> > unordered_map<string, AccessPoint>::const_iterator> >
sorted_angles ; sorted_angles ;
@ -522,14 +527,20 @@ void Stock::generate_reference_point(const Point3D &point)
if (ref == rx) if (ref == rx)
continue ; continue ;
// Skip the AP if it is not at the same level than the
// receiver AP:
const Point3D &ref_coord = ref->second.get_coordinates() ;
if (ref_coord.get_z() != rx_coord.get_z())
continue ;
// 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) ;
// Skip the AP if it is not in coverage with the receiver AP:
if (coverage < 1) // Less than 1% coverage is ridiculous! if (coverage < 1) // Less than 1% coverage is ridiculous!
continue ; continue ;
double angle = double angle =
rx_coord.angle(point, ref->second.get_coordinates()) ; rx_coord.angle(point, ref_coord) ;
double weight = angle / coverage ; double weight = angle / coverage ;
pair<double, pair<double,
unordered_map<string, AccessPoint>::const_iterator> unordered_map<string, AccessPoint>::const_iterator>

View File

@ -27,6 +27,7 @@ namespace po = boost::program_options ;
/* Positioning options */ /* Positioning options */
#define DEFAULT_MESHING_GRAIN 0.5 #define DEFAULT_MESHING_GRAIN 0.5
#define DEFAULT_Z_MESHING_GRAIN 1
#define DEFAULT_SMALLEST_SS -99 #define DEFAULT_SMALLEST_SS -99
/* Output options */ /* Output options */
@ -249,6 +250,11 @@ void UserInterface::fill_positioning_options()
po::value<float>()->default_value(DEFAULT_MESHING_GRAIN), po::value<float>()->default_value(DEFAULT_MESHING_GRAIN),
"When generating reference points, this distance (in meters) will" "When generating reference points, this distance (in meters) will"
" separate each point to the next in Y.") " separate each point to the next in Y.")
("positioning.generated-meshing-grain-z",
po::value<float>()->default_value(DEFAULT_Z_MESHING_GRAIN),
"When generating reference points, this parameter represents the"
" number of the level. Currently, each increment of Y is a new"
" level (full 3-D coordinates are not supported yet).")
("positioning.accept-new-calibration-requests", ("positioning.accept-new-calibration-requests",
po::value<bool>()->default_value(false), po::value<bool>()->default_value(false),
"Add the calibration requests received during the run-time to" "Add the calibration requests received during the run-time to"