diff --git a/owlps-positioner/cfg/owlps-positioner.conf b/owlps-positioner/cfg/owlps-positioner.conf index 2cd70a3..e276072 100644 --- a/owlps-positioner/cfg/owlps-positioner.conf +++ b/owlps-positioner/cfg/owlps-positioner.conf @@ -257,16 +257,22 @@ mobile-csv-file = /usr/local/etc/owlps/mobiles.csv # This option also controls the activation of the filter (0 = disabled). #max-speed = 0 -# With this option set to a positive number, the filtering is temporary -# disabled when the mobile terminal is found to be close enough to a -# capture point. This option determines this "close enough" distance, in -# metres. +# With this option set to a positive number, the maximum speed is +# temporarily set to max-speed-cp (instead of max-speed) when the mobile +# terminal is found to be close enough to a capture point. This option +# determines this "close enough" distance, in metres. # This is useful in deployments where the system is much more accurate # when the mobile is close to a capture point, such as underground # mining tunnels; in such environments, 15 m appears to be a reasonable # value to start experimenting. #cp-reset-distance = 0 +# Maximal (virtual) speed at which the mobiles can move when they are +# within cp-reset-distance, in km/h. 0 (the default value) corresponds +# to an unlimited speed, i.e. filtering will be completely disabled when +# the mobile is found to be close to a CP. +#max-speed-cp = 0 + [output] # The following options are related to the output of the results. diff --git a/owlps-positioner/positioning.cc b/owlps-positioner/positioning.cc index 0f8a4f4..23a4f83 100644 --- a/owlps-positioner/positioning.cc +++ b/owlps-positioner/positioning.cc @@ -218,10 +218,11 @@ void Positioning::filter(const Request &request, Result &result) cerr << "Filtering (algorithm " << algo_name << "): " << "for request sent at " << timestamp - << " by mobile " << mobile->get_mac_addr() << ", " ; + << " by mobile " << mobile->get_mac_addr() + << " (maximum speed is " << max_speed << " km/h), " ; - /* Don't apply filter if the reset distance is configured and the - * mobile is within this distance */ + /* Use alternative maximum speed if the reset distance is configured + * and the mobile is within this distance */ // Get the unfiltered coordinates: const Point3D &pos = result.get_position() ; float reset_distance = @@ -236,8 +237,23 @@ void Positioning::filter(const Request &request, Result &result) cerr << "the mobile appears to be within the reset distance" << " of " << reset_distance - << " m from a CP; no filtering.\n" ; - return ; + << " m from a CP" ; + max_speed = + Configuration::float_value("positioning.filter.max-speed-cp") ; + if (max_speed <= 0) + { + if (Configuration::is_configured("verbose")) + cerr + << " and the alternative speed is \"unlimited\";" + << " no filtering.\n" ; + return ; + /* Note: saying that the mobile's speed is unlimited is + * another way to say that the filter is disabled. */ + } + if (Configuration::is_configured("verbose")) + cerr + << "; maximum speed set to alternative speed (" + << max_speed << " km/h).\n" ; } } diff --git a/owlps-positioner/userinterface.cc b/owlps-positioner/userinterface.cc index 6af4fa4..3311805 100644 --- a/owlps-positioner/userinterface.cc +++ b/owlps-positioner/userinterface.cc @@ -334,8 +334,14 @@ void UserInterface::fill_positioning_options() " speed).") ("positioning.filter.cp-reset-distance", po::value()->default_value(0), - "Disable filtering when the computed position is at this distance (in" - " m) from a CP or closer (0 = never disable filtering).") + "Use max-speed-cp instead of max-speed when the computed position is" + " at this distance (in m) from a CP or closer (0 = never use" + " max-speed-cp).") + ("positioning.filter.max-speed-cp", + po::value()->default_value(0), + "Maximal (virtual) speed at which the mobiles can move when they are" + " within cp-reset-distance, in km/h (0 = unlimited speed, i.e." + " completely disables filtering when the mobile is close to a CP).") ; file_options->add(options) ;