From 3a4c760a6c88a449448955e1942a8b4eaca09a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matheus=20Paix=C3=A3o=20Gumercindo=20dos=20Santos?= Date: Sun, 27 Oct 2024 17:32:54 -0300 Subject: [PATCH] Add example evaluator --- .../decision/processing/CMakeLists.txt | 2 ++ .../decision/processing/coach/coach.cpp | 6 ++-- .../decision/processing/coach/coach.h | 2 ++ .../coach/tactical_plan/tactical_plan.h | 3 ++ .../processing/evaluators/CMakeLists.txt | 2 ++ .../evaluators/example_evaluator.cpp | 20 +++++++++++++ .../processing/evaluators/example_evaluator.h | 28 +++++++++++++++++++ 7 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.cpp create mode 100644 decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.h diff --git a/decision-ms/decision-guardiola/decision/processing/CMakeLists.txt b/decision-ms/decision-guardiola/decision/processing/CMakeLists.txt index cbf1a6ac..ab3fbfd6 100644 --- a/decision-ms/decision-guardiola/decision/processing/CMakeLists.txt +++ b/decision-ms/decision-guardiola/decision/processing/CMakeLists.txt @@ -3,4 +3,6 @@ robocin_cpp_library( HDRS decision_processor.h SRCS decision_processor.cpp DEPS common::output + coach + evaluators ) diff --git a/decision-ms/decision-guardiola/decision/processing/coach/coach.cpp b/decision-ms/decision-guardiola/decision/processing/coach/coach.cpp index 14f90f0c..f26ff191 100644 --- a/decision-ms/decision-guardiola/decision/processing/coach/coach.cpp +++ b/decision-ms/decision-guardiola/decision/processing/coach/coach.cpp @@ -2,7 +2,7 @@ namespace decision { -Coach::Coach() = default; +Coach::Coach() { example_evaluator_ = makeEvaluator(); } void Coach::process() { for (auto evaluator : evaluators_) { @@ -20,6 +20,8 @@ void Coach::reset() { TacticalPlan Coach::getTacticalPlan() { return tactical_plan_; } -void Coach::setTacticalPlan() { tactical_plan_; } +void Coach::setTacticalPlan() { + tactical_plan_.example_evaluator_result_ = example_evaluator_->getExampleEvaluatorResult(); +} } // namespace decision diff --git a/decision-ms/decision-guardiola/decision/processing/coach/coach.h b/decision-ms/decision-guardiola/decision/processing/coach/coach.h index 285dcd23..3a90a29e 100644 --- a/decision-ms/decision-guardiola/decision/processing/coach/coach.h +++ b/decision-ms/decision-guardiola/decision/processing/coach/coach.h @@ -23,6 +23,8 @@ class Coach : public ICoach { private: std::vector evaluators_; TacticalPlan tactical_plan_; + + std::unique_ptr example_evaluator_; }; } // namespace decision diff --git a/decision-ms/decision-guardiola/decision/processing/coach/tactical_plan/tactical_plan.h b/decision-ms/decision-guardiola/decision/processing/coach/tactical_plan/tactical_plan.h index 11c8bcfb..ac67a2eb 100644 --- a/decision-ms/decision-guardiola/decision/processing/coach/tactical_plan/tactical_plan.h +++ b/decision-ms/decision-guardiola/decision/processing/coach/tactical_plan/tactical_plan.h @@ -1,11 +1,14 @@ #ifndef DECISION_PROCESSING_COACH_TACTICAL_PLAN_TACTICAL_PLAN_H #define DECISION_PROCESSING_COACH_TACTICAL_PLAN_TACTICAL_PLAN_H +#include "decision/processing/evaluators/example_evaluator.h" namespace decision { class TacticalPlan { public: TacticalPlan(); + + ExampleEvaluatorResult example_evaluator_result_; }; } // namespace decision diff --git a/decision-ms/decision-guardiola/decision/processing/evaluators/CMakeLists.txt b/decision-ms/decision-guardiola/decision/processing/evaluators/CMakeLists.txt index 39728e99..1738c8c2 100644 --- a/decision-ms/decision-guardiola/decision/processing/evaluators/CMakeLists.txt +++ b/decision-ms/decision-guardiola/decision/processing/evaluators/CMakeLists.txt @@ -1,5 +1,7 @@ robocin_cpp_library( NAME evaluators HDRS ievaluator.h + example_evaluator.h SRCS ievaluator.cpp + example_evaluator.cpp ) diff --git a/decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.cpp b/decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.cpp new file mode 100644 index 00000000..3180ac68 --- /dev/null +++ b/decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.cpp @@ -0,0 +1,20 @@ +#include "decision/processing/evaluators/example_evaluator.h" + +#include + +namespace decision { + +ExampleEvaluatorResult::ExampleEvaluatorResult() = default; + +ExampleEvaluator::ExampleEvaluator() { reset(); } + +void ExampleEvaluator::process() { robocin::ilog("EXAMPLE EVALUATOR WORKING"); } + +void ExampleEvaluator::reset() { example_evaluator_result_ = ExampleEvaluatorResult{}; } + +ExampleEvaluatorResult ExampleEvaluator::getExampleEvaluatorResult() const { + // return example_evaluator_result_; + return {}; +} + +} // namespace decision diff --git a/decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.h b/decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.h new file mode 100644 index 00000000..714a040a --- /dev/null +++ b/decision-ms/decision-guardiola/decision/processing/evaluators/example_evaluator.h @@ -0,0 +1,28 @@ +#ifndef DECISION_PROCESSING_EVALUATORS_EXAMPLE_EVALUATOR_H +#define DECISION_PROCESSING_EVALUATORS_EXAMPLE_EVALUATOR_H + +#include "decision/processing/evaluators/ievaluator.h" + +namespace decision { + +class ExampleEvaluatorResult { + public: + ExampleEvaluatorResult(); +}; + +class ExampleEvaluator : public IEvaluator { + public: + ExampleEvaluator(); + + void process() override; + void reset() override; + + [[nodiscard]] ExampleEvaluatorResult getExampleEvaluatorResult() const; + + private: + ExampleEvaluatorResult example_evaluator_result_; +}; + +} // namespace decision + +#endif /* DECISION_PROCESSING_EVALUATORS_EXAMPLE_EVALUATOR_H */