CARLA
Loading...
Searching...
No Matches
client/Waypoint.h
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9#include "carla/Memory.h"
10#include "carla/NonCopyable.h"
15#include "carla/road/Lane.h"
17
18#include <optional>
19
20namespace carla {
21namespace client {
22
23 class Map;
24 class Junction;
25 class Landmark;
26 class Road;
27 class Lane;
28
30 : public EnableSharedFromThis<Waypoint>,
31 private NonCopyable {
32 public:
33
35
36 /// Returns an unique Id identifying this waypoint.
37 ///
38 /// The Id takes into account OpenDrive's road Id, lane Id, and s distance
39 /// on its road segment up to half-centimetre precision.
40 uint64_t GetId() const {
41 return std::hash<road::element::Waypoint>()(_waypoint);
42 }
43
44 auto GetRoadId() const {
45 return _waypoint.road_id;
46 }
47
48 auto GetSectionId() const {
49 return _waypoint.section_id;
50 }
51
52 auto GetLaneId() const {
53 return _waypoint.lane_id;
54 }
55
56 auto GetDistance() const {
57 return _waypoint.s;
58 }
59
61 return _transform;
62 }
63
65
66 bool IsJunction() const;
67
69
70 /// The lane this waypoint samples.
72
73 /// The road this waypoint samples.
75
76 double GetLaneWidth() const;
77
79
80 std::vector<SharedPtr<Waypoint>> GetNext(double distance) const;
81
82 std::vector<SharedPtr<Waypoint>> GetPrevious(double distance) const;
83
84 /// Returns a list of waypoints separated by distance from the current waypoint
85 /// to the end of the lane
86 std::vector<SharedPtr<Waypoint>> GetNextUntilLaneEnd(double distance) const;
87
88 /// Returns a list of waypoints separated by distance from the current waypoint
89 /// to the start of the lane
90 std::vector<SharedPtr<Waypoint>> GetPreviousUntilLaneStart(double distance) const;
91
93
95
96 std::optional<road::element::LaneMarking> GetRightLaneMarking() const;
97
98 std::optional<road::element::LaneMarking> GetLeftLaneMarking() const;
99
101
102 /// Returns a list of landmarks from the current position to a certain distance
103 std::vector<SharedPtr<Landmark>> GetAllLandmarksInDistance(
104 double distance, bool stop_at_junction = false) const;
105
106 /// Returns a list of landmarks from the current position to a certain distance
107 /// Filters by specified type
108 std::vector<SharedPtr<Landmark>> GetLandmarksOfTypeInDistance(
109 double distance, std::string filter_type, bool stop_at_junction = false) const;
110
111 bool IsPositiveDirection() const;
112
113 bool IsRHT() const;
114
115 private:
116
117 friend class Map;
118
120
122
124
126
127 // Mark record right and left respectively.
128 std::pair<
131 };
132
133} // namespace client
134} // namespace carla
float distance
Inherit (privately) to suppress copy/move construction and assignment.
SharedPtr< Waypoint > GetLeft() const
std::vector< SharedPtr< Landmark > > GetLandmarksOfTypeInDistance(double distance, std::string filter_type, bool stop_at_junction=false) const
Returns a list of landmarks from the current position to a certain distance Filters by specified type...
road::element::Waypoint _waypoint
SharedPtr< Waypoint > GetRight() const
std::optional< road::element::LaneMarking > GetLeftLaneMarking() const
SharedPtr< const Map > _parent
road::JuncId GetJunctionId() const
std::optional< road::element::LaneMarking > GetRightLaneMarking() const
SharedPtr< Lane > GetLane() const
The lane this waypoint samples.
std::vector< SharedPtr< Waypoint > > GetPrevious(double distance) const
const geom::Transform & GetTransform() const
road::element::LaneMarking::LaneChange GetLaneChange() const
std::vector< SharedPtr< Waypoint > > GetNext(double distance) const
SharedPtr< Junction > GetJunction() const
std::vector< SharedPtr< Waypoint > > GetNextUntilLaneEnd(double distance) const
Returns a list of waypoints separated by distance from the current waypoint to the end of the lane.
std::vector< SharedPtr< Landmark > > GetAllLandmarksInDistance(double distance, bool stop_at_junction=false) const
Returns a list of landmarks from the current position to a certain distance.
uint64_t GetId() const
Returns an unique Id identifying this waypoint.
std::vector< SharedPtr< Waypoint > > GetPreviousUntilLaneStart(double distance) const
Returns a list of waypoints separated by distance from the current waypoint to the start of the lane.
std::pair< const road::element::RoadInfoMarkRecord *, const road::element::RoadInfoMarkRecord * > _mark_record
SharedPtr< Road > GetRoad() const
The road this waypoint samples.
road::Lane::LaneType GetType() const
A rigid transform in CARLA's / Unreal's left-handed frame: x forward, y right, z up,...
LaneType
Can be used as flags.
Definition road/Lane.h:29
Each lane within a road cross section can be provided with several road markentries.
int32_t JuncId
Definition RoadTypes.h:17
carla::SharedPtr< carla::client::Junction > Junction
This file contains definitions of common data structures used in traffic manager.
std::shared_ptr< T > SharedPtr
Definition Memory.h:15
LaneChange
Can be used as flags.
Definition LaneMarking.h:50