Apollo 11.0
自动驾驶开放平台
apollo::planning::WaypointSampler类 参考

#include <waypoint_sampler.h>

apollo::planning::WaypointSampler 的协作图:

Public 成员函数

 WaypointSampler (const WaypointSamplerConfig &config)
 
virtual ~WaypointSampler ()=default
 
virtual void Init (const ReferenceLineInfo *reference_line_info, const common::SLPoint &init_sl_point_, const common::FrenetFramePoint &init_frenet_frame_point)
 
virtual void SetDebugLogger (apollo::planning_internal::Debug *debug)
 
virtual bool SamplePathWaypoints (const common::TrajectoryPoint &init_point, std::vector< std::vector< common::SLPoint > > *const points)
 

Protected 属性

const WaypointSamplerConfig & config_
 
const ReferenceLineInfo * reference_line_info_ = nullptr
 
common::SLPoint init_sl_point_
 
common::FrenetFramePoint init_frenet_frame_point_
 
apollo::planning_internal::Debug * planning_debug_ = nullptr
 

详细描述

在文件 waypoint_sampler.h 第 39 行定义.

构造及析构函数说明

◆ WaypointSampler()

apollo::planning::WaypointSampler::WaypointSampler ( const WaypointSamplerConfig &  config)
inlineexplicit

在文件 waypoint_sampler.h 第 41 行定义.

42 : config_(config) {}
const WaypointSamplerConfig & config_

◆ ~WaypointSampler()

virtual apollo::planning::WaypointSampler::~WaypointSampler ( )
virtualdefault

成员函数说明

◆ Init()

void apollo::planning::WaypointSampler::Init ( const ReferenceLineInfo *  reference_line_info,
const common::SLPoint &  init_sl_point_,
const common::FrenetFramePoint &  init_frenet_frame_point 
)
virtual

在文件 waypoint_sampler.cc 第 38 行定义.

41 {
42 reference_line_info_ = reference_line_info;
43 init_sl_point_ = init_sl_point;
44 init_frenet_frame_point_ = init_frenet_frame_point;
45}
common::FrenetFramePoint init_frenet_frame_point_
const ReferenceLineInfo * reference_line_info_

◆ SamplePathWaypoints()

bool apollo::planning::WaypointSampler::SamplePathWaypoints ( const common::TrajectoryPoint &  init_point,
std::vector< std::vector< common::SLPoint > > *const  points 
)
virtual

在文件 waypoint_sampler.cc 第 47 行定义.

