LCOV - code coverage report
Current view: top level - test_support/src - RssObjectAdapterTest.cpp (source / functions) Hit Total Coverage
Test: ad_rss_map_integration Lines: 66 66 100.0 %
Date: 2025-07-22 06:56:19 Functions: 4 4 100.0 %
Branches: 24 48 50.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                 :            : #include "ad/rss/map/test_support/RssObjectAdapterTest.hpp"
      10                 :            : #include <functional>
      11                 :            : 
      12                 :            : namespace ad {
      13                 :            : namespace rss {
      14                 :            : namespace map {
      15                 :            : namespace test_support {
      16                 :            : 
      17                 :            : const ::ad::physics::Duration CheckerControlTest::cResponseTimeEgoVehicle{0.8};
      18                 :            : const ::ad::physics::Duration CheckerControlTest::cResponseTimeOtherVehicles{1.0};
      19                 :            : 
      20                 :            : const ::ad::physics::Acceleration CheckerControlTest::cMaximumLongitudinalAcceleration{1.5};
      21                 :            : const ::ad::physics::Acceleration CheckerControlTest::cMinimumLongitudinalBrakingDeceleleration{-6};
      22                 :            : const ::ad::physics::Acceleration CheckerControlTest::cMaximumLongitudinalBrakingDeceleleration{-8};
      23                 :            : const ::ad::physics::Acceleration CheckerControlTest::cMinimumLongitudinalBrakingDecelelerationCorrect{-5};
      24                 :            : 
      25                 :            : const ::ad::physics::Acceleration CheckerControlTest::cMaximumLateralAcceleration{0.2};
      26                 :            : const ::ad::physics::Acceleration CheckerControlTest::cMinimumLateralBrakingDeceleleration{-0.8};
      27                 :            : 
      28                 :        219 : CheckerControlTest::CheckerControlTest()
      29                 :            : {
      30                 :        219 :   mRestrictSpeedLimitMode = ::ad::rss::map::RssRestrictSpeedLimitMode::None;
      31                 :        219 :   mPedestrianWorldModelCreationMode = ::ad::rss::map::RssConstellationCreationMode::Unstructured;
      32                 :        219 :   mVehicleWorldModelCreationMode = ::ad::rss::map::RssConstellationCreationMode::Structured;
      33                 :        219 :   mArtificialObjectWorldModelCreationMode = ::ad::rss::map::RssConstellationCreationMode::Unstructured;
      34                 :        219 :   mArtificialPedestrianWorldModelCreationMode = ::ad::rss::map::RssConstellationCreationMode::Unstructured;
      35                 :        219 :   mArtificialVehicleWorldModelCreationMode = ::ad::rss::map::RssConstellationCreationMode::Structured;
      36                 :            : 
      37                 :            :   using namespace std::placeholders;
      38   [ +  -  +  - ]:        219 :   registerDefaultRssDynamicsCallback(::ad::rss::world::ObjectType::Pedestrian,
      39         [ +  - ]:        219 :                                      std::bind(&CheckerControlTest::defaultPedestrianRssDynamicsCallback, this, _1));
      40   [ +  -  +  - ]:        219 :   registerDefaultRssDynamicsCallback(::ad::rss::world::ObjectType::ArtificialPedestrian,
      41         [ +  - ]:        219 :                                      std::bind(&CheckerControlTest::defaultPedestrianRssDynamicsCallback, this, _1));
      42   [ +  -  +  - ]:        219 :   registerDefaultRssDynamicsCallback(::ad::rss::world::ObjectType::OtherVehicle,
      43         [ +  - ]:        219 :                                      std::bind(&CheckerControlTest::defaultOtherVehicleRssDynamicsCallback, this, _1));
      44   [ +  -  +  - ]:        219 :   registerDefaultRssDynamicsCallback(::ad::rss::world::ObjectType::ArtificialVehicle,
      45         [ +  - ]:        219 :                                      std::bind(&CheckerControlTest::defaultOtherVehicleRssDynamicsCallback, this, _1));
      46   [ +  -  +  - ]:        219 :   registerDefaultRssDynamicsCallback(::ad::rss::world::ObjectType::EgoVehicle,
      47         [ +  - ]:        219 :                                      std::bind(&CheckerControlTest::defaultEgoVehicleRssDynamicsCallback, this, _1));
      48   [ +  -  +  - ]:        219 :   registerVehicleConstellationCallback(
      49         [ +  - ]:        219 :     std::bind(&CheckerControlTest::vehicleConstellationCallback, this, _1, _2, _3, _4, _5));
      50   [ +  -  +  - ]:        219 :   registerPedestrianConstellationCallback(
      51         [ +  - ]:        219 :     std::bind(&CheckerControlTest::pedestrianConstellationCallback, this, _1, _2, _3, _4, _5));
      52   [ +  -  +  - ]:        219 :   registerArtificialObjectConstellationCallback(
      53         [ +  - ]:        219 :     std::bind(&CheckerControlTest::artificialObjectConstellationCallback, this, _1, _2, _3, _4));
      54                 :            : 
      55                 :            :   // allow 100m jumps
      56                 :        219 :   setPositionJumpTraveledDistance(ad::physics::Distance(100.));
      57                 :        219 : }
      58                 :            : 
      59                 :       1061 : ::ad::rss::world::UnstructuredSettings CheckerControlTest::getUnstructuredSettings()
      60                 :            : {
      61                 :       1061 :   ::ad::rss::world::UnstructuredSettings unstructured_settings;
      62                 :       1061 :   unstructured_settings.pedestrian_turning_radius = ad::physics::Distance(2.0);
      63                 :       1061 :   unstructured_settings.drive_away_max_angle = ad::physics::Angle(2.4);
      64                 :       1061 :   unstructured_settings.vehicle_yaw_rate_change = ad::physics::AngularAcceleration(0.3);
      65                 :       1061 :   unstructured_settings.vehicle_min_radius = ad::physics::Distance(3.5);
      66                 :       1061 :   unstructured_settings.vehicle_trajectory_calculation_step = ad::physics::Duration(0.2);
      67                 :       1061 :   unstructured_settings.vehicle_front_intermediate_yaw_rate_change_ratio_steps = 8;
      68                 :       1061 :   unstructured_settings.vehicle_back_intermediate_yaw_rate_change_ratio_steps = 0;
      69                 :       1061 :   unstructured_settings.vehicle_continue_forward_intermediate_yaw_rate_change_ratio_steps = 8;
      70                 :       1061 :   unstructured_settings.vehicle_continue_forward_intermediate_acceleration_steps = 0;
      71                 :       1061 :   unstructured_settings.vehicle_brake_intermediate_acceleration_steps = 1;
      72                 :       1061 :   return unstructured_settings;
      73                 :            : }
      74                 :            : 
      75                 :            : ::ad::rss::world::RssDynamics
      76                 :        616 : CheckerControlTest::getObjectVehicleDynamics(::ad::physics::Speed const max_speed_on_acceleration)
      77                 :            : {
      78                 :        616 :   ::ad::rss::world::RssDynamics result;
      79                 :        616 :   result.alpha_lat.accel_max = cMaximumLateralAcceleration;
      80                 :        616 :   result.alpha_lat.brake_min = cMinimumLateralBrakingDeceleleration;
      81                 :            : 
      82                 :        616 :   result.alpha_lon.accel_max = cMaximumLongitudinalAcceleration;
      83                 :        616 :   result.alpha_lon.brake_min_correct = cMinimumLongitudinalBrakingDecelelerationCorrect;
      84                 :        616 :   result.alpha_lon.brake_min = cMinimumLongitudinalBrakingDeceleleration;
      85                 :        616 :   result.alpha_lon.brake_max = cMaximumLongitudinalBrakingDeceleleration;
      86                 :            : 
      87                 :        616 :   result.lateral_fluctuation_margin = ::ad::physics::Distance(0.1);
      88                 :        616 :   result.min_longitudinal_safety_distance = ::ad::physics::Distance(0);
      89                 :            : 
      90                 :        616 :   result.response_time = cResponseTimeOtherVehicles;
      91                 :        616 :   result.max_speed_on_acceleration = max_speed_on_acceleration;
      92                 :            : 
      93                 :        616 :   result.unstructured_settings = getUnstructuredSettings();
      94                 :            : 
      95                 :        616 :   return result;
      96                 :            : }
      97                 :            : 
      98                 :            : ::ad::rss::world::RssDynamics
      99                 :        445 : CheckerControlTest::getEgoVehicleDynamics(::ad::physics::Speed const max_speed_on_acceleration)
     100                 :            : {
     101                 :        445 :   ::ad::rss::world::RssDynamics result;
     102                 :        445 :   result.alpha_lat.accel_max = cMaximumLateralAcceleration;
     103                 :        445 :   result.alpha_lat.brake_min = cMinimumLateralBrakingDeceleleration;
     104                 :            : 
     105                 :        445 :   result.alpha_lon.accel_max = cMaximumLongitudinalAcceleration;
     106                 :        445 :   result.alpha_lon.brake_min_correct = cMinimumLongitudinalBrakingDecelelerationCorrect;
     107                 :        445 :   result.alpha_lon.brake_min = cMinimumLongitudinalBrakingDeceleleration;
     108                 :        445 :   result.alpha_lon.brake_max = cMaximumLongitudinalBrakingDeceleleration;
     109                 :            : 
     110                 :        445 :   result.lateral_fluctuation_margin = ::ad::physics::Distance(0.1);
     111                 :        445 :   result.min_longitudinal_safety_distance = ::ad::physics::Distance(0);
     112                 :            : 
     113                 :        445 :   result.response_time = cResponseTimeEgoVehicle;
     114                 :        445 :   result.max_speed_on_acceleration = max_speed_on_acceleration;
     115                 :            : 
     116                 :        445 :   result.unstructured_settings = getUnstructuredSettings();
     117                 :            : 
     118                 :        445 :   return result;
     119                 :            : }
     120                 :            : 
     121                 :            : } // namespace test_support
     122                 :            : } // namespace map
     123                 :            : } // namespace rss
     124                 :            : } // namespace ad

Generated by: LCOV version 1.14