Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK --------------------------------- 2 : : // 3 : : // Copyright (C) 2018-2021 Intel Corporation 4 : : // 5 : : // SPDX-License-Identifier: MIT 6 : : // 7 : : // ----------------- END LICENSE BLOCK ----------------------------------- 8 : : /** 9 : : * @file 10 : : */ 11 : : 12 : : #pragma once 13 : : 14 : : #include "ad/map/match/Types.hpp" 15 : : #include "ad/map/point/Types.hpp" 16 : : 17 : : /** @brief namespace admap */ 18 : : namespace ad { 19 : : /** @brief namespace map */ 20 : : namespace map { 21 : : /** @brief namespace match */ 22 : : namespace match { 23 : : 24 : : /** @brief get the list of ParaPoints out of the map matched positions */ 25 : : point::ParaPointList getParaPoints(MapMatchedPositionConfidenceList const &inMapMatchedPositions); 26 : : 27 : 125726 : inline bool isLaneType(MapMatchedPositionType const &mapMatchedPositionType) 28 : : { 29 : 125726 : return mapMatchedPositionType == MapMatchedPositionType::LANE_IN 30 [ + + ]: 86018 : || mapMatchedPositionType == MapMatchedPositionType::LANE_LEFT 31 [ + + + - ]: 211744 : || mapMatchedPositionType == MapMatchedPositionType::LANE_RIGHT; 32 : : } 33 : : 34 : : /** 35 : : * @brief Calculates the objects ENU angle based on the map matched position 36 : : */ 37 : : point::ENUHeading getObjectENUHeading(const match::MapMatchedObjectBoundingBox &mapMatchedBoundingBox); 38 : : 39 : : /** 40 : : * @brief get the signed distance to a lane within the map matched positions 41 : : * 42 : : * This check searches the mapMatchedPositions for the given \a checkLaneId and returns a signed distance value to the 43 : : * lane. 44 : : * 45 : : * @param[in] checkLaneId the lane id to find 46 : : * @param[in] mapMatchedPositions the map matched positions to check 47 : : * 48 : : * @returns: 49 : : * If not part of the mapMatchedPositions: distance = std::numeric_limits<physics::Distance>::max() 50 : : * If it's found and map matched type is: 51 : : * - MapMatchedPositionType::LANE_IN: distance = 0. 52 : : * - MapMatchedPositionType::LANE_LEFT: distance < 0 53 : : * - MapMatchedPositionType::LANE_RIGHT: distance > 0 54 : : * 55 : : * @throws std::runtime_error if mapMatchedPositions are inconsistent 56 : : */ 57 : : physics::Distance signedDistanceToLane(lane::LaneId const checkLaneId, 58 : : MapMatchedPositionConfidenceList const &mapMatchedPositions); 59 : : 60 : : /** @brief get the para point of the occupied Region in the middle of the longitudinal extend of it */ 61 : 18 : inline point::ParaPoint getCenterParaPoint(match::LaneOccupiedRegion const &occupiedRegion) 62 : : { 63 [ + - ]: 18 : point::ParaPoint paraPoint; 64 : 18 : paraPoint.laneId = occupiedRegion.laneId; 65 : : paraPoint.parametricOffset 66 [ + - + - ]: 18 : = 0.5 * (occupiedRegion.longitudinalRange.maximum + occupiedRegion.longitudinalRange.minimum); 67 : 18 : return paraPoint; 68 : : } 69 : : 70 : : } // namespace match 71 : : } // namespace map 72 : : } // namespace ad