[Positioner] Option generate-single-packet-RPs
The new option positioning.generate-single-packet-reference-points allows either to generate one single packet in each generated reference point, or try to match the real requests by generating packets independently.
This commit is contained in:
parent
4c5ad300c3
commit
60626196d5
|
@ -103,6 +103,12 @@ csv-file = /tmp/owlps-positioner.log
|
|||
# received.
|
||||
#generate-reference-points = false
|
||||
|
||||
# With this option enabled, each generated reference point will contain
|
||||
# a single packet in a single calibration request. This is the default.
|
||||
# If disabled, the generated reference points will contain a series of
|
||||
# packets, better matching the real requests.
|
||||
#generate-single-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.
|
||||
|
|
|
@ -589,28 +589,31 @@ void Stock::generate_reference_point(const Point3D &point)
|
|||
float point_dst = rx_coord.distance(point) ;
|
||||
// Constant term
|
||||
double common_ss = rx->second.friis_constant_term() ;
|
||||
// SS for REF1
|
||||
const ReferencePoint &ref1_rp =
|
||||
get_reference_point(ref1_coord) ;
|
||||
double friis_index =
|
||||
ref1_rp.friis_index_for_ap(rx->second.get_mac_addr()) ;
|
||||
|
||||
const string &rx_mac = rx->second.get_mac_addr() ;
|
||||
const ReferencePoint &ref1_rp = get_reference_point(ref1_coord) ;
|
||||
const ReferencePoint &ref2_rp = get_reference_point(ref2_coord) ;
|
||||
|
||||
if (Configuration::
|
||||
bool_value("positioning.generate-single-packet-reference-points"))
|
||||
{
|
||||
/* Friis indexes for REF1 & REF2 */
|
||||
float ref1_friis_idx = ref1_rp.friis_index_for_ap(rx_mac) ;
|
||||
float ref2_friis_idx = ref2_rp.friis_index_for_ap(rx_mac) ;
|
||||
|
||||
/* SS for REF1 & REF2 */
|
||||
double ref1_ss =
|
||||
common_ss +
|
||||
ref1.get_trx_power() +
|
||||
ref1.get_antenna_gain() -
|
||||
10 * friis_index * log10(point_dst) ;
|
||||
// SS for REF2
|
||||
const ReferencePoint &ref2_rp =
|
||||
get_reference_point(ref2_coord) ;
|
||||
friis_index =
|
||||
ref2_rp.friis_index_for_ap(rx->second.get_mac_addr()) ;
|
||||
10 * ref1_friis_idx * log10(point_dst) ;
|
||||
double ref2_ss =
|
||||
common_ss +
|
||||
ref2.get_trx_power() +
|
||||
ref2.get_antenna_gain() -
|
||||
10 * friis_index * log10(point_dst) ;
|
||||
10 * ref2_friis_idx * log10(point_dst) ;
|
||||
|
||||
/* Compute the SS */
|
||||
/* Compute the consolidated SS */
|
||||
ref1_ss = ref1_ss * ref1_percent / 100 ;
|
||||
ref2_ss = ref2_ss * ref2_percent / 100 ;
|
||||
double rx_ss = ref1_ss + ref2_ss ;
|
||||
|
@ -618,7 +621,62 @@ void Stock::generate_reference_point(const Point3D &point)
|
|||
/* Create the measurement, add it to the list */
|
||||
Measurement m(&rx->second) ;
|
||||
m.add_ss(1, rx_ss) ;
|
||||
measurements[rx->second.get_mac_addr()] = m ;
|
||||
measurements[rx_mac] = m ;
|
||||
}
|
||||
else
|
||||
{
|
||||
const vector<CalibrationRequest*> &ref1_cr =
|
||||
ref1_rp.get_requests() ;
|
||||
const Measurement *rx_measurement = NULL ;
|
||||
vector<CalibrationRequest*>::const_iterator cr ;
|
||||
|
||||
// Search for the first measurement made by RX in ref1_rp
|
||||
for (cr = ref1_cr.begin() ;
|
||||
! rx_measurement && cr != ref1_cr.end() ; ++cr)
|
||||
rx_measurement = (*cr)->get_measurement(rx_mac) ;
|
||||
|
||||
// The selected reference APs are in coverage of RX, therefore
|
||||
// we should always find a measurement of RX in ref1_rp
|
||||
assert(rx_measurement) ;
|
||||
|
||||
for (pkt_id_t pkt_id = 1 ; pkt_id < (*cr)->get_nb_packets() ;
|
||||
++pkt_id)
|
||||
{
|
||||
/* Friis indexes for REF1 & REF2 */
|
||||
float ref1_friis_idx =
|
||||
ref1_rp.friis_index_for_ap(rx->second.get_mac_addr(),
|
||||
pkt_id) ;
|
||||
if (ref1_friis_idx == 0)
|
||||
continue ; // The packet pkt_id does not exist in ref1_rp
|
||||
float ref2_friis_idx =
|
||||
ref2_rp.friis_index_for_ap(rx->second.get_mac_addr(),
|
||||
pkt_id) ;
|
||||
if (ref2_friis_idx == 0)
|
||||
continue ; // The packet pkt_id does not exist in ref2_rp
|
||||
|
||||
/* SS for REF1 & REF2 */
|
||||
double ref1_ss =
|
||||
common_ss +
|
||||
ref1.get_trx_power() +
|
||||
ref1.get_antenna_gain() -
|
||||
10 * ref1_friis_idx * log10(point_dst) ;
|
||||
double ref2_ss =
|
||||
common_ss +
|
||||
ref2.get_trx_power() +
|
||||
ref2.get_antenna_gain() -
|
||||
10 * ref2_friis_idx * log10(point_dst) ;
|
||||
|
||||
/* Compute the consolidated SS */
|
||||
ref1_ss = ref1_ss * ref1_percent / 100 ;
|
||||
ref2_ss = ref2_ss * ref2_percent / 100 ;
|
||||
double rx_ss = ref1_ss + ref2_ss ;
|
||||
|
||||
/* Create the measurement, add it to the list */
|
||||
Measurement m(&rx->second) ;
|
||||
m.add_ss(pkt_id, rx_ss) ;
|
||||
measurements[rx_mac] = m ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the virtual mobile */
|
||||
|
|
|
@ -242,6 +242,10 @@ void UserInterface::fill_positioning_options()
|
|||
po::value<bool>()->default_value(false),
|
||||
"Generate reference points from the (auto)calibration requests"
|
||||
" received.")
|
||||
("positioning.generate-single-packet-reference-points",
|
||||
po::value<bool>()->default_value(true),
|
||||
"Generate only one packet per reference point, instead of trying to"
|
||||
" match the packets in the real requests.")
|
||||
("positioning.generated-meshing-grain-x",
|
||||
po::value<float>()->default_value(DEFAULT_MESHING_GRAIN),
|
||||
"When generating reference points, this distance (in meters) will"
|
||||
|
|
Loading…
Reference in New Issue