LCOV - code coverage report
Current view: top level - src/world - RssObjectPositionExtractor.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 7 7 100.0 %
Date: 2024-04-16 14:13:10 Functions: 1 1 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 <limits>
      15                 :            : #include "ad/rss/world/LaneSegment.hpp"
      16                 :            : #include "ad/rss/world/Object.hpp"
      17                 :            : 
      18                 :            : /*!
      19                 :            :  * @brief namespace ad
      20                 :            :  */
      21                 :            : namespace ad {
      22                 :            : /*!
      23                 :            :  * @brief namespace rss
      24                 :            :  */
      25                 :            : namespace rss {
      26                 :            : /*!
      27                 :            :  * @brief namespace world
      28                 :            :  */
      29                 :            : namespace world {
      30                 :            : 
      31                 :            : /**
      32                 :            :  * @brief class to store information of object position dimensions
      33                 :            :  */
      34                 :            : class ObjectDimensions
      35                 :            : {
      36                 :            : public:
      37                 :      28251 :   ObjectDimensions()
      38                 :      28251 :   {
      39                 :      28251 :     longitudinalDimensions.maximum = std::numeric_limits<physics::Distance>::lowest();
      40                 :      28251 :     longitudinalDimensions.minimum = std::numeric_limits<physics::Distance>::max();
      41                 :            : 
      42                 :      28251 :     lateralDimensions.maximum = std::numeric_limits<physics::Distance>::lowest();
      43                 :      28251 :     lateralDimensions.minimum = std::numeric_limits<physics::Distance>::max();
      44                 :      28251 :   }
      45                 :            : 
      46                 :            :   /**
      47                 :            :    * @brief range of longitudinal object position
      48                 :            :    */
      49                 :            :   physics::MetricRange longitudinalDimensions;
      50                 :            : 
      51                 :            :   /**
      52                 :            :    * @brief range of lateral object position
      53                 :            :    */
      54                 :            :   physics::MetricRange lateralDimensions;
      55                 :            : 
      56                 :            :   /**
      57                 :            :    * @brief flag to indicate if the object is on the positive driving lane
      58                 :            :    */
      59                 :            :   bool onPositiveLane{false};
      60                 :            : 
      61                 :            :   /**
      62                 :            :    * @brief flag to indicate if the object is on the negative driving lane
      63                 :            :    */
      64                 :            :   bool onNegativeLane{false};
      65                 :            : 
      66                 :            :   /**
      67                 :            :    * @brief range of intersection position
      68                 :            :    *
      69                 :            :    * minimum: minimal distance to intersection entry
      70                 :            :    * maximum: maximum distance to intersection exit
      71                 :            :    */
      72                 :            :   physics::MetricRange intersectionPosition;
      73                 :            : };
      74                 :            : 
      75                 :            : /**
      76                 :            :  * @brief class to calculate object positions
      77                 :            :  *
      78                 :            :  * class will receive road and lane segments in consecutive order and will :
      79                 :            :  *   - calculate the position of the object specified by the occupiedRegions in the situation coordinate system
      80                 :            :  *   - calculate the position to intersection if laneSegments are part of an intersection
      81                 :            :  *   - determine whether the object is on lanes in positive or negative driving direction
      82                 :            :  */
      83                 :            : class RssObjectPositionExtractor
      84                 :            : {
      85                 :            : public:
      86                 :            :   /**
      87                 :            :    * @brief Constructor
      88                 :            :    *
      89                 :            :    * @param occupiedRegions representing the object
      90                 :            :    */
      91                 :            :   explicit RssObjectPositionExtractor(OccupiedRegionVector const &occupiedRegions);
      92                 :            : 
      93                 :            :   /**
      94                 :            :    * @brief Indicate that there is a new road segment
      95                 :            :    *
      96                 :            :    * @param[in] longitudinalStartMin minimal distance in the situation based coordinate system to the start of the road
      97                 :            :    * segment
      98                 :            :    * @param[in] longitudinalStartMax maximum distance in the situation based coordinate system to the start of the road
      99                 :            :    * segment
     100                 :            :    *
     101                 :            :    * @returns return false if an error occurred, true otherwise.
     102                 :            :    */
     103                 :            :   bool newRoadSegment(physics::Distance const &longitudinalStartMin, physics::Distance const &longitudinalStartMax);
     104                 :            : 
     105                 :            :   /**
     106                 :            :    * @brief Add information of the next adjacent laneSegement
     107                 :            :    *
     108                 :            :    * @param[in] lateralDistance minimal and maximal lateral distance to the begin of the segment
     109                 :            :    * @param[in] laneSegment the information about the laneSegment
     110                 :            :    *
     111                 :            :    * @returns false if an error occurred, true otherwise.
     112                 :            :    */
     113                 :            :   bool newLaneSegment(physics::MetricRange lateralDistance, LaneSegment const &laneSegment);
     114                 :            : 
     115                 :            :   /**
     116                 :            :    * @brief Retrieve the objectDimension information back from the class
     117                 :            :    *
     118                 :            :    * @param[out] objectDimensions
     119                 :            :    *
     120                 :            :    * @returns true if calculation is complete, false if not all occupiedRegions are processed yet
     121                 :            :    */
     122                 :            :   bool getObjectDimensions(ObjectDimensions &objectDimensions);
     123                 :            : 
     124                 :            : private:
     125                 :            :   OccupiedRegionVector mOccupiedRegions;
     126                 :            : 
     127                 :            :   physics::Distance mCurrentLongitudinalMax{0};
     128                 :            :   physics::Distance mCurrentLongitudinalMin{0};
     129                 :            : 
     130                 :            :   bool mIntersectionReached{false};
     131                 :            :   bool mIntersectionEndReached{false};
     132                 :            : 
     133                 :            :   ObjectDimensions mObjectDimensions;
     134                 :            : };
     135                 :            : 
     136                 :            : } // namespace world
     137                 :            : } // namespace rss
     138                 :            : } // namespace ad

Generated by: LCOV version 1.14