ad_map_access
LaneOperation.hpp
Go to the documentation of this file.
1 // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 //
3 // Copyright (C) 2018-2021 Intel Corporation
4 //
5 // SPDX-License-Identifier: MIT
6 //
7 // ----------------- END LICENSE BLOCK -----------------------------------
12 #pragma once
13 
16 #include "ad/map/lane/Types.hpp"
17 #include "ad/map/match/Types.hpp"
19 #include "ad/map/point/Types.hpp"
21 #include "ad/physics/Duration.hpp"
22 
24 namespace ad {
26 namespace map {
28 namespace lane {
29 
35 inline bool isValid(LaneId const &laneId, bool const logErrors = true)
36 {
37  return withinValidInputRange(laneId, logErrors);
38 }
39 
45 inline bool isValid(Lane const &lane, bool const logErrors = true)
46 {
47  return withinValidInputRange(lane, logErrors);
48 }
49 
56 Lane::ConstPtr getLanePtr(LaneId const &id);
57 
64 Lane const &getLane(lane::LaneId const &id);
65 
71 
76 
81 
86 
90 point::ENUHeading getLaneENUHeading(point::ParaPoint const &paraPoint, point::GeoPoint const &gnssReference);
91 
97 LaneId uniqueLaneId(point::GeoPoint const &point);
98 
105 
112 inline bool isAccessOk(Lane const &lane, restriction::VehicleDescriptor const &vehicle)
113 {
114  return isAccessOk(lane.restrictions, vehicle);
115 }
116 
123 inline bool isNear(Lane const &lane, point::BoundingSphere const &boundingSphere)
124 {
125  return distance(lane.boundingSphere, boundingSphere) == physics::Distance(0.);
126 }
127 
133 physics::Distance getWidth(Lane const &lane, physics::ParametricValue const &longitudinalOffset);
134 
138 physics::Speed getMaxSpeed(Lane const &lane, physics::ParametricRange const &range);
139 
143 restriction::SpeedLimitList getSpeedLimits(Lane const &lane, physics::ParametricRange const &range);
144 
149 physics::Duration getDuration(Lane const &lane, physics::ParametricRange const &range);
150 
155 {
156  return getHOV(lane.restrictions);
157 }
158 
165 ContactLaneList getContactLanes(Lane const &lane, ContactLocation const &location);
166 
172 ContactLaneList getContactLanes(Lane const &lane, ContactLocationList const &locations);
173 
179 ContactLocation getContactLocation(Lane const &lane, LaneId const &to_lane_id);
180 
184 inline bool isLaneDirectionPositive(Lane const &lane)
185 {
187 }
188 
192 inline bool isLaneDirectionNegative(Lane const &lane)
193 {
195 }
196 
200 inline bool isRouteable(Lane const &lane)
201 {
202  return lane.type == LaneType::INTERSECTION || lane.type == LaneType::MULTI || lane.type == LaneType::NORMAL
203  || lane.type == LaneType::TURN;
204 }
205 
209 inline bool isLanePartOfAnIntersection(Lane const &lane)
210 {
211  return (lane.type == lane::LaneType::INTERSECTION);
212 }
213 
217 inline bool isLeftMost(Lane const &lane)
218 {
219  return getContactLanes(lane, ContactLocation::LEFT).empty();
220 }
221 
225 inline bool isRightMost(Lane const &lane)
226 {
227  return getContactLanes(lane, ContactLocation::RIGHT).empty();
228 }
229 
239 point::ECEFPoint getParametricPoint(Lane const &lane,
240  physics::ParametricValue const &longitudinalOffset,
241  physics::ParametricValue const &lateralOffset);
242 
250 bool projectParametricPointToEdges(Lane const &lane,
251  point::ECEFPoint const &referencePoint,
252  point::ECEFPoint &point_on_left_edge,
253  point::ECEFPoint &point_on_right_edge);
254 
262 bool projectParametricPointToEdges(Lane const &lane,
263  physics::ParametricValue const &longitudinalOffset,
264  point::ECEFPoint &point_on_left_edge,
265  point::ECEFPoint &point_on_right_edge);
266 
276  physics::ParametricValue const &longitudinalOffset,
277  physics::ParametricValue const &lateralOffset);
278 
283 {
284  return getParametricPoint(lane, physics::ParametricValue(0.), physics::ParametricValue(0.5));
285 }
286 
290 inline point::ECEFPoint getEndPoint(Lane const &lane)
291 {
292  return getParametricPoint(lane, physics::ParametricValue(1.), physics::ParametricValue(0.5));
293 }
294 
300 bool isPyhsicalSuccessor(Lane const &lane, Lane const &other);
301 
307 bool isPhysicalPredecessor(Lane const &lane, Lane const &other);
308 
312 bool isVanishingLaneStart(Lane const &lane);
313 
317 bool isVanishingLaneEnd(Lane const &lane);
318 
325 bool satisfiesFilter(Lane const &lane, std::string const &typeFilter, bool isHov);
326 
340 ContactLocation getDirectNeighborhoodRelation(LaneId const laneId, LaneId const checkLaneId);
341 
350 bool isSuccessorOrPredecessor(LaneId const laneId, LaneId const checkLaneId);
351 
357 bool isSameOrDirectNeighbor(LaneId const id, LaneId const neighbor);
358 
366 bool isLaneDirectionPositive(LaneId const &laneId);
367 
375 bool isLaneDirectionNegative(LaneId const &laneId);
376 
385 physics::Distance getDistanceToLane(LaneId laneId, match::Object const &object);
386 
391 
400 bool isHeadingInLaneDirection(point::ParaPoint const &position, point::ENUHeading const &heading);
401 
413  point::ENUHeading const &heading,
414  point::ParaPoint &projectedPosition);
415 
427 bool findNearestPointOnLane(Lane const &lane, point::ECEFPoint const &pt, match::MapMatchedPosition &mmpos);
428 
440 bool findNearestPointOnLaneInterval(route::LaneInterval const &laneInterval,
441  point::ECEFPoint const &pt,
443 
448 point::ENUPoint getENULanePoint(point::ParaPoint const parametricPoint,
449  physics::ParametricValue const &lateralOffset = physics::ParametricValue(0.5));
450 
453 physics::Distance calcLength(LaneId const &laneId);
454 
457 physics::Distance calcLength(match::LaneOccupiedRegion const &laneOccupiedRegion);
458 
461 physics::Distance calcWidth(point::ParaPoint const &paraPoint);
462 
465 physics::Distance calcWidth(LaneId const &laneId, physics::ParametricValue const &longOffset);
466 
472 physics::Distance calcWidth(point::ENUPoint const &enuPoint);
473 
477 physics::Distance calcWidth(match::LaneOccupiedRegion const &laneOccupiedRegion);
478 
483 {
484  point::Altitude minimum;
485  point::Altitude maximum;
486 };
487 
494 
500 bool isLaneRelevantForExpansion(lane::LaneId const &laneId, lane::LaneIdSet const &relevantLanes);
501 
502 } // namespace lane
503 } // namespace map
504 } // namespace ad
ad::map::lane::isHeadingInLaneDirection
bool isHeadingInLaneDirection(point::ParaPoint const &position, point::ENUHeading const &heading)
Check if the provided heading is along the lane direction.
ad
namespace ad
Definition: GeometryStoreItem.hpp:28
ad::map::lane::ContactLocation::RIGHT
@ RIGHT
ad::map::lane::getDuration
physics::Duration getDuration(Lane const &lane, physics::ParametricRange const &range)
ad::map::lane::LaneType::INTERSECTION
@ INTERSECTION
ad::map::lane::isVanishingLaneEnd
bool isVanishingLaneEnd(Lane const &lane)
ad::map::match::LaneOccupiedRegion
DataType LaneOccupiedRegion.
Definition: LaneOccupiedRegion.hpp:46
ad::map::lane::calcWidth
physics::Distance calcWidth(point::ParaPoint const &paraPoint)
calculate the width of the lane at the provided lanePoint
ad::map::lane::isLaneRelevantForExpansion
bool isLaneRelevantForExpansion(lane::LaneId const &laneId, lane::LaneIdSet const &relevantLanes)
Checks if the laneId is relevant for expansion given the set of relevant lanes.
Types.hpp
ad::map::lane::ContactLaneList
std::vector<::ad::map::lane::ContactLane > ContactLaneList
DataType ContactLaneList.
Definition: ContactLaneList.hpp:42
ad::map::lane::isLaneDirectionNegative
bool isLaneDirectionNegative(Lane const &lane)
Definition: LaneOperation.hpp:192
ad::map::lane::getWidth
physics::Distance getWidth(Lane const &lane, physics::ParametricValue const &longitudinalOffset)
ad::map::lane::isSuccessorOrPredecessor
bool isSuccessorOrPredecessor(LaneId const laneId, LaneId const checkLaneId)
Check if a lane is successor or predecessor of a lane.
RestrictionOperation.hpp
ad::map::lane::getDistanceToLane
physics::Distance getDistanceToLane(LaneId laneId, match::Object const &object)
Get the distance of an object to the lane boundaries.
ad::map::lane::LaneType::NORMAL
@ NORMAL
ad::map::match::Object
DataType Object.
Definition: Object.hpp:43
ad::map::point::ParaPoint
DataType ParaPoint.
Definition: ParaPoint.hpp:48
BoundingSphereOperation.hpp
ad::map::lane::isPhysicalPredecessor
bool isPhysicalPredecessor(Lane const &lane, Lane const &other)
Checks if Lane is longitudinally connected with another Lane at the start.
ad::map::lane::ContactLocation
ContactLocation
DataType ContactLocation.
Definition: ContactLocation.hpp:43
ad::map::point::ECEFHeading
DataType ECEFHeading.
Definition: ECEFHeading.hpp:45
ad::map::lane::getParametricPoint
point::ECEFPoint getParametricPoint(Lane const &lane, physics::ParametricValue const &longitudinalOffset, physics::ParametricValue const &lateralOffset)
Calculates parametric point on the lane. Point is calculated by first calculating t_long parametric p...
withinValidInputRange
bool withinValidInputRange(::ad::map::access::MapMetaData const &input, bool const logErrors=true)
check if the given MapMetaData is within valid input range
Definition: MapMetaDataValidInputRange.hpp:37
ad::map::lane::satisfiesFilter
bool satisfiesFilter(Lane const &lane, std::string const &typeFilter, bool isHov)
Checks if Lane satisfies filter condition.
ad::map::lane::Lane::type
::ad::map::lane::LaneType type
Definition: Lane.hpp:143
ad::map::point::GeoPoint
DataType GeoPoint.
Definition: GeoPoint.hpp:47
ad::map::lane::findNearestPointOnLaneInterval
bool findNearestPointOnLaneInterval(route::LaneInterval const &laneInterval, point::ECEFPoint const &pt, match::MapMatchedPosition &mmpos)
Finds point on the lane interval nearest to the given point.
ad::map::lane::LaneIdList
std::vector<::ad::map::lane::LaneId > LaneIdList
DataType LaneIdList.
Definition: LaneIdList.hpp:44
ad::map::lane::LaneDirection::BIDIRECTIONAL
@ BIDIRECTIONAL
ad::map::lane::getEndPoint
point::ECEFPoint getEndPoint(Lane const &lane)
Definition: LaneOperation.hpp:290
ad::map::lane::isVanishingLaneStart
bool isVanishingLaneStart(Lane const &lane)
ad::map::lane::getStartPoint
point::ECEFPoint getStartPoint(Lane const &lane)
Definition: LaneOperation.hpp:282
ad::map::lane::isNear
bool isNear(Lane const &lane, point::BoundingSphere const &boundingSphere)
Checks if given sphere intersects with lane bounding ball.
Definition: LaneOperation.hpp:123
ad::map::point::ENUPoint
DataType ENUPoint.
Definition: ENUPoint.hpp:51
ad::map::point::distance
physics::Distance distance(BoundingSphere const &left, BoundingSphere const &right)
Computes distance between BoundingSpheres.
Definition: BoundingSphereOperation.hpp:29
ad::map::restriction::VehicleDescriptor
DataType VehicleDescriptor.
Definition: VehicleDescriptor.hpp:46
ad::map::lane::calcLaneAltitudeRange
LaneAltitudeRange calcLaneAltitudeRange(Lane const &lane)
Calculates the altitude range of a lane.
ad::map::lane::LaneId
DataType LaneId.
Definition: LaneId.hpp:66
ad::map::lane::findNearestPointOnLane
bool findNearestPointOnLane(Lane const &lane, point::ECEFPoint const &pt, match::MapMatchedPosition &mmpos)
Finds point on the lane nearest to the given point.
ad::map::lane::isLaneDirectionPositive
bool isLaneDirectionPositive(Lane const &lane)
Definition: LaneOperation.hpp:184
ad::map::lane::LaneAltitudeRange
Struct to hold the altitude range of a lane.
Definition: LaneOperation.hpp:482
ad::map::lane::projectParametricPointToEdges
bool projectParametricPointToEdges(Lane const &lane, point::ECEFPoint const &referencePoint, point::ECEFPoint &point_on_left_edge, point::ECEFPoint &point_on_right_edge)
Calculates the projection on left and right boundary of the given referencePoint.
ad::map::point::ENUHeading
DataType ENUHeading.
Definition: ENUHeading.hpp:65
ad::map::lane::getSpeedLimits
restriction::SpeedLimitList getSpeedLimits(Lane const &lane, physics::ParametricRange const &range)
ad::map::lane::getLaneECEFHeading
point::ECEFHeading getLaneECEFHeading(match::MapMatchedPosition const &mapMatchedPosition)
ad::map::lane::isValid
bool isValid(ContactLane const &contactLane, bool const logErrors=true)
checks if the given ContactLane is valid
Definition: ContactOperation.hpp:69
ad::map::point::BoundingSphere
DataType BoundingSphere.
Definition: BoundingSphere.hpp:46
ad::map::lane::isLeftMost
bool isLeftMost(Lane const &lane)
Definition: LaneOperation.hpp:217
ad::map::lane::getLanePtr
Lane::ConstPtr getLanePtr(LaneId const &id)
Method to be called to retrieve Lane from the Store.
ad::map::lane::LaneType::TURN
@ TURN
ad::map::lane::getLaneENUHeading
point::ENUHeading getLaneENUHeading(match::MapMatchedPosition const &mapMatchedPosition)
ad::map::restriction::PassengerCount
uint16_t PassengerCount
DataType PassengerCount.
Definition: PassengerCount.hpp:39
ad::map::lane::getLanes
LaneIdList getLanes()
Method to be called to retrieve identifiers of all Lanes in the Store.
Types.hpp
ad::map::lane::Lane::restrictions
::ad::map::restriction::Restrictions restrictions
Definition: Lane.hpp:153
ad::map::lane::isPyhsicalSuccessor
bool isPyhsicalSuccessor(Lane const &lane, Lane const &other)
Checks if Lane is longitudinally connected with another Lane at the end.
ad::map::lane::isRightMost
bool isRightMost(Lane const &lane)
Definition: LaneOperation.hpp:225
ad::map::lane::getDirectNeighborhoodRelation
ContactLocation getDirectNeighborhoodRelation(LaneId const laneId, LaneId const checkLaneId)
get the neighborhood relation to the other lane
ad::map::lane::isLanePartOfAnIntersection
bool isLanePartOfAnIntersection(Lane const &lane)
Definition: LaneOperation.hpp:209
ad::map::lane::isRouteable
bool isRouteable(Lane const &lane)
Definition: LaneOperation.hpp:200
Types.hpp
ad::map::lane::ContactLocationList
std::vector<::ad::map::lane::ContactLocation > ContactLocationList
DataType ContactLocationList.
Definition: ContactLocationList.hpp:44
ad::map::lane::getMaxSpeed
physics::Speed getMaxSpeed(Lane const &lane, physics::ParametricRange const &range)
ad::map::lane::getHOV
restriction::PassengerCount getHOV(Lane const &lane)
Definition: LaneOperation.hpp:154
ad::map::lane::calcLength
physics::Distance calcLength(ENUBorder const &border)
calculate the length of the provided border as distance value
Definition: BorderOperation.hpp:122
ad::map::point::ECEFPoint
DataType ECEFPoint.
Definition: ECEFPoint.hpp:45
ad::map::lane::uniqueLaneId
LaneId uniqueLaneId(point::GeoPoint const &point)
ad::map::restriction::SpeedLimitList
std::vector<::ad::map::restriction::SpeedLimit > SpeedLimitList
DataType SpeedLimitList.
Definition: SpeedLimitList.hpp:42
ad::map::lane::isAccessOk
bool isAccessOk(ContactLane const &contactLane, restriction::VehicleDescriptor const &vehicle)
Checks if vehicle fits the restriction criteria of the contact lane.
Definition: ContactOperation.hpp:59
ad::map::lane::LaneDirection::POSITIVE
@ POSITIVE
ad::map::lane::isSameOrDirectNeighbor
bool isSameOrDirectNeighbor(LaneId const id, LaneId const neighbor)
Check if two lanes are direct neighbors of even the same.
ad::map::point::Altitude
DataType Altitude.
Definition: Altitude.hpp:67
ad::map::lane::uniqueParaPoint
point::ParaPoint uniqueParaPoint(point::GeoPoint const &point)
ad::map::lane::projectPositionToLaneInHeadingDirection
bool projectPositionToLaneInHeadingDirection(point::ParaPoint const &position, point::ENUHeading const &heading, point::ParaPoint &projectedPosition)
project a position to a neighboring lane (incl. the lane itself), which has the provided heading
ad::map::lane::getContactLanes
ContactLaneList getContactLanes(Lane const &lane, ContactLocation const &location)
Find contact lanes at specific relative location.
ad::map::lane::LaneType::MULTI
@ MULTI
ad::map::match::MapMatchedPosition
DataType MapMatchedPosition.
Definition: MapMatchedPosition.hpp:49
ad::map::lane::Lane::direction
::ad::map::lane::LaneDirection direction
Definition: Lane.hpp:148
ad::map::lane::ContactLocation::LEFT
@ LEFT
LaneIdValidInputRange.hpp
ad::map::route::LaneInterval
DataType LaneInterval.
Definition: LaneInterval.hpp:51
ad::map::lane::getLane
const Lane & getLane(lane::LaneId const &id)
Method to be called to retrieve Lane from the Store.
ad::map::lane::getProjectedParametricPoint
point::ECEFPoint getProjectedParametricPoint(Lane const &lane, physics::ParametricValue const &longitudinalOffset, physics::ParametricValue const &lateralOffset)
Calculates projected parametric point on the lane. Point is calculated by first calculating the proje...
ad::map::lane::LaneDirection::NEGATIVE
@ NEGATIVE
ad::map::lane::Lane::ConstPtr
std::shared_ptr< Lane const > ConstPtr
Smart pointer on constant Lane.
Definition: Lane.hpp:66
ad::map::lane::Lane
DataType Lane.
Definition: Lane.hpp:56
LaneValidInputRange.hpp
ad::map::lane::getContactLocation
ContactLocation getContactLocation(Lane const &lane, LaneId const &to_lane_id)
Check nature of contact between this lane and another lane.
ad::map::lane::getENULanePoint
point::ENUPoint getENULanePoint(point::ParaPoint const parametricPoint, physics::ParametricValue const &lateralOffset=physics::ParametricValue(0.5))
get the ENU point of a lane