Skip to main content

AVxcelerate Simulation Framework 2025 R2

predictive_min_ttc_evaluator

Last update: 16.07.2025
1
3
4#include "autonomy/evaluator/predictive_min_ttc_evaluator/predictive_min_ttc_evaluator.h"
5
7{
8namespace evaluator
9{
10
11PredictiveMinTtcEvaluator::PredictiveMinTtcEvaluator(const std::string& kpi_name)
12 : min_ttc_(std::chrono::milliseconds::max()), kpi_name_(kpi_name)
13{
14}
15
16void PredictiveMinTtcEvaluator::Init() {}
17
18void PredictiveMinTtcEvaluator::Reset()
19{
20 min_ttc_ = std::chrono::milliseconds::max();
21}
22
23core::kpi::KpiContent PredictiveMinTtcEvaluator::CalculateKpi(const osi3::GroundTruth& ground_truth)
24{
25 core::kpi::KpiContent kpi_content;
26 kpi_content.name = kpi_name_;
27 kpi_content.data_type = core::kpi::Datatype::Value::kDouble;
28 kpi_content.type = GetKpiType();
29 kpi_content.unit = "ms";
30 kpi_content.timestamp.seconds = ground_truth.timestamp().seconds();
31 kpi_content.timestamp.nanoseconds = ground_truth.timestamp().nanos();
32
33 auto ttc = predictive_ttc_calculator_.Calculate(ground_truth);
34
35 if (ttc < min_ttc_)
36 {
37 min_ttc_ = ttc;
38 }
39
40 kpi_content.value = std::to_string(min_ttc_.count());
41
42 return kpi_content;
43}
44
45core::kpi::Type PredictiveMinTtcEvaluator::GetKpiType() const
46{
47 return core::kpi::Type::kScalar;
48}
49
50} // namespace evaluator
51} // namespace simulation_framework
The namespace containing evaluator implementations.
The top namespace for simulation framework.

Connect with Ansys