23 #include "modules/map/proto/map_lane.pb.h" 42 : lane(CHECK_NOTNULL(lane)), s(s) {}
44 : lane(CHECK_NOTNULL(lane)), s(s), l(l) {}
77 : lane(CHECK_NOTNULL(lane)), start_s(start_s), end_s(end_s) {}
81 double Length()
const {
return end_s - start_s; }
86 static void Join(std::vector<LaneSegment>* segments);
93 PathOverlap(std::string object_id,
const double start_s,
const double end_s)
94 : object_id(
std::move(object_id)), start_s(start_s), end_s(end_s) {}
107 : Vec2d(point.x(), point.y()), heading_(heading) {}
110 : Vec2d(point.x(), point.y()), heading_(heading) {
111 lane_waypoints_.emplace_back(std::move(lane_waypoint));
114 std::vector<LaneWaypoint> lane_waypoints)
115 : Vec2d(point.x(), point.y()),
117 lane_waypoints_(
std::move(lane_waypoints)) {}
123 return lane_waypoints_;
127 lane_waypoints_.emplace_back(std::move(lane_waypoint));
130 lane_waypoints_.insert(lane_waypoints_.end(), lane_waypoints.begin(),
131 lane_waypoints.end());
136 static void RemoveDuplicates(std::vector<MapPathPoint>* points);
138 static std::vector<MapPathPoint> GetPointsFromSegment(
142 const double start_s,
148 double heading_ = 0.0;
158 : max_error_(max_error), max_sqr_error_(max_error * max_error) {
163 const std::vector<common::math::LineSegment2d>&
segments()
const {
168 double* accumulate_s,
double* lateral,
169 double* distance)
const;
176 bool is_within_max_error(
const Path& path,
const int s,
const int t);
177 double compute_max_error(
const Path& path,
const int s,
const int t);
179 void InitDilute(
const Path& path);
180 void InitProjections(
const Path& path);
183 double max_error_ = 0;
184 double max_sqr_error_ = 0;
196 int num_projection_samples_ = 0;
218 explicit Path(
const std::vector<MapPathPoint>& path_points);
219 explicit Path(std::vector<MapPathPoint>&& path_points);
220 explicit Path(std::vector<LaneSegment>&& path_points);
221 explicit Path(
const std::vector<LaneSegment>& path_points);
223 Path(
const std::vector<MapPathPoint>& path_points,
224 const std::vector<LaneSegment>& lane_segments);
225 Path(std::vector<MapPathPoint>&& path_points,
226 std::vector<LaneSegment>&& lane_segments);
228 Path(
const std::vector<MapPathPoint>& path_points,
229 const std::vector<LaneSegment>& lane_segments,
230 const double max_approximation_error);
231 Path(std::vector<MapPathPoint>&& path_points,
232 std::vector<LaneSegment>&& lane_segments,
233 const double max_approximation_error);
247 std::vector<hdmap::LaneSegment> GetLaneSegments(
const double start_s,
248 const double end_s)
const;
251 double* lateral)
const;
253 double* lateral,
double* distance)
const;
255 const double hueristic_start_s,
256 const double hueristic_end_s,
257 double* accumulate_s,
double* lateral,
258 double* min_distance)
const;
260 double* lateral)
const;
262 double* lateral,
double* distance)
const;
265 double* heading)
const;
269 const std::vector<MapPathPoint>&
path_points()
const {
return path_points_; }
271 return lane_segments_;
274 return lane_segments_to_next_point_;
277 return unit_directions_;
280 const std::vector<common::math::LineSegment2d>&
segments()
const {
284 double length()
const {
return length_; }
286 const PathOverlap* NextLaneOverlap(
double s)
const;
289 return lane_overlaps_;
292 return signal_overlaps_;
295 return yield_sign_overlaps_;
298 return stop_sign_overlaps_;
301 return crosswalk_overlaps_;
304 return junction_overlaps_;
307 return pnc_junction_overlaps_;
310 return clear_area_overlaps_;
313 return speed_bump_overlaps_;
316 return parking_space_overlaps_;
319 double GetLaneLeftWidth(
const double s)
const;
320 double GetLaneRightWidth(
const double s)
const;
321 bool GetLaneWidth(
const double s,
double* lane_left_width,
322 double* lane_right_width)
const;
324 double GetRoadLeftWidth(
const double s)
const;
325 double GetRoadRightWidth(
const double s)
const;
326 bool GetRoadWidth(
const double s,
double* road_left_width,
327 double* road_ight_width)
const;
337 void InitLaneSegments();
339 void InitPointIndex();
342 double GetSample(
const std::vector<double>& samples,
const double s)
const;
345 std::function<const std::vector<OverlapInfoConstPtr>&(
const LaneInfo&)>;
347 std::vector<PathOverlap>*
const overlaps)
const;
351 int num_segments_ = 0;
357 double length_ = 0.0;
360 bool use_path_approximation_ =
false;
364 int num_sample_points_ = 0;
void clear_lane_waypoints()
Definition: path.h:134
std::vector< double > road_right_width_
Definition: path.h:368
std::vector< int > sampled_max_original_projections_to_left_
Definition: path.h:205
const std::vector< common::math::Vec2d > & unit_directions() const
Definition: path.h:276
double max_error() const
Definition: path.h:161
const std::vector< LaneSegment > & lane_segments_to_next_point() const
Definition: path.h:273
const std::vector< common::math::LineSegment2d > & segments() const
Definition: path.h:163
LaneBoundaryType::Type LeftBoundaryType(const LaneWaypoint &waypoint)
get left boundary type at a waypoint.
std::vector< common::math::LineSegment2d > segments_
Definition: path.h:359
const std::vector< PathOverlap > & yield_sign_overlaps() const
Definition: path.h:294
const std::vector< PathOverlap > & lane_overlaps() const
Definition: path.h:288
Define the LineSegment2d class.
std::vector< PathOverlap > junction_overlaps_
Definition: path.h:377
std::vector< LaneWaypoint > lane_waypoints_
Definition: path.h:149
void add_lane_waypoint(LaneWaypoint lane_waypoint)
Definition: path.h:126
std::vector< common::math::LineSegment2d > segments_
Definition: path.h:188
std::vector< double > road_left_width_
Definition: path.h:367
InterpolatedIndex(int id, double offset)
Definition: path.h:210
std::vector< double > max_error_per_segment_
Definition: path.h:189
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
const std::vector< PathOverlap > & pnc_junction_overlaps() const
Definition: path.h:306
MapPathPoint(const common::math::Vec2d &point, double heading)
Definition: path.h:106
std::vector< common::math::Vec2d > unit_directions_
Definition: path.h:356
double s
Definition: path.h:46
std::vector< PathOverlap > parking_space_overlaps_
Definition: path.h:376
void set_heading(const double heading)
Definition: path.h:120
std::vector< int > original_ids_
Definition: path.h:187
double heading() const
Definition: path.h:119
std::string object_id
Definition: path.h:96
std::vector< PathOverlap > speed_bump_overlaps_
Definition: path.h:380
std::vector< PathOverlap > crosswalk_overlaps_
Definition: path.h:375
LaneWaypoint LeftNeighborWaypoint(const LaneWaypoint &waypoint)
get left neighbor lane waypoint. If not exist, the Waypoint.lane will be null.
double l
Definition: path.h:47
const PathApproximation * approximation() const
Definition: path.h:283
std::vector< LaneSegment > lane_segments_
Definition: path.h:353
const std::vector< PathOverlap > & clear_area_overlaps() const
Definition: path.h:309
MapPathPoint(const common::math::Vec2d &point, double heading, LaneWaypoint lane_waypoint)
Definition: path.h:108
Rectangular (undirected) bounding box in 2-D.
Definition: box2d.h:52
std::vector< PathOverlap > clear_area_overlaps_
Definition: path.h:379
const std::vector< PathOverlap > & stop_sign_overlaps() const
Definition: path.h:297
int num_segments() const
Definition: path.h:268
Implements a class of 2-dimensional vectors.
Definition: vec2d.h:42
double max_projection_
Definition: path.h:195
const std::vector< LaneWaypoint > & lane_waypoints() const
Definition: path.h:122
std::vector< PathOverlap > signal_overlaps_
Definition: path.h:372
LaneWaypoint RightNeighborWaypoint(const LaneWaypoint &waypoint)
get left neighbor lane waypoint. If not exist, the Waypoint.lane will be null.
std::vector< PathOverlap > stop_sign_overlaps_
Definition: path.h:374
std::shared_ptr< const LaneInfo > LaneInfoConstPtr
Definition: hdmap_common.h:125
PathApproximation(const Path &path, const double max_error)
Definition: path.h:157
std::vector< PathOverlap > yield_sign_overlaps_
Definition: path.h:373
bool Init(const char *binary_name)
std::string DebugString() const
PathApproximation approximation_
Definition: path.h:361
std::vector< double > min_original_projections_to_right_
Definition: path.h:204
void add_lane_waypoints(const std::vector< LaneWaypoint > &lane_waypoints)
Definition: path.h:129
std::function< const std::vector< OverlapInfoConstPtr > &(const LaneInfo &)> GetOverlapFromLaneFunc
Definition: path.h:345
const std::vector< PathOverlap > & parking_space_overlaps() const
Definition: path.h:315
const std::vector< common::math::LineSegment2d > & segments() const
Definition: path.h:280
std::vector< double > original_projections_
Definition: path.h:200
std::vector< double > accumulated_s_
Definition: path.h:358
const std::vector< double > & accumulated_s() const
Definition: path.h:279
std::vector< double > projections_
Definition: path.h:194
Definition: hdmap_common.h:141
LaneSegment(LaneInfoConstPtr lane, const double start_s, const double end_s)
Definition: path.h:76
const std::vector< PathOverlap > & crosswalk_overlaps() const
Definition: path.h:300
double length() const
Definition: path.h:284
const std::vector< LaneSegment > & lane_segments() const
Definition: path.h:270
std::vector< double > lane_right_width_
Definition: path.h:366
const std::vector< PathOverlap > & speed_bump_overlaps() const
Definition: path.h:312
PathOverlap(std::string object_id, const double start_s, const double end_s)
Definition: path.h:93
std::vector< PathOverlap > pnc_junction_overlaps_
Definition: path.h:378
const std::vector< MapPathPoint > & path_points() const
Definition: path.h:269
std::vector< double > max_original_projections_to_left_
Definition: path.h:203
The class of Box2d. Here, the x/y axes are respectively Forward/Left, as opposed to what happens in e...
std::vector< double > lane_left_width_
Definition: path.h:365
std::vector< MapPathPoint > path_points_
Definition: path.h:352
std::vector< int > last_point_index_
Definition: path.h:369
std::vector< double > lane_accumulated_s_
Definition: path.h:354
const std::vector< PathOverlap > & signal_overlaps() const
Definition: path.h:291
const std::vector< int > & original_ids() const
Definition: path.h:162
std::vector< PathOverlap > lane_overlaps_
Definition: path.h:371
LaneBoundaryType::Type RightBoundaryType(const LaneWaypoint &waypoint)
get left boundary type at a waypoint.
double Length() const
Definition: path.h:81
std::vector< LaneSegment > lane_segments_to_next_point_
Definition: path.h:355
LaneWaypoint(LaneInfoConstPtr lane, const double s)
Definition: path.h:41
int num_points() const
Definition: path.h:267
LaneInfoConstPtr lane
Definition: path.h:45
LaneWaypoint(LaneInfoConstPtr lane, const double s, const double l)
Definition: path.h:43
const std::vector< PathOverlap > & junction_overlaps() const
Definition: path.h:303
MapPathPoint(const common::math::Vec2d &point, double heading, std::vector< LaneWaypoint > lane_waypoints)
Definition: path.h:113