diff --git a/TODO b/TODO index 69a02c2..1238451 100644 --- a/TODO +++ b/TODO @@ -124,6 +124,9 @@ ° Find why some CalibrationRequest were not deleted when calling Stock::delete_calibration_request() (via 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 ° Split Stock::generate_reference_point() into several functions. diff --git a/owlps-positioner/cfg/owlps-positioner.conf b/owlps-positioner/cfg/owlps-positioner.conf index 01869fa..a1080cb 100644 --- a/owlps-positioner/cfg/owlps-positioner.conf +++ b/owlps-positioner/cfg/owlps-positioner.conf @@ -87,6 +87,8 @@ csv-file = /tmp/owlps-positioner.log # Since MinMax is currently the only multilateration method implemented # in OwlPS, you should define these parameters if you use any of the # 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! #area-start = -2;-2;0 #area-stop = 20;30;6 @@ -106,6 +108,9 @@ csv-file = /tmp/owlps-positioner.log # and Y axis. #generated-meshing-grain-x = 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 # positioning phase to be added to the calibration request's list. They diff --git a/owlps-positioner/src/stock.cc b/owlps-positioner/src/stock.cc index 07fd0be..2234299 100644 --- a/owlps-positioner/src/stock.cc +++ b/owlps-positioner/src/stock.cc @@ -456,14 +456,15 @@ void Stock::regenerate_reference_points() Configuration::float_value("positioning.generated-meshing-grain-x") ; float step_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 y = start.get_y() ; y <= stop.get_y() ; y += step_y) - //for (float z = start.get_z() ; z <= stop.get_z() ; z += step_z) - { - Point3D current_point(x,y,z) ; - generate_reference_point(current_point) ; - } + for (float z = start.get_z() ; z <= stop.get_z() ; z += step_z) + { + Point3D current_point(x,y,z) ; + generate_reference_point(current_point) ; + } } @@ -507,12 +508,16 @@ void Stock::generate_reference_point(const Point3D &point) for (unordered_map::const_iterator 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 */ vmob_gain += rx->second.get_antenna_gain() / aps.size() ; vmob_pow += rx->second.get_trx_power() / aps.size() ; /* Choose the 2 nearest APs in angle */ - const Point3D &rx_coord = rx->second.get_coordinates() ; multimap::const_iterator> > sorted_angles ; @@ -522,14 +527,20 @@ void Stock::generate_reference_point(const Point3D &point) if (ref == rx) 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 = 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! continue ; double angle = - rx_coord.angle(point, ref->second.get_coordinates()) ; + rx_coord.angle(point, ref_coord) ; double weight = angle / coverage ; pair::const_iterator> diff --git a/owlps-positioner/src/userinterface.cc b/owlps-positioner/src/userinterface.cc index c266ab9..1a87a8d 100644 --- a/owlps-positioner/src/userinterface.cc +++ b/owlps-positioner/src/userinterface.cc @@ -27,6 +27,7 @@ namespace po = boost::program_options ; /* Positioning options */ #define DEFAULT_MESHING_GRAIN 0.5 +#define DEFAULT_Z_MESHING_GRAIN 1 #define DEFAULT_SMALLEST_SS -99 /* Output options */ @@ -249,6 +250,11 @@ void UserInterface::fill_positioning_options() po::value()->default_value(DEFAULT_MESHING_GRAIN), "When generating reference points, this distance (in meters) will" " separate each point to the next in Y.") + ("positioning.generated-meshing-grain-z", + po::value()->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", po::value()->default_value(false), "Add the calibration requests received during the run-time to"