LCOV - code coverage report
Current view: top level - src/situation - RssStructuredSceneIntersectionChecker.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 2 2 100.0 %
Date: 2024-04-16 14:13:10 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                 :            : /**
      10                 :            :  * @file
      11                 :            :  */
      12                 :            : 
      13                 :            : #pragma once
      14                 :            : 
      15                 :            : #include <cstdint>
      16                 :            : #include <map>
      17                 :            : #include "ad/rss/situation/Situation.hpp"
      18                 :            : #include "ad/rss/state/RssState.hpp"
      19                 :            : #include "ad/rss/world/TimeIndex.hpp"
      20                 :            : 
      21                 :            : /*!
      22                 :            :  * @brief namespace ad
      23                 :            :  */
      24                 :            : namespace ad {
      25                 :            : /*!
      26                 :            :  * @brief namespace rss
      27                 :            :  */
      28                 :            : namespace rss {
      29                 :            : /*!
      30                 :            :  * @brief namespace situation
      31                 :            :  */
      32                 :            : namespace situation {
      33                 :            : 
      34                 :            : /**
      35                 :            :  * @brief Class to check whether an intersection is safe and to determine the proper response for the situation
      36                 :            :  *
      37                 :            :  *
      38                 :            :  * Note: Implements the checks and responses given by the definitions 16-18 of the RSS paper (arXiv:1708.06374v6)
      39                 :            :  *       The more detailed lateral intersection handling according to definitions 14 and 15 is not considered, yet.
      40                 :            :  *       Instead, the current implementation always considers a lateral conflict within intersections and doesn't
      41                 :            :  * trigger any lateral response.
      42                 :            :  *
      43                 :            :  * Class performs required check to if situation is safe
      44                 :            :  * Class will maintain the previous state of the situation in order to provide the proper response.
      45                 :            :  */
      46                 :            : class RssStructuredSceneIntersectionChecker
      47                 :            : {
      48                 :            : public:
      49                 :            :   /*!
      50                 :            :    * \brief Enum LongitudinalResponse
      51                 :            :    *
      52                 :            :    * Enumeration defining the possible longitudinal responses
      53                 :            :    *
      54                 :            :    * Be aware: there has to be a strict order of the enumeration values according to
      55                 :            :    * the strictness of the response
      56                 :            :    */
      57                 :            :   enum class IntersectionState : std::uint32_t
      58                 :            :   {
      59                 :            :     NonPrioAbleToBreak = 0u,       /*!< NonPrio-Vehicle can stop in front intersection */
      60                 :            :     SafeLongitudinalDistance = 1u, /*!< There is a safe longitudinal distance  between the vehicles*/
      61                 :            :     NoTimeOverlap = 2u             /*!< There is no time overlap between the paths of the two vehicles */
      62                 :            :   };
      63                 :            : 
      64                 :            :   /**
      65                 :            :    * @brief Constructor
      66                 :            :    */
      67                 :        735 :   RssStructuredSceneIntersectionChecker() = default;
      68                 :            : 
      69                 :            :   /**
      70                 :            :    * @brief Destructor
      71                 :            :    */
      72                 :        735 :   ~RssStructuredSceneIntersectionChecker() = default;
      73                 :            : 
      74                 :            :   /**
      75                 :            :    * @brief Calculate safety checks and determine required rssState for intersection situations
      76                 :            :    *
      77                 :            :    * @param[in]  timeIndex the time index of the situation
      78                 :            :    * @param[in]  situation situation to analyze
      79                 :            :    * @param[out] rssState  rssState of the ego vehicle
      80                 :            :    *
      81                 :            :    * @returns false if a failure occurred during calculations, true otherwise
      82                 :            :    *
      83                 :            :    */
      84                 :            :   bool calculateRssStateIntersection(world::TimeIndex const &timeIndex,
      85                 :            :                                      Situation const &situation,
      86                 :            :                                      state::RssState &rssState);
      87                 :            : 
      88                 :            : private:
      89                 :            :   bool checkLateralIntersect(Situation const &situation, bool &isSafe);
      90                 :            : 
      91                 :            :   bool checkIntersectionSafe(Situation const &situation,
      92                 :            :                              state::RssStateInformation &rssStateInformation,
      93                 :            :                              bool &isSafe,
      94                 :            :                              IntersectionState &intersectionState);
      95                 :            : 
      96                 :            :   typedef std::map<SituationId, IntersectionState> RssIntersectionStateMap;
      97                 :            : 
      98                 :            :   /**
      99                 :            :    * @brief last safe IntersectionState of each situation of previous time step
     100                 :            :    */
     101                 :            :   RssIntersectionStateMap mLastSafeStateMap;
     102                 :            : 
     103                 :            :   /**
     104                 :            :    * @brief new safe IntersectionState of each situation of current time step
     105                 :            :    */
     106                 :            :   RssIntersectionStateMap mNewSafeStateMap;
     107                 :            : 
     108                 :            :   /**
     109                 :            :    * @brief time index of the current processing step
     110                 :            :    * If time index increases we need to update the state maps
     111                 :            :    */
     112                 :            :   world::TimeIndex mCurrentTimeIndex{0u};
     113                 :            : };
     114                 :            : 
     115                 :            : } // namespace situation
     116                 :            : } // namespace rss
     117                 :            : } // namespace ad

Generated by: LCOV version 1.14