    

 ## On this page

  

 

 # predictive\_min\_ttc\_evaluator

 Last update: 16.07.2025 

<a id="l00001" name="l00001"></a> 1 

<a id="l00003" name="l00003"></a> 3 

<a id="l00004" name="l00004"></a> 4\#include "autonomy/evaluator/predictive\_min\_ttc\_evaluator/predictive\_min\_ttc\_evaluator.h"

<a id="l00005" name="l00005"></a> 5 

<a id="l00006" name="l00006"></a> 6namespace [simulation\_framework](namespacesimulation__framework.xhtml)

<a id="l00007" name="l00007"></a> 7{

<a id="l00008" name="l00008"></a> 8namespace [evaluator](namespaceevaluator.xhtml)

<a id="l00009" name="l00009"></a> 9{

<a id="l00010" name="l00010"></a> 10 

<a id="l00011" name="l00011"></a> 11PredictiveMinTtcEvaluator::PredictiveMinTtcEvaluator(const std::string&amp; kpi_name)

<a id="l00012" name="l00012"></a> 12 : min_ttc_(std::chrono::milliseconds::max()), kpi_name_(kpi_name)

<a id="l00013" name="l00013"></a> 13{

<a id="l00014" name="l00014"></a> 14}

<a id="l00015" name="l00015"></a> 15 

<a id="l00016" name="l00016"></a>[ 16](classsimulation__framework_1_1evaluator_1_1PredictiveMinTtcEvaluator.xhtml#aad25aefd4cb26ff9697c441d39de2deb)void PredictiveMinTtcEvaluator::Init() {}

<a id="l00017" name="l00017"></a> 17 

<a id="l00018" name="l00018"></a>[ 18](classsimulation__framework_1_1evaluator_1_1PredictiveMinTtcEvaluator.xhtml#a8f78acf7646d8476fdbbdc931fbc3ffe)void PredictiveMinTtcEvaluator::Reset()

<a id="l00019" name="l00019"></a> 19{

<a id="l00020" name="l00020"></a> 20 min_ttc_ = std::chrono::milliseconds::max();

<a id="l00021" name="l00021"></a> 21}



<a id="l00022" name="l00022"></a> 22 

<a id="l00023" name="l00023"></a>[ 23](classsimulation__framework_1_1evaluator_1_1PredictiveMinTtcEvaluator.xhtml#a8778dbbad77b21dec72930729a8f52a7)[core::kpi::KpiContent](structsimulation__framework_1_1core_1_1kpi_1_1KpiContent.xhtml) PredictiveMinTtcEvaluator::CalculateKpi(const osi3::GroundTruth&amp; ground_truth)

<a id="l00024" name="l00024"></a> 24{

<a id="l00025" name="l00025"></a> 25 [core::kpi::KpiContent](structsimulation__framework_1_1core_1_1kpi_1_1KpiContent.xhtml) kpi_content;

<a id="l00026" name="l00026"></a> 26 kpi_content.name = kpi_name_;

<a id="l00027" name="l00027"></a> 27 kpi_content.[data\_type](structsimulation__framework_1_1core_1_1kpi_1_1KpiContent.xhtml#a4e2c56824798e6d55c9062552059d1bd) = core::kpi::Datatype::Value::kDouble;

<a id="l00028" name="l00028"></a> 28 kpi_content.type = GetKpiType();

<a id="l00029" name="l00029"></a> 29 kpi_content.unit = "ms";

<a id="l00030" name="l00030"></a> 30 kpi_content.timestamp.seconds = ground_truth.timestamp().seconds();

<a id="l00031" name="l00031"></a> 31 kpi_content.timestamp.nanoseconds = ground_truth.timestamp().nanos();

<a id="l00032" name="l00032"></a> 32 

<a id="l00033" name="l00033"></a> 33 auto ttc = predictive_ttc_calculator_.Calculate(ground_truth);

<a id="l00034" name="l00034"></a> 34 

<a id="l00035" name="l00035"></a> 35 if (ttc &lt; min_ttc_)

<a id="l00036" name="l00036"></a> 36 {

<a id="l00037" name="l00037"></a> 37 min_ttc_ = ttc;

<a id="l00038" name="l00038"></a> 38 }

<a id="l00039" name="l00039"></a> 39 

<a id="l00040" name="l00040"></a> 40 kpi_content.value = std::to_string(min_ttc_.count());

<a id="l00041" name="l00041"></a> 41 

<a id="l00042" name="l00042"></a> 42 return kpi_content;

<a id="l00043" name="l00043"></a> 43}



<a id="l00044" name="l00044"></a> 44 

<a id="l00045" name="l00045"></a>[ 45](classsimulation__framework_1_1evaluator_1_1PredictiveMinTtcEvaluator.xhtml#afa04796b1e66b16c1f33ee011530cb90)core::kpi::Type PredictiveMinTtcEvaluator::GetKpiType() const

<a id="l00046" name="l00046"></a> 46{

<a id="l00047" name="l00047"></a> 47 return core::kpi::Type::kScalar;

<a id="l00048" name="l00048"></a> 48}



<a id="l00049" name="l00049"></a> 49 

<a id="l00050" name="l00050"></a> 50} // namespace evaluator

<a id="l00051" name="l00051"></a> 51} // namespace simulation\_framework

[evaluator](namespaceevaluator.xhtml)

The namespace containing evaluator implementations.



[simulation\_framework](namespacesimulation__framework.xhtml)

The top namespace for simulation framework.



[simulation\_framework::core::kpi::KpiContent](structsimulation__framework_1_1core_1_1kpi_1_1KpiContent.xhtml)

struct KpiContent

**Definition** [kpi\_definition.h:67](kpi__definition_8h_source.xhtml#l00066)



[simulation\_framework::core::kpi::KpiContent::data\_type](structsimulation__framework_1_1core_1_1kpi_1_1KpiContent.xhtml#a4e2c56824798e6d55c9062552059d1bd)

Datatype data_type

**Definition** [kpi\_definition.h:72](kpi__definition_8h_source.xhtml#l00072)