49 {
50 CHECK_NOTNULL(points);
51 points->clear();
52 points->insert(points->begin(), std::vector<common::SLPoint>{init_sl_point_});
53
54 const double kMinSampleDistance = 40.0;
55 const double total_length = std::fmin(
56 init_sl_point_.s() + std::fmax(init_point.v() * 8.0, kMinSampleDistance),
58 const auto &vehicle_config =
59 common::VehicleConfigHelper::Instance()->GetConfig();
60 const double half_adc_width = vehicle_config.vehicle_param().width() / 2.0;
61 const double num_sample_per_level =
62 FLAGS_use_navigation_mode ? config_.navigator_sample_num_each_level()
63 : config_.sample_points_num_each_level();
64
65 static constexpr double kSamplePointLookForwardTime = 4.0;
66 const double level_distance =
67 common::math::Clamp(init_point.v() * kSamplePointLookForwardTime,
68 config_.step_length_min(), config_.step_length_max());
69
70 double accumulated_s = init_sl_point_.s();
71 double prev_s = accumulated_s;
72
73 static constexpr size_t kNumLevel = 3;
74 for (size_t i = 0; i < kNumLevel && accumulated_s < total_length; ++i) {
75 accumulated_s += level_distance;
76 if (accumulated_s + level_distance / 2.0 > total_length) {
77 accumulated_s = total_length;
78 }
79 const double s = std::fmin(accumulated_s, total_length);
80 static constexpr double kMinAllowedSampleStep = 1.0;
81 if (std::fabs(s - prev_s) < kMinAllowedSampleStep) {
82 continue;
83 }
84 prev_s = s;
85
86 double left_width = 0.0;
87 double right_width = 0.0;
89 &right_width);
90
91 static constexpr double kBoundaryBuff = 0.20;
92 const double eff_right_width = right_width - half_adc_width - kBoundaryBuff;
93 const double eff_left_width = left_width - half_adc_width - kBoundaryBuff;
94
95 // the heuristic shift of L for lane change scenarios
96 const double delta_dl = 1.2 / 20.0;
97 const double kChangeLaneDeltaL = common::math::Clamp(
98 level_distance * (std::fabs(init_frenet_frame_point_.dl()) + delta_dl),
99 1.2, 3.5);
100
101 double kDefaultUnitL = kChangeLaneDeltaL / (num_sample_per_level - 1);
104 kDefaultUnitL = 1.0;
105 }
106 const double sample_l_range = kDefaultUnitL * (num_sample_per_level - 1);
107 double sample_right_boundary = -eff_right_width;
108 double sample_left_boundary = eff_left_width;
109
110 static constexpr double kLargeDeviationL = 1.75;
111 static constexpr double kTwentyMilesPerHour = 8.94;
113 std::fabs(init_sl_point_.l()) > kLargeDeviationL) {
114 if (injector_->ego_info()->start_point().v() > kTwentyMilesPerHour) {
115 sample_right_boundary = std::fmin(-eff_right_width, init_sl_point_.l());
116 sample_left_boundary = std::fmax(eff_left_width, init_sl_point_.l());
117
118 if (init_sl_point_.l() > eff_left_width) {
119 sample_right_boundary = std::fmax(
120 sample_right_boundary, init_sl_point_.l() - sample_l_range);
121 }
122 if (init_sl_point_.l() < eff_right_width) {
123 sample_left_boundary = std::fmin(sample_left_boundary,
124 init_sl_point_.l() + sample_l_range);
125 }
126 }
127 }
128
129 std::vector<double> sample_l;
133 } else {
135 sample_right_boundary, sample_left_boundary,
136 static_cast<uint32_t>(num_sample_per_level - 1), &sample_l);
137 }
138 std::vector<common::SLPoint> level_points;
139 planning_internal::SampleLayerDebug sample_layer_debug;
140 for (size_t j = 0; j < sample_l.size(); ++j) {
141 common::SLPoint sl =
143 sample_layer_debug.add_sl_point()->CopyFrom(sl);
144 level_points.push_back(std::move(sl));
145 }
146 if (!level_points.empty()) {
147 planning_debug_->mutable_planning_data()
148 ->mutable_dp_poly_graph()
149 ->add_sample_layer()
150 ->CopyFrom(sample_layer_debug);
151 points->emplace_back(level_points);
152 }
153 }
154 return true;
155}
static SLPoint ToSLPoint(const double s, const double l)
const ReferenceLine & reference_line() const
bool IsChangeLanePath() const
Check if the current reference line is a change lane reference line, i.e., ADC's current position is ...
bool GetLaneWidth(const double s, double *const lane_left_width, double *const lane_right_width) const
apollo::planning_internal::Debug * planning_debug_
T Clamp(const T value, T bound1, T bound2)
Clamp a value between two bounds.
Definition math_utils.h:155
void uniform_slice(const T start, const T end, uint32_t num, std::vector< T > *sliced)
uniformly slice a segment [start, end] to num + 1 pieces the result sliced will contain the n + 1 poi...
Definition util.h:74
bool IsClearToChangeLane(ReferenceLineInfo *reference_line_info)
A static function to check if the ChangeLanePath type of reference line is safe or if current referen...

◆ SetDebugLogger()

virtual void apollo::planning::WaypointSampler::SetDebugLogger ( apollo::planning_internal::Debug *  debug)
inlinevirtual

在文件 waypoint_sampler.h 第 49 行定义.

49 {
50 planning_debug_ = debug;
51 }

类成员变量说明

◆ config_

const WaypointSamplerConfig& apollo::planning::WaypointSampler::config_
protected

在文件 waypoint_sampler.h 第 58 行定义.

◆ init_frenet_frame_point_

common::FrenetFramePoint apollo::planning::WaypointSampler::init_frenet_frame_point_
protected

在文件 waypoint_sampler.h 第 61 行定义.

◆ init_sl_point_

common::SLPoint apollo::planning::WaypointSampler::init_sl_point_
protected

在文件 waypoint_sampler.h 第 60 行定义.

◆ planning_debug_

apollo::planning_internal::Debug* apollo::planning::WaypointSampler::planning_debug_ = nullptr
protected

在文件 waypoint_sampler.h 第 62 行定义.

◆ reference_line_info_

const ReferenceLineInfo* apollo::planning::WaypointSampler::reference_line_info_ = nullptr
protected

在文件 waypoint_sampler.h 第 59 行定义.


该类的文档由以下文件生成: