event_detector 1.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
event_detector::AnalysisManager Class Reference

Component of the Event Detector responsible for identifying relevant data. More...

#include <AnalysisManager.hpp>

Public Member Functions

 AnalysisManager (EventDetector *ed, std::shared_ptr< BufferManager > buffer, const double default_period)
 Creates a new AnalysisManager with pre-defined rules.
 
void toggleAnalysis (const bool enable_periodic, const bool enable_service)
 Toggle analysis on/off for all rules.
 

Protected Member Functions

void loadRules ()
 Loads all enabled rules into the manager.
 
void loadRule (const std::string &rule_name)
 Loads a rule into the manager.
 
void togglePeriodicAnalysis (const std::string &rule_name, const bool enable)
 Toggle periodic analysis for a specific rule.
 
void toggleAnalysisByService (const std::string &rule_name, const bool enable)
 Toggle service-based analysis for a specific rule.
 
bool isRuleEnabled (const std::string &rule_name)
 Queries the parameter server to determine whether a rule is enabled.
 
double loadRuleAnalysisPeriod (const std::string &rule_name)
 Loads analysis interval for a specific rule from the parameter server.
 
void runAnalysis (const std::string &rule_name)
 Evaluates a single rule.
 

Protected Attributes

EventDetectored_
 EventDetector node.
 
std::shared_ptr< BufferManagerbuffer_
 BufferManager component.
 
std::shared_ptr< pluginlib::ClassLoader< AnalysisRule > > rule_loader_
 pluginlib class loader for AnalysisRule plugins
 
double default_period_ = 1.0
 default analysis interval
 
std::map< std::string, rclcpp::TimerBase::SharedPtr > analysis_timers_
 ROS timers triggering rule analysis, mapped to rule name.
 
std::map< std::string, std::shared_ptr< AnalysisRule > > rules_
 pre-defined rules to evaluate, mapped to rule name
 
std::map< std::string, std::shared_ptr< rclcpp::Service< std_srvs::srv::Empty > > > trigger_services_
 services that can be used to trigger rule evaluation, mapped to rule name
 

Detailed Description

Component of the Event Detector responsible for identifying relevant data.

The AnalysisManager analyzes the data buffered in the BufferManager. It is responsible for detecting data-based events. To this end, it evaluates pre-defined rules, implemented by plugins.

Definition at line 50 of file AnalysisManager.hpp.

Constructor & Destructor Documentation

◆ AnalysisManager()

event_detector::AnalysisManager::AnalysisManager ( EventDetector ed,
std::shared_ptr< BufferManager buffer,
const double  default_period 
)

Creates a new AnalysisManager with pre-defined rules.

Parameters
edEventDetector node
bufferBufferManager instance
default_perioddefault analysis interval

Member Function Documentation

◆ isRuleEnabled()

bool event_detector::AnalysisManager::isRuleEnabled ( const std::string &  rule_name)
protected

Queries the parameter server to determine whether a rule is enabled.

Parameters
rule_namename of the rule
Returns
bool whether rule is enabled

◆ loadRule()

void event_detector::AnalysisManager::loadRule ( const std::string &  rule_name)
protected

Loads a rule into the manager.

First, checks if a rule is enabled by querying the parameter server. Then creates and configures the rule by passing parameters to the rule. Last, sets up a periodic callback to run rule evaluation.

Parameters
rule_namerule name

◆ loadRuleAnalysisPeriod()

double event_detector::AnalysisManager::loadRuleAnalysisPeriod ( const std::string &  rule_name)
protected

Loads analysis interval for a specific rule from the parameter server.

Parameters
rule_namename of the rule
Returns
double analysis interval

◆ loadRules()

void event_detector::AnalysisManager::loadRules ( )
protected

Loads all enabled rules into the manager.

First checks if a rule is enabled by querying the parameter server. Then creates and configures the rule by passing parameters to the rule.

◆ runAnalysis()

void event_detector::AnalysisManager::runAnalysis ( const std::string &  rule_name)
protected

Evaluates a single rule.

The rule is evaluted, data is requested, and then this data is passed to the DatabaseInterface for insertion into the database.

Parameters
rule_namerule name

◆ toggleAnalysis()

void event_detector::AnalysisManager::toggleAnalysis ( const bool  enable_periodic,
const bool  enable_service 
)

Toggle analysis on/off for all rules.

Parameters
enable_periodicwhether to enable periodic analysis
enable_servicewhether to enable service-based analysis

◆ toggleAnalysisByService()

void event_detector::AnalysisManager::toggleAnalysisByService ( const std::string &  rule_name,
const bool  enable 
)
protected

Toggle service-based analysis for a specific rule.

Parameters
rule_namerule name
enablewhether to enable service-based analysis

◆ togglePeriodicAnalysis()

void event_detector::AnalysisManager::togglePeriodicAnalysis ( const std::string &  rule_name,
const bool  enable 
)
protected

Toggle periodic analysis for a specific rule.

Parameters
rule_namerule name
enablewhether to enable periodic analysis

Member Data Documentation

◆ analysis_timers_

std::map<std::string, rclcpp::TimerBase::SharedPtr> event_detector::AnalysisManager::analysis_timers_
protected

ROS timers triggering rule analysis, mapped to rule name.

Definition at line 156 of file AnalysisManager.hpp.

◆ buffer_

std::shared_ptr<BufferManager> event_detector::AnalysisManager::buffer_
protected

BufferManager component.

Definition at line 141 of file AnalysisManager.hpp.

◆ default_period_

double event_detector::AnalysisManager::default_period_ = 1.0
protected

default analysis interval

Definition at line 151 of file AnalysisManager.hpp.

◆ ed_

EventDetector* event_detector::AnalysisManager::ed_
protected

EventDetector node.

Definition at line 136 of file AnalysisManager.hpp.

◆ rule_loader_

std::shared_ptr<pluginlib::ClassLoader<AnalysisRule> > event_detector::AnalysisManager::rule_loader_
protected

pluginlib class loader for AnalysisRule plugins

Definition at line 146 of file AnalysisManager.hpp.

◆ rules_

std::map<std::string, std::shared_ptr<AnalysisRule> > event_detector::AnalysisManager::rules_
protected

pre-defined rules to evaluate, mapped to rule name

Definition at line 161 of file AnalysisManager.hpp.

◆ trigger_services_

std::map<std::string, std::shared_ptr<rclcpp::Service<std_srvs::srv::Empty> > > event_detector::AnalysisManager::trigger_services_
protected

services that can be used to trigger rule evaluation, mapped to rule name

Definition at line 166 of file AnalysisManager.hpp.


The documentation for this class was generated from the following file: