[Positioner] Configuration::autocalibration_enabled()
Add Configuration::autocalibration_enabled() as a shortcut to test if the autocalibration is enabled.
This commit is contained in:
parent
4650c229ff
commit
6745274c94
|
@ -126,3 +126,9 @@ string_vector_value(const string &key)
|
|||
{
|
||||
return configuration[key].as< vector<string> >() ;
|
||||
}
|
||||
|
||||
|
||||
bool Configuration::autocalibration_enabled()
|
||||
{
|
||||
return string_value("positioning.generate-reference-points") != "false" ;
|
||||
}
|
||||
|
|
|
@ -54,10 +54,16 @@ private:
|
|||
static boost::program_options::variables_map configuration ;
|
||||
|
||||
public:
|
||||
/** @name General accessors */
|
||||
//@{
|
||||
/// Returns a reference to the configuration structure
|
||||
static boost::program_options::variables_map& getw_configuration(void) ;
|
||||
/// Checks if the key exists in the configuration
|
||||
static bool is_configured(const std::string &key) ;
|
||||
//@}
|
||||
|
||||
/** @name Type-specific accessors */
|
||||
//@{
|
||||
/// Returns the string value corresponding to \em key
|
||||
static const std::string& string_value(const std::string &key) ;
|
||||
/// Returns the int value corresponding to \em key
|
||||
|
@ -75,6 +81,13 @@ public:
|
|||
/// Returns the vector value corresponding to \em key
|
||||
static const std::vector<std::string>&
|
||||
string_vector_value(const std::string &key) ;
|
||||
//@}
|
||||
|
||||
/** @name Option-specific accessors */
|
||||
//@{
|
||||
/// Checks if the autocalibration is enabled
|
||||
static bool autocalibration_enabled(void) ;
|
||||
//@}
|
||||
} ;
|
||||
|
||||
#endif // _OWLPS_POSITIONING_CONFIGURATION_HH_
|
||||
|
|
|
@ -49,7 +49,7 @@ Result FBCM::compute(const Request &_request)
|
|||
{
|
||||
// If the autocalibration is activated, we have to regenerate the
|
||||
// Friis indexes each time we calculate a position
|
||||
if (Configuration::bool_value("positioning.generate-reference-points"))
|
||||
if (Configuration::autocalibration_enabled())
|
||||
Stock::update_all_friis_indexes() ;
|
||||
return TrilaterationAlgorithm::compute(_request) ;
|
||||
}
|
||||
|
|
|
@ -193,8 +193,7 @@ const Request& Input::get_next_request() const
|
|||
calibration_request->reference_point_delete_requests() ;
|
||||
Stock::store_calibration_request(*calibration_request) ;
|
||||
|
||||
if (Configuration::bool_value(
|
||||
"positioning.generate-reference-points"))
|
||||
if (Configuration::autocalibration_enabled())
|
||||
Stock::regenerate_reference_points() ;
|
||||
}
|
||||
else if (Configuration::is_configured("verbose"))
|
||||
|
|
|
@ -120,8 +120,7 @@ void Positioning::initialise_algorithms()
|
|||
* is not activated (if it is, Friis indexes will be
|
||||
* regenerated each time FBCM wants to computes a position)
|
||||
*/
|
||||
if (! Configuration::
|
||||
bool_value("positioning.generate-reference-points"))
|
||||
if (! Configuration::autocalibration_enabled())
|
||||
Stock::update_all_friis_indexes() ;
|
||||
algorithms.push_back(new FBCM) ;
|
||||
}
|
||||
|
|
|
@ -461,6 +461,7 @@ closest_reference_point(const Request &request)
|
|||
|
||||
void Stock::regenerate_reference_points()
|
||||
{
|
||||
assert(Configuration::autocalibration_enabled()) ;
|
||||
assert(! aps.empty()) ;
|
||||
assert(! reference_points.empty()) ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue