LCOV - code coverage report
Current view: top level - include/ad/rss/map - RssSceneCreator.hpp (source / functions) Hit Total Coverage
Test: ad_rss_map_integration Lines: 5 5 100.0 %
Date: 2024-04-23 14:35:59 Functions: 3 3 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2019-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/map/intersection/Intersection.hpp>
      15                 :            : #include <ad/map/route/FullRoute.hpp>
      16                 :            : #include <ad/rss/world/WorldModel.hpp>
      17                 :            : #include "ad/rss/map/RssObjectConversion.hpp"
      18                 :            : #include "ad/rss/map/RssSceneCreation.hpp"
      19                 :            : 
      20                 :            : /*!
      21                 :            :  * @brief namespace ad
      22                 :            :  */
      23                 :            : namespace ad {
      24                 :            : /*!
      25                 :            :  * @brief namespace rss
      26                 :            :  */
      27                 :            : namespace rss {
      28                 :            : /*!
      29                 :            :  * @brief namespace map
      30                 :            :  */
      31                 :            : namespace map {
      32                 :            : 
      33                 :            : /*! forward declaration of RssSceneCreation */
      34                 :            : class RssSceneCreation;
      35                 :            : 
      36                 :            : /*!
      37                 :            :  * @brief class providing support to create and append RSS Scenes
      38                 :            :  */
      39                 :            : class RssSceneCreator
      40                 :            : {
      41                 :            : public:
      42                 :            :   /*!
      43                 :            :    * @brief constructor
      44                 :            :    *
      45                 :            :    * @param[in] restrictSpeedLimitMode the mode to select the behavior of objectRssDynamics.maxSpeedOnAcceleration and
      46                 :            :    * egoMaxSpeedOnAcceleration
      47                 :            :    * parameter
      48                 :            :    * @param[in] greenTrafficLights the list of known green traffic lights.
      49                 :            :    *   Required to derive the correct priority rule for the ego vehicle when approaching a traffic light intersection.
      50                 :            :    * @param[in/out] sceneCreation the scene creation object managing the world model where the newly created scenes are
      51                 :            :    * appended
      52                 :            :    */
      53                 :            :   RssSceneCreator(RssSceneCreation::RestrictSpeedLimitMode const &restrictSpeedLimitMode,
      54                 :            :                   ::ad::map::landmark::LandmarkIdSet const &greenTrafficLights,
      55                 :            :                   RssSceneCreation &sceneCreation);
      56                 :            : 
      57                 :            :   /*!
      58                 :            :    * @brief overloaded constructor using default values
      59                 :            :    *
      60                 :            :    * @param[in/out] sceneCreation the scene creation object managing the world model where the newly created scenes are
      61                 :            :    * appended
      62                 :            :    */
      63                 :            :   explicit RssSceneCreator(RssSceneCreation &sceneCreation);
      64                 :            : 
      65                 :            :   /*!
      66                 :            :    * \brief standard destructor
      67                 :            :    */
      68                 :        216 :   ~RssSceneCreator() = default;
      69                 :            : 
      70                 :            :   /*!
      71                 :            :    * @brief append a not relevant scene
      72                 :            :    *
      73                 :            :    * @param[in] route the full route of the ego object (allowed to be empty)
      74                 :            :    * @param[in] egoObject the ego object basic information
      75                 :            :    * @param[in] otherObject the other object basic information
      76                 :            :    *
      77                 :            :    * @returns \c true if appending of the scene succeeded.
      78                 :            :    */
      79                 :            :   bool appendNotRelevantScene(::ad::map::route::FullRoute const &route,
      80                 :            :                               RssObjectConversion::ConstPtr egoObject,
      81                 :            :                               RssObjectConversion::ConstPtr otherObject);
      82                 :            : 
      83                 :            :   /*!
      84                 :            :    * @brief append a non intersection scene
      85                 :            :    *
      86                 :            :    * @param[in] connectingRoute the connectingRoute route between the ego and the other object
      87                 :            :    * @param[in] situationType the concrete situation type (SituationType::SameDirection or
      88                 :            :    * SituationType::OppositeDirection)
      89                 :            :    * @param[in] egoObject the ego object basic information
      90                 :            :    * @param[in] otherObject the other object basic information
      91                 :            :    *
      92                 :            :    * @returns \c true if appending of the scene succeeded.
      93                 :            :    */
      94                 :            :   bool appendNonIntersectionScene(::ad::map::route::ConnectingRoute const &connectingRoute,
      95                 :            :                                   ::ad::rss::situation::SituationType const &situationType,
      96                 :            :                                   RssObjectConversion::ConstPtr egoObject,
      97                 :            :                                   RssObjectConversion::ConstPtr otherObject);
      98                 :            : 
      99                 :            :   /*!
     100                 :            :    * @brief append a merging scene
     101                 :            :    *
     102                 :            :    * @param[in] connectingRoute the merging connectingRoute route of the ego and the other object
     103                 :            :    * @param[in] situationType the concrete situation type (usually one of the SituationType::Intersection*)
     104                 :            :    * @param[in] egoObject the ego object basic information
     105                 :            :    * @param[in] otherObject the other object basic information
     106                 :            :    *
     107                 :            :    * @returns \c true if appending of the scene succeeded.
     108                 :            :    */
     109                 :            :   bool appendMergingScene(::ad::map::route::ConnectingRoute const &connectingRoute,
     110                 :            :                           ::ad::rss::situation::SituationType const &situationType,
     111                 :            :                           RssObjectConversion::ConstPtr egoObject,
     112                 :            :                           RssObjectConversion::ConstPtr otherObject);
     113                 :            : 
     114                 :            :   /*!
     115                 :            :    * @brief append an intersection scene
     116                 :            :    *
     117                 :            :    * @param[in] intersection the relevant intersection to consider
     118                 :            :    * @param[in] egoRoute the object route used to create the intersection object
     119                 :            :    * @param[in] objectRoute the object route interacting with the ego route in the intersection
     120                 :            :    * @param[in] intersectionOtherRoute the route the intersection was NOT created with (either egoRoute or objectRoute)
     121                 :            :    * @param[in] egoObject the ego object basic information
     122                 :            :    * @param[in] otherObject the other object basic information
     123                 :            :    *
     124                 :            :    * @returns \c true if appending of the scene succeeded.
     125                 :            :    */
     126                 :            :   bool appendIntersectionScene(::ad::map::intersection::IntersectionPtr intersection,
     127                 :            :                                ::ad::map::route::FullRoute const &egoRoute,
     128                 :            :                                ::ad::map::route::FullRoute const &objectRoute,
     129                 :            :                                ::ad::map::route::FullRoute const &intersectionOtherRoute,
     130                 :            :                                RssObjectConversion::ConstPtr egoObject,
     131                 :            :                                RssObjectConversion::ConstPtr otherObject);
     132                 :            : 
     133                 :            :   /*!
     134                 :            :    * @brief append a road boundary scene
     135                 :            :    *
     136                 :            :    * @param[in] egoRoute the object route used to create the intersection object
     137                 :            :    * @param[in] egoObject the ego object basic information
     138                 :            :    *
     139                 :            :    * @returns \c true if appending of the scene succeeded.
     140                 :            :    */
     141                 :            :   bool appendRoadBoundaryScenes(::ad::map::route::FullRoute const &egoRoute, RssObjectConversion::ConstPtr egoObject);
     142                 :            : 
     143                 :            :   /*!
     144                 :            :    * @returns the constant ObjectId of the virtual right border
     145                 :            :    */
     146                 :          3 :   static ::ad::rss::world::ObjectId getRightBorderObjectId()
     147                 :            :   {
     148                 :          3 :     return std::numeric_limits<::ad::rss::world::ObjectId>::max();
     149                 :            :   }
     150                 :            : 
     151                 :            :   /*!
     152                 :            :    * @returns the constant ObjectId of the virtual left border
     153                 :            :    */
     154                 :          3 :   static ::ad::rss::world::ObjectId getLeftBorderObjectId()
     155                 :            :   {
     156                 :          3 :     return std::numeric_limits<::ad::rss::world::ObjectId>::max() - 1;
     157                 :            :   }
     158                 :            : 
     159                 :            :   bool appendUnstructuredScene(RssObjectConversion::ConstPtr iEgoObject, RssObjectConversion::ConstPtr iOtherObject);
     160                 :            : 
     161                 :            : private:
     162                 :            :   /**
     163                 :            :    * @brief helper function to actually create the road area
     164                 :            :    *
     165                 :            :    * @param[in] route The route the road area is created from
     166                 :            :    * @param[in] minLaneOffset The minimum lane offset to be taken into account
     167                 :            :    * @param[in] maxLaneOffset The maximum lane offset to be taken into account
     168                 :            :    * @param[in] intersectionLanes The lanes to be marked as intersection (the road area creation stops when intersection
     169                 :            :    * is left)
     170                 :            :    * @param[in] objects The objects to be updated while creating the route.
     171                 :            :    */
     172                 :            :   ::ad::rss::world::RoadArea createRoadArea(::ad::map::route::FullRoute const &route,
     173                 :            :                                             ::ad::map::route::RouteLaneOffset const minLaneOffset,
     174                 :            :                                             ::ad::map::route::RouteLaneOffset const maxLaneOffset,
     175                 :            :                                             ::ad::map::lane::LaneIdSet const &intersectionLanes,
     176                 :            :                                             std::vector<RssObjectConversion::Ptr> objects);
     177                 :            : 
     178                 :            :   /**
     179                 :            :    * @brief helper function to create a road area for non intersection scenes
     180                 :            :    *
     181                 :            :    * @param[in] route The route the road area should be created from
     182                 :            :    * @param[in] objects The objects to be updated while creating the route.
     183                 :            :    */
     184                 :            :   ::ad::rss::world::RoadArea createNonIntersectionRoadArea(::ad::map::route::FullRoute const &route,
     185                 :            :                                                            std::vector<RssObjectConversion::Ptr> objects);
     186                 :            : 
     187                 :            :   /**
     188                 :            :    * @brief helper function to create a road area for merging scenes
     189                 :            :    *
     190                 :            :    * @param[in] route The route the road area should be created from
     191                 :            :    * @param[in] object The object to be updated while creating the route.
     192                 :            :    */
     193                 :            :   ::ad::rss::world::RoadArea createMergingRoadArea(::ad::map::route::FullRoute const &route,
     194                 :            :                                                    RssObjectConversion::Ptr object);
     195                 :            : 
     196                 :            :   /**
     197                 :            :    * @brief helper function to create a road area for intersection scenes
     198                 :            :    *
     199                 :            :    * @param[in] route The route the road area should be created from
     200                 :            :    * @param[in] intersection The intersection on the route the road area should be created for
     201                 :            :    * @param[in] object The object to be updated while creating the route.
     202                 :            :    */
     203                 :            :   ::ad::rss::world::RoadArea createIntersectionRoadArea(::ad::map::route::FullRoute const &route,
     204                 :            :                                                         ::ad::map::intersection::IntersectionConstPtr intersection,
     205                 :            :                                                         RssObjectConversion::Ptr object);
     206                 :            : 
     207                 :            :   /**
     208                 :            :    * @brief helper function to actually append a new scene to the world model
     209                 :            :    *
     210                 :            :    * @param[in] situationType The type of situation
     211                 :            :    * @param[in] egoObject The ego object of the scene
     212                 :            :    * @param[in] egoRoad The ego road of the scene
     213                 :            :    * @param[in] otherObject The other object of the scene
     214                 :            :    * @param[in] intersectingRoad The intersecting road of the scene
     215                 :            :    */
     216                 :            :   bool appendScene(::ad::rss::situation::SituationType const &situationType,
     217                 :            :                    RssObjectConversion::ConstPtr egoObject,
     218                 :            :                    ::ad::rss::world::RoadArea const &egoRoad,
     219                 :            :                    RssObjectConversion::ConstPtr otherObject,
     220                 :            :                    ::ad::rss::world::RoadArea const &intersectingRoad);
     221                 :            : 
     222                 :            :   double mSpeedLimitFactor;
     223                 :            :   ::ad::map::landmark::LandmarkIdSet mGreenTrafficLights;
     224                 :            :   RssSceneCreation &mSceneCreation;
     225                 :            : };
     226                 :            : 
     227                 :            : } // namespace map
     228                 :            : } // namespace rss
     229                 :            : } // namespace ad

Generated by: LCOV version 1.14