[Positioner] Allow to generate a RP list
Change the positioning.generate-reference-points option to offer multiple choices (false, mesh, list, both) and add the positioning.generated-points-list to allow the user to specify a list of reference points to generate.
This commit is contained in:
parent
9ef599b42f
commit
4650c229ff
5
TODO.t2t
5
TODO.t2t
|
@ -244,9 +244,6 @@ Work to do in OwlPS
|
|||
|
||||
== Autocalibration ==
|
||||
|
||||
- Allow to generate a list of reference points instead of using a
|
||||
regular meshing.
|
||||
|
||||
- Generate reference points in 3D.
|
||||
|
||||
- To select the reference CPs, we should use the distance along with the
|
||||
|
@ -274,7 +271,7 @@ Work to do in OwlPS
|
|||
|
||||
== Refactoring ==
|
||||
|
||||
- Split Stock::generate_reference_point() into several functions.
|
||||
- Move Stock::generate_reference_point() & friends to a dedicated class.
|
||||
|
||||
- Write a class for Request::type?
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ mobile-csv-file = /usr/local/etc/owlps/mobiles.csv
|
|||
|
||||
# Coordinates of the deployment area.
|
||||
# This is used to delimit the area in which reference points are
|
||||
# generated (when generate-reference-points is activated), and also
|
||||
# by the MinMax trilateration method.
|
||||
# generated (when generate-reference-points is set to "mesh" or "both"),
|
||||
# and also by the MinMax trilateration method.
|
||||
# Since MinMax is currently the only trilateration method implemented
|
||||
# in OwlPS, you should define these parameters if you use any of the
|
||||
# trilateration-based algorithms (InterlinkNetworks, FBCM, FRBHM).
|
||||
|
@ -136,6 +136,15 @@ mobile-csv-file = /usr/local/etc/owlps/mobiles.csv
|
|||
|
||||
# Generate reference points from the (auto)calibration requests
|
||||
# received.
|
||||
# Possible values
|
||||
# - false (default): do not generate reference points.
|
||||
# - mesh: generate reference points according to the regular meshing
|
||||
# defined by the options area-start/stop and
|
||||
# generated-meshing-grain-*.
|
||||
# - list: generate only the reference points defined by the option
|
||||
# generated-points-list.
|
||||
# - both: generate both a regular meshing and the points from the
|
||||
# list.
|
||||
#generate-reference-points = false
|
||||
|
||||
# With this option disabled, each generated reference point contains
|
||||
|
@ -147,9 +156,9 @@ mobile-csv-file = /usr/local/etc/owlps/mobiles.csv
|
|||
# instead. Default is enabled.
|
||||
#generate-multi-packet-reference-points = true
|
||||
|
||||
# When the above option is activated, the reference points are generated
|
||||
# with the specified distance (in meters) between one another, in the X
|
||||
# and Y axis.
|
||||
# When generate-reference-points is set to "list" or "both", the
|
||||
# reference points are generated with the specified distance (in metres)
|
||||
# between one another, in the X and Y axis.
|
||||
#generated-meshing-grain-x = 0.5
|
||||
#generated-meshing-grain-y = 0.5
|
||||
# The Z option is currently a floor number instead of a vertical
|
||||
|
@ -157,6 +166,14 @@ mobile-csv-file = /usr/local/etc/owlps/mobiles.csv
|
|||
# deploying across non-contiguous floors, which is unlikely.
|
||||
#generated-meshing-grain-z = 1
|
||||
|
||||
# When generate-reference-points is set to "list" or "both", the list of
|
||||
# reference points declared here is be generated. In the string, the
|
||||
# values are separated by semicolons, and each group of coordinates can
|
||||
# optionnaly be surrounded by parenthesis. The two following examples,
|
||||
# which declare the points (1;2;1) and (4;2.5;1), are equivalent:
|
||||
#generated-points-list = (1;2;1);(4;2.5;1)
|
||||
#generated-points-list = 1;2;1;4;2.5;1
|
||||
|
||||
# This option allows the calibration requests sent during the
|
||||
# positioning phase to be added to the calibration request's list. They
|
||||
# are added to the calibration requests read by InputDataReader during
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "configuration.hh"
|
||||
#include "posexcept.hh"
|
||||
#include "area.hh"
|
||||
#include "csvstringreader.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -474,11 +475,25 @@ void Stock::regenerate_reference_points()
|
|||
return ;
|
||||
}
|
||||
|
||||
if (! Configuration::is_configured("positioning.area-start") ||
|
||||
! Configuration::is_configured("positioning.area-stop"))
|
||||
const string &ac_mode =
|
||||
Configuration::string_value("positioning.generate-reference-points") ;
|
||||
|
||||
if (ac_mode == "mesh" || ac_mode == "both")
|
||||
generate_reference_points_mesh() ;
|
||||
|
||||
if (ac_mode == "list" || ac_mode == "both")
|
||||
generate_reference_points_list() ;
|
||||
}
|
||||
|
||||
|
||||
void Stock::generate_reference_points_mesh()
|
||||
{
|
||||
if (! (Configuration::is_configured("positioning.area-start") &&
|
||||
Configuration::is_configured("positioning.area-stop")))
|
||||
throw missing_configuration(
|
||||
"You must define the deployment area in order to generate"
|
||||
" reference points.") ;
|
||||
"In order to generate a meshing of reference points, you must"
|
||||
" define the deployment area.") ;
|
||||
|
||||
Point3D start(Configuration::string_value("positioning.area-start")) ;
|
||||
Point3D stop(Configuration::string_value("positioning.area-stop")) ;
|
||||
float step_x =
|
||||
|
@ -492,19 +507,43 @@ void Stock::regenerate_reference_points()
|
|||
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) ;
|
||||
Autocalibration ac(current_point) ;
|
||||
try
|
||||
{
|
||||
ac.generate_reference_point() ;
|
||||
}
|
||||
catch (autocalibration_error &e)
|
||||
{
|
||||
if (Configuration::is_configured("verbose"))
|
||||
cerr << e.what() << '\n' ;
|
||||
}
|
||||
}
|
||||
generate_reference_point(Point3D(x,y,z)) ;
|
||||
}
|
||||
|
||||
|
||||
void Stock::generate_reference_points_list()
|
||||
{
|
||||
if (! Configuration::is_configured("positioning.generated-points-list"))
|
||||
throw missing_configuration(
|
||||
"In order to generate a list of reference points, you must"
|
||||
" define the list.") ;
|
||||
|
||||
const string &rp_list_csv =
|
||||
Configuration::string_value("positioning.generated-points-list") ;
|
||||
|
||||
CSVStringReader rp_list_parser(rp_list_csv) ;
|
||||
|
||||
Point3D rp ;
|
||||
while (rp_list_parser.read_point3d(rp))
|
||||
generate_reference_point(rp) ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @arg coord The coordinates of the reference point to generate.
|
||||
*/
|
||||
void Stock::generate_reference_point(const Point3D &coord)
|
||||
{
|
||||
Autocalibration ac(coord) ;
|
||||
try
|
||||
{
|
||||
ac.generate_reference_point() ;
|
||||
}
|
||||
catch (autocalibration_error &e)
|
||||
{
|
||||
if (Configuration::is_configured("verbose"))
|
||||
cerr << e.what() << '\n' ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -88,6 +88,17 @@ private:
|
|||
static void delete_non_ap_calibration_requests(void) ;
|
||||
//@}
|
||||
|
||||
/** @name ReferencePoint operations */
|
||||
//@{
|
||||
/// Generates reference points according to a meshing
|
||||
static void generate_reference_points_mesh(void) ;
|
||||
/// Generates reference points according to a list
|
||||
static void generate_reference_points_list(void) ;
|
||||
/// Generates a single reference point
|
||||
static void generate_reference_point(const Point3D &coord) ;
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
/** @name Building operations */
|
||||
//@{
|
||||
|
|
|
@ -278,9 +278,13 @@ void UserInterface::fill_positioning_options()
|
|||
"Algorithm to calculate the similarity, in the signal strength space,"
|
||||
" between two measurements. Allowed: mean, interval, interval2.")
|
||||
("positioning.generate-reference-points",
|
||||
po::value<bool>()->default_value(false),
|
||||
po::value<string>()->default_value("false"),
|
||||
"Generate reference points from the (auto)calibration requests"
|
||||
" received.")
|
||||
" received. Can be 'false', 'mesh' to generate reference points"
|
||||
" regularly according to the meshing grain specified and the"
|
||||
" positioning area defined, 'list' to generate reference points"
|
||||
" from a list (cf. option generated-points-list) or 'both' to"
|
||||
" generate points both from the list and following the meshing.")
|
||||
("positioning.generate-multi-packet-reference-points",
|
||||
po::value<bool>()->default_value(true),
|
||||
"Generate several packets per reference point by trying to match the"
|
||||
|
@ -299,6 +303,11 @@ void UserInterface::fill_positioning_options()
|
|||
"When generating reference points, this parameter represents the"
|
||||
" number of the floor. Currently, each increment of Y is a new"
|
||||
" floor (full 3-D coordinates are not supported yet).")
|
||||
("positioning.generated-points-list",
|
||||
po::value<string>(),
|
||||
"List of reference points to generate, if generate-reference-points"
|
||||
" is set to 'list' or 'both' (string format:"
|
||||
" \"(X1;Y1;Z1);(X2;Y2;Z2);...\" or \"X1;Y1;Z1;X2;Y2;Z2;...\").")
|
||||
("positioning.accept-new-calibration-requests",
|
||||
po::value<bool>()->default_value(false),
|
||||
"Add the calibration requests received during the run-time to"
|
||||
|
@ -388,7 +397,7 @@ void UserInterface::fill_misc_options()
|
|||
" enable this when reading inputs (requests) off-line to replay"
|
||||
" scenarios, if time-related options are enabled (e.g."
|
||||
" \"positioning.calibration-requests-timeout\"). To be useful, this"
|
||||
" option requires the listener's clocks to be synchronised.")
|
||||
" option requires the listeners' clocks to be synchronised.")
|
||||
;
|
||||
|
||||
file_options->add(options) ;
|
||||
|
|
Loading…
Reference in New Issue