LCOV - code coverage report
Current view: top level - include/ad/rss/core - RssSituationExtraction.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 2 2 100.0 %
Date: 2025-07-22 06:53:46 Functions: 2 2 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2018-2021 Intel Corporation
       4                 :            : //
       5                 :            : // SPDX-License-Identifier: LGPL-2.1-only
       6                 :            : //
       7                 :            : // ----------------- END LICENSE BLOCK -----------------------------------
       8                 :            : /**
       9                 :            :  * @file
      10                 :            :  */
      11                 :            : 
      12                 :            : #pragma once
      13                 :            : 
      14                 :            : #include "ad/rss/core/RssSituationSnapshot.hpp"
      15                 :            : #include "ad/rss/structured/RssConstellationIdProvider.hpp"
      16                 :            : #include "ad/rss/world/WorldModel.hpp"
      17                 :            : 
      18                 :            : /*!
      19                 :            :  * @brief namespace ad
      20                 :            :  */
      21                 :            : namespace ad {
      22                 :            : /*!
      23                 :            :  * @brief namespace rss
      24                 :            :  */
      25                 :            : namespace rss {
      26                 :            : 
      27                 :            : /*!
      28                 :            :  * @brief namespace core
      29                 :            :  */
      30                 :            : namespace core {
      31                 :            : 
      32                 :            : /*!
      33                 :            :  * @brief class RssSituationExtraction
      34                 :            :  *
      35                 :            :  * Class providing functions required for the extraction of the RSS situation from the RSS world model.
      36                 :            :  */
      37                 :            : class RssSituationExtraction
      38                 :            : {
      39                 :            : public:
      40                 :            :   /*!
      41                 :            :    * \brief Smart pointer on RssSituationExtraction
      42                 :            :    */
      43                 :            :   typedef std::shared_ptr<RssSituationExtraction> Ptr;
      44                 :            : 
      45                 :            :   /*!
      46                 :            :    * \brief Smart pointer on constant RssSituationExtraction
      47                 :            :    */
      48                 :            :   typedef std::shared_ptr<RssSituationExtraction const> ConstPtr;
      49                 :            : 
      50                 :            :   /*!
      51                 :            :    * @brief constructor
      52                 :            :    */
      53                 :        765 :   RssSituationExtraction() = default;
      54                 :            : 
      55                 :            :   /*!
      56                 :            :    * @brief destructor
      57                 :            :    */
      58                 :        765 :   ~RssSituationExtraction() = default;
      59                 :            : 
      60                 :            :   /**
      61                 :            :    * @brief Transform all RSS constellations from the world model into relative constellations within their
      62                 :            :    * constellation lane coordinate system.
      63                 :            :    *
      64                 :            :    * @param [in] worldModel - the current world model information
      65                 :            :    * @param [out] situationSnapshot - the situation to be analyzed by RSS with its vector of constellations
      66                 :            :    *
      67                 :            :    * @return true if the situation snapshot could be extracted, false if there was an error during the operation.
      68                 :            :    */
      69                 :            :   bool extractSituation(world::WorldModel const &worldModel, core::RssSituationSnapshot &situationSnapshot);
      70                 :            : 
      71                 :            :   /*!
      72                 :            :    * @brief drop the history associated with a given object_id
      73                 :            :    *
      74                 :            :    * This function might be used to drop previous states referred to a certain object id in case the object id is reused
      75                 :            :    *
      76                 :            :    * @param[in] object_id the object_id previous history should be dropped
      77                 :            :    */
      78                 :            :   void dropObjectHistory(world::ObjectId const &object_id);
      79                 :            : 
      80                 :            : private:
      81                 :            :   void calcluateRelativeLongitudinalPosition(physics::MetricRange const &egoMetricRange,
      82                 :            :                                              physics::MetricRange const &otherMetricRange,
      83                 :            :                                              LongitudinalRelativePosition &longitudinal_position,
      84                 :            :                                              physics::Distance &longitudinal_distance);
      85                 :            :   void calcluateRelativeLongitudinalPositionIntersection(physics::MetricRange const &egoMetricRange,
      86                 :            :                                                          physics::MetricRange const &otherMetricRange,
      87                 :            :                                                          LongitudinalRelativePosition &longitudinal_position,
      88                 :            :                                                          physics::Distance &longitudinal_distance);
      89                 :            :   void calcluateRelativeLateralPosition(physics::MetricRange const &egoMetricRange,
      90                 :            :                                         physics::MetricRange const &otherMetricRange,
      91                 :            :                                         LateralRelativePosition &lateral_position,
      92                 :            :                                         physics::Distance &lateral_distance);
      93                 :            :   bool convertObjectsNonIntersection(world::Constellation const &currentConstellation,
      94                 :            :                                      core::RelativeConstellation &constellation);
      95                 :            :   void convertToIntersectionCentric(physics::MetricRange const &objectDimension,
      96                 :            :                                     physics::MetricRange const &intersectionPosition,
      97                 :            :                                     physics::MetricRange &dimensionsIntersection);
      98                 :            :   bool convertObjectsIntersection(world::Constellation const &currentConstellation,
      99                 :            :                                   core::RelativeConstellation &constellation);
     100                 :            : 
     101                 :            :   /**
     102                 :            :    * @brief Transform the RSS constellation of the ego vehicle and the object to be checked.
     103                 :            :    *
     104                 :            :    * @param [in] time_index the time index of the current constellation
     105                 :            :    * @param [in] worldConstellation the information on the current constellation with the object to be checked in
     106                 :            :    * outside world format
     107                 :            :    * @param [out] relativeConstellation the relative constellation to be analyzed by RSS in internal relative format
     108                 :            :    *
     109                 :            :    * @return true if the constellation could be created, false if there was an error during the operation.
     110                 :            :    */
     111                 :            :   bool extractConstellationInputRangeChecked(world::TimeIndex const &time_index,
     112                 :            :                                              world::Constellation const &worldConstellation,
     113                 :            :                                              RelativeConstellation &relativeConstellation);
     114                 :            :   enum class MergeMode
     115                 :            :   {
     116                 :            :     EgoVehicle,
     117                 :            :     OtherVehicle
     118                 :            :   };
     119                 :            :   bool mergeVehicleStates(MergeMode const &mergeMode,
     120                 :            :                           RelativeObjectState const &other_state,
     121                 :            :                           RelativeObjectState &mergedVehicleState);
     122                 :            :   bool mergeConstellations(core::RelativeConstellation const &otherConstellation,
     123                 :            :                            core::RelativeConstellation &mergedConstellation);
     124                 :            : 
     125                 :            :   structured::RssConstellationIdProvider mConstellationIdProvider;
     126                 :            : };
     127                 :            : 
     128                 :            : } // namespace core
     129                 :            : } // namespace rss
     130                 :            : } // namespace ad

Generated by: LCOV version 1.14