Class MovementDetector
Defined in File MovementDetector.hpp
Nested Relationships
Nested Types
Class Documentation
Holds MovementDetectorPlugin objects and polls them to determine a MovementStatus consensus.
Public Functions
Add plugin to internal list of movement detection algorithm plugins.
- Parameters
id – Identifier for this plugin instance.
plugin – A movement-detecting plugin. It is recommended that the plugin gracefully handle unexpected data types to avoid errors in the process() function.
weight – Relative weight assigned to this plugin. Must be positive. See get_status() for how weights affect results.
stale_time – Amount of time (seconds) allowed to have elapsed between this plugin’s MovementDetectorPlugin::get_time result and the latest MovementDetectorPlugin::get_time result from all plugins before treating the status from this plugin as temporarily invalid.
- Throws
std::invalid_argument – if
weight <= 0, orstale_time < 0.
Remove plugin by id/key.
- Parameters
id – The id of the plugin to be removed.
- Throws
std::invalid_argument – If no plugin tagged with
idis present and GLOBAL_ERROR_MODE is ErrorMode::DIE.
Attempt to process the provided data with all available plugins.
If any plugin is likely to react poorly upon receiving unexpected data types or multiple data sources of the same data type need to be routed to specific plugins, use MovementDetector::process(const std::vector<std::string>&, not_null<std::shared_ptr<aspn_xtensor::AspnBase>>).
- Parameters
data – Data to process.
Process the provided data only with specified plugins.
- Parameters
ids – All ids for the plugins to pass
datato.data – Data for the specified algorithm.
- Throws
std::invalid_argument – If any of the plugins referenced by
idsare not available, and the global error mode is ErrorMode::DIE (accesible with navtk::get_global_error_mode()).
Poll all plugins and calculate the current status consensus.
- Returns
Estimated status. The returned status is determined by selecting the status that has the maximum weight assigned after removing plugins that are stale or return INVALID. In other words \( status = \max(\sum \omega_{MOVING}, \sum\omega_{NOT\_MOVING}, \sum\omega_{POSSIBLY\_MOVING}) \). In the case of ties MovementStatus::POSSIBLY_MOVING is returned. MovementStatus::INVALID is returned only if all plugins return an INVALID status or are deemed stale, or no plugins have been supplied.
Get information on existing plugins.
- Returns
Map keyed by plugin id containing info. See MovementDetectorPluginStat.