LCOV - code coverage report
Current view: top level - src/unstructured - TrajectoryPedestrian.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 0 2 0.0 %
Date: 2024-05-02 12:32:33 Functions: 0 1 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2020-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/physics/RatioValue.hpp>
      15                 :            : #include "TrajectoryCommon.hpp"
      16                 :            : #include "ad/rss/situation/VehicleState.hpp"
      17                 :            : #include "ad/rss/unstructured/Geometry.hpp"
      18                 :            : 
      19                 :            : /*!
      20                 :            :  * @brief namespace ad
      21                 :            :  */
      22                 :            : namespace ad {
      23                 :            : /*!
      24                 :            :  * @brief namespace rss
      25                 :            :  */
      26                 :            : namespace rss {
      27                 :            : /*!
      28                 :            :  * @brief namespace unstructured
      29                 :            :  */
      30                 :            : namespace unstructured {
      31                 :            : 
      32                 :            : /**
      33                 :            :  * @brief Calculates the trajectory sets of a pedestrian
      34                 :            :  */
      35                 :            : class TrajectoryPedestrian
      36                 :            : {
      37                 :            : public:
      38                 :            :   /**
      39                 :            :    * @brief The maximum radius before assuming forward movement
      40                 :            :    */
      41                 :            :   static const ad::physics::Distance maxRadius;
      42                 :            : 
      43                 :            :   /**
      44                 :            :    * @brief Step width while calculating points on circle
      45                 :            :    */
      46                 :            :   static const ad::physics::Angle circleStepWidth;
      47                 :            : 
      48                 :          0 :   TrajectoryPedestrian()
      49                 :            :   {
      50                 :          0 :   }
      51                 :            : 
      52                 :            :   /**
      53                 :            :    * @brief Calculate the trajectory sets for braking and continue forward behavior
      54                 :            :    *
      55                 :            :    * @param[in]  vehicleState           current state of the pedestrian
      56                 :            :    * @param[out] brakePolygon           the trajectory set for braking behavior
      57                 :            :    * @param[out] continueForwardPolygon the trajectory set for continue-forward behavior
      58                 :            :    *
      59                 :            :    * @returns false if a failure occurred during calculations, true otherwise
      60                 :            :    */
      61                 :            :   bool calculateTrajectorySets(situation::VehicleState const &vehicleState,
      62                 :            :                                Polygon &brakePolygon,
      63                 :            :                                Polygon &continueForwardPolygon);
      64                 :            : 
      65                 :            : private:
      66                 :            :   /**
      67                 :            :    * @brief Calculate all trajectory points at response time
      68                 :            :    *
      69                 :            :    * @param[in]  vehicleState current state of the vehicle
      70                 :            :    * @param[out] frontSide the trajectory points defining the front
      71                 :            :    * @param[out] backSide the trajectory points defining the back
      72                 :            :    *
      73                 :            :    * @returns false if a failure occurred during calculations, true otherwise
      74                 :            :    */
      75                 :            :   bool getResponseTimeTrajectoryPoints(situation::VehicleState const &vehicleState,
      76                 :            :                                        TrajectorySetStep &frontSide,
      77                 :            :                                        TrajectorySetStep &backSide) const;
      78                 :            : 
      79                 :            :   /**
      80                 :            :    * @brief Calculate a single trajectory point
      81                 :            :    *
      82                 :            :    * @param[inout] currentPoint     point to use for calculation
      83                 :            :    * @param[in]  dynamics           current dynamics of the vehicle
      84                 :            :    * @param[in]  duration           duration of movement
      85                 :            :    * @param[in]  acceleration       acceleration to apply
      86                 :            :    * @param[in]  yawRateChangeRatio heading change ratio
      87                 :            :    *
      88                 :            :    * @returns false if a failure occurred during calculations, true otherwise
      89                 :            :    */
      90                 :            :   bool calculateTrajectoryPoint(TrajectoryPoint &currentPoint,
      91                 :            :                                 world::RssDynamics const &dynamics,
      92                 :            :                                 physics::Duration const &duration,
      93                 :            :                                 ad::physics::Acceleration const &acceleration,
      94                 :            :                                 ad::physics::RatioValue const &yawRateChangeRatio) const;
      95                 :            : 
      96                 :            :   /**
      97                 :            :    * @brief Calculate a single trajectory point
      98                 :            :    *
      99                 :            :    * @param[inout] currentPoint     point to use for calculation
     100                 :            :    * @param[in]  dynamics           current dynamics of the vehicle
     101                 :            :    * @param[in]  distance           distance to move
     102                 :            :    * @param[in]  yawRateChangeRatio heading change ratio
     103                 :            :    *
     104                 :            :    * @returns false if a failure occurred during calculations, true otherwise
     105                 :            :    */
     106                 :            :   void calculateTrajectoryPoint(TrajectoryPoint &currentPoint,
     107                 :            :                                 world::RssDynamics const &dynamics,
     108                 :            :                                 physics::Distance const &distance,
     109                 :            :                                 ad::physics::RatioValue const &angleChangeRatio) const;
     110                 :            : 
     111                 :            :   /**
     112                 :            :    * @brief Calculate a point on a straight line
     113                 :            :    *
     114                 :            :    * @param[in]  currentPoint point at response time
     115                 :            :    * @param[in]  distance     distance of the final point
     116                 :            :    * @param[out] resultPoint  resulting point
     117                 :            :    */
     118                 :            :   void calculateTrajectoryPointStraight(TrajectoryPoint const &currentPoint,
     119                 :            :                                         physics::Distance const &distance,
     120                 :            :                                         TrajectoryPoint &resultPoint) const;
     121                 :            : 
     122                 :            :   /**
     123                 :            :    * @brief Calculate points of trajectory set step on a straight line
     124                 :            :    *
     125                 :            :    * @param[in]  distance     distance of the final points
     126                 :            :    * @param[in]  step         current step
     127                 :            :    * @param[out] resultStep   resulting step
     128                 :            :    */
     129                 :            :   void calculateTrajectoryPointsStraight(physics::Distance const &distance,
     130                 :            :                                          TrajectorySetStep const &step,
     131                 :            :                                          TrajectorySetStep &resultStep) const;
     132                 :            : 
     133                 :            :   /**
     134                 :            :    * @brief Calculate a side polygon
     135                 :            :    *
     136                 :            :    * @param[in]  vehicleState          current state of the vehicle
     137                 :            :    * @param[in]  finalPointMin         minimal point
     138                 :            :    * @param[in]  finalPointMax         maximum point
     139                 :            :    *
     140                 :            :    * @returns polygon describing the side
     141                 :            :    */
     142                 :            :   Polygon calculateSidePolygon(situation::VehicleState const &vehicleState,
     143                 :            :                                TrajectoryPoint const &finalPointMin,
     144                 :            :                                TrajectoryPoint const &finalPointMax) const;
     145                 :            : 
     146                 :            :   /**
     147                 :            :    * @brief Calculate the trajectory sets if pedestrian stands still
     148                 :            :    *
     149                 :            :    * @param[in]  vehicleState           current state of the pedestrian
     150                 :            :    * @param[in]  timeToStop             time to step with stated braking pattern
     151                 :            :    * @param[out] brakePolygon           the trajectory set for braking behavior
     152                 :            :    * @param[out] continueForwardPolygon the trajectory set for continue-forward behavior
     153                 :            :    *
     154                 :            :    * @returns false if a failure occurred during calculations, true otherwise
     155                 :            :    */
     156                 :            :   bool calculateTrajectorySetsStandingStill(situation::VehicleState const &vehicleState,
     157                 :            :                                             physics::Duration const &timeToStop,
     158                 :            :                                             Polygon &brakePolygon,
     159                 :            :                                             Polygon &continueForwardPolygon) const;
     160                 :            : 
     161                 :            :   /**
     162                 :            :    * @brief Calculate the trajectory sets if pedestrian is currently moving
     163                 :            :    *
     164                 :            :    * @param[in]  vehicleState           current state of the pedestrian
     165                 :            :    * @param[in]  timeToStop             time to step with stated braking pattern
     166                 :            :    * @param[out] brakePolygon           the trajectory set for braking behavior
     167                 :            :    * @param[out] continueForwardPolygon the trajectory set for continue-forward behavior
     168                 :            :    *
     169                 :            :    * @returns false if a failure occurred during calculations, true otherwise
     170                 :            :    */
     171                 :            :   bool calculateTrajectorySetsMoving(situation::VehicleState const &vehicleState,
     172                 :            :                                      physics::Duration const &timeToStop,
     173                 :            :                                      Polygon &brakePolygon,
     174                 :            :                                      Polygon &continueForwardPolygon) const;
     175                 :            : };
     176                 :            : 
     177                 :            : } // namespace unstructured
     178                 :            : } // namespace rss
     179                 :            : } // namespace ad

Generated by: LCOV version 1.14