Apollo 10.0
自动驾驶开放平台
apollo::planning::PathData类 参考

#include <path_data.h>

apollo::planning::PathData 的协作图:

Public 类型

enum class  PathPointType {
  IN_LANE , OUT_ON_FORWARD_LANE , OUT_ON_REVERSE_LANE , OFF_ROAD ,
  UNKNOWN
}
 

Public 成员函数

 PathData ()=default
 
bool SetDiscretizedPath (DiscretizedPath path)
 
bool SetFrenetPath (FrenetFramePath frenet_path)
 
void SetReferenceLine (const ReferenceLine *reference_line)
 
bool SetPathPointDecisionGuide (std::vector< std::tuple< double, PathPointType, double > > path_point_decision_guide)
 
const DiscretizedPathdiscretized_path () const
 
const FrenetFramePathfrenet_frame_path () const
 
const std::vector< std::tuple< double, PathPointType, double > > & path_point_decision_guide () const
 
common::PathPoint GetPathPointWithPathS (const double s) const
 
bool GetPathPointWithRefS (const double ref_s, common::PathPoint *const path_point) const
 
bool LeftTrimWithRefS (const common::FrenetFramePoint &frenet_point)
 
bool UpdateFrenetFramePath (const ReferenceLine *reference_line)
 
void Clear ()
 
bool Empty () const
 
std::string DebugString () const
 
void set_path_label (const std::string &label)
 
const std::string & path_label () const
 
void set_blocking_obstacle_id (const std::string &obs_id)
 
const std::string & blocking_obstacle_id () const
 
const bool is_valid_path_reference () const
 
void set_is_valid_path_reference (bool is_valid_path_reference)
 
const bool is_optimized_towards_trajectory_reference () const
 
void set_is_optimized_towards_trajectory_reference (bool is_optimized_towards_trajectory_reference)
 
const std::vector< common::PathPoint > & path_reference () const
 
void set_path_reference (const std::vector< common::PathPoint > &path_reference)
 
bool is_reverse_path () const
 
void set_is_reverse_path (bool is_reverse_path)
 

详细描述

在文件 path_data.h36 行定义.

成员枚举类型说明

◆ PathPointType

构造及析构函数说明

◆ PathData()

apollo::planning::PathData::PathData ( )
default

成员函数说明

◆ blocking_obstacle_id()

const std::string & apollo::planning::PathData::blocking_obstacle_id ( ) const
inline

在文件 path_data.h91 行定义.

91 {
92 return blocking_obstacle_id_;
93 }

◆ Clear()

void apollo::planning::PathData::Clear ( )

在文件 path_data.cc153 行定义.

153 {
154 discretized_path_.clear();
155 frenet_path_.clear();
156 path_point_decision_guide_.clear();
157 path_reference_.clear();
158 reference_line_ = nullptr;
159}

◆ DebugString()

std::string apollo::planning::PathData::DebugString ( ) const

在文件 path_data.cc161 行定义.

161 {
162 const auto limit =
163 std::min(discretized_path_.size(),
164 static_cast<size_t>(FLAGS_trajectory_point_num_for_debug));
165
166 return absl::StrCat(
167 "[\n",
168 absl::StrJoin(discretized_path_.begin(),
169 discretized_path_.begin() + limit, ",\n",
171 "]\n");
172}

◆ discretized_path()

const DiscretizedPath & apollo::planning::PathData::discretized_path ( ) const

在文件 path_data.cc90 行定义.

90 {
91 return discretized_path_;
92}

◆ Empty()

bool apollo::planning::PathData::Empty ( ) const

在文件 path_data.cc103 行定义.

103 {
104 return discretized_path_.empty() && frenet_path_.empty();
105}

◆ frenet_frame_path()

const FrenetFramePath & apollo::planning::PathData::frenet_frame_path ( ) const

在文件 path_data.cc94 行定义.

94 {
95 return frenet_path_;
96}

◆ GetPathPointWithPathS()

common::PathPoint apollo::planning::PathData::GetPathPointWithPathS ( const double  s) const

在文件 path_data.cc112 行定义.

112 {
113 return discretized_path_.Evaluate(s);
114}
common::PathPoint Evaluate(const double path_s) const

◆ GetPathPointWithRefS()

bool apollo::planning::PathData::GetPathPointWithRefS ( const double  ref_s,
common::PathPoint *const  path_point 
) const

在文件 path_data.cc116 行定义.

117 {
118 ACHECK(reference_line_);
119 DCHECK_EQ(discretized_path_.size(), frenet_path_.size());
120 if (ref_s < 0) {
121 AERROR << "ref_s[" << ref_s << "] should be > 0";
122 return false;
123 }
124 if (ref_s > frenet_path_.back().s()) {
125 AERROR << "ref_s is larger than the length of frenet_path_ length ["
126 << frenet_path_.back().s() << "].";
127 return false;
128 }
129
130 uint32_t index = 0;
131 const double kDistanceEpsilon = 1e-3;
132 for (uint32_t i = 0; i + 1 < frenet_path_.size(); ++i) {
133 if (fabs(ref_s - frenet_path_.at(i).s()) < kDistanceEpsilon) {
134 path_point->CopyFrom(discretized_path_.at(i));
135 return true;
136 }
137 if (frenet_path_.at(i).s() < ref_s && ref_s <= frenet_path_.at(i + 1).s()) {
138 index = i;
139 break;
140 }
141 }
142 double r = (ref_s - frenet_path_.at(index).s()) /
143 (frenet_path_.at(index + 1).s() - frenet_path_.at(index).s());
144
145 const double discretized_path_s = discretized_path_.at(index).s() +
146 r * (discretized_path_.at(index + 1).s() -
147 discretized_path_.at(index).s());
148 path_point->CopyFrom(discretized_path_.Evaluate(discretized_path_s));
149
150 return true;
151}
#define ACHECK(cond)
Definition log.h:80
#define AERROR
Definition log.h:44

◆ is_optimized_towards_trajectory_reference()

const bool apollo::planning::PathData::is_optimized_towards_trajectory_reference ( ) const
inline

在文件 path_data.h102 行定义.

102 {
103 return is_optimized_towards_trajectory_reference_;
104 }

◆ is_reverse_path()

bool apollo::planning::PathData::is_reverse_path ( ) const
inline

在文件 path_data.h113 行定义.

113{ return is_reverse_path_; }

◆ is_valid_path_reference()

const bool apollo::planning::PathData::is_valid_path_reference ( ) const
inline

在文件 path_data.h95 行定义.

95 {
96 return is_valid_path_reference_;
97 }

◆ LeftTrimWithRefS()

bool apollo::planning::PathData::LeftTrimWithRefS ( const common::FrenetFramePoint frenet_point)

在文件 path_data.cc240 行定义.

240 {
241 ACHECK(reference_line_);
242 std::vector<common::FrenetFramePoint> frenet_frame_points;
243 frenet_frame_points.emplace_back(frenet_point);
244
245 for (const common::FrenetFramePoint fp : frenet_path_) {
246 if (std::fabs(fp.s() - frenet_point.s()) < 1e-6) {
247 continue;
248 }
249 if (fp.s() > frenet_point.s()) {
250 frenet_frame_points.push_back(fp);
251 }
252 }
253 SetFrenetPath(FrenetFramePath(std::move(frenet_frame_points)));
254 return true;
255}
bool SetFrenetPath(FrenetFramePath frenet_path)
Definition path_data.cc:58

◆ path_label()

const std::string & apollo::planning::PathData::path_label ( ) const

在文件 path_data.cc264 行定义.

264{ return path_label_; }

◆ path_point_decision_guide()

const std::vector< std::tuple< double, PathData::PathPointType, double > > & apollo::planning::PathData::path_point_decision_guide ( ) const

在文件 path_data.cc99 行定义.

99 {
100 return path_point_decision_guide_;
101}

◆ path_reference()

const std::vector< PathPoint > & apollo::planning::PathData::path_reference ( ) const

在文件 path_data.cc266 行定义.

266 {
267 return path_reference_;
268}

◆ set_blocking_obstacle_id()

void apollo::planning::PathData::set_blocking_obstacle_id ( const std::string &  obs_id)
inline

在文件 path_data.h88 行定义.

88 {
89 blocking_obstacle_id_ = obs_id;
90 }

◆ set_is_optimized_towards_trajectory_reference()

void apollo::planning::PathData::set_is_optimized_towards_trajectory_reference ( bool  is_optimized_towards_trajectory_reference)
inline

在文件 path_data.h105 行定义.

106 {
107 is_optimized_towards_trajectory_reference_ =
109 }
const bool is_optimized_towards_trajectory_reference() const
Definition path_data.h:102

◆ set_is_reverse_path()

void apollo::planning::PathData::set_is_reverse_path ( bool  is_reverse_path)
inline

在文件 path_data.h114 行定义.

114 {
115 is_reverse_path_ = is_reverse_path;
116 }
bool is_reverse_path() const
Definition path_data.h:113

◆ set_is_valid_path_reference()

void apollo::planning::PathData::set_is_valid_path_reference ( bool  is_valid_path_reference)
inline

在文件 path_data.h98 行定义.

98 {
99 is_valid_path_reference_ = is_valid_path_reference;
100 }
const bool is_valid_path_reference() const
Definition path_data.h:95

◆ set_path_label()

void apollo::planning::PathData::set_path_label ( const std::string &  label)

在文件 path_data.cc262 行定义.

262{ path_label_ = label; }

◆ set_path_reference()

void apollo::planning::PathData::set_path_reference ( const std::vector< common::PathPoint > &  path_reference)

在文件 path_data.cc270 行定义.

271 {
272 path_reference_ = std::move(path_reference);
273}
const std::vector< common::PathPoint > & path_reference() const
Definition path_data.cc:266

◆ SetDiscretizedPath()

bool apollo::planning::PathData::SetDiscretizedPath ( DiscretizedPath  path)

在文件 path_data.cc43 行定义.

43 {
44 if (reference_line_ == nullptr) {
45 AERROR << "Should NOT set discretized path when reference line is nullptr. "
46 "Please set reference line first.";
47 return false;
48 }
49 discretized_path_ = std::move(path);
50 if (!XYToSL(discretized_path_, &frenet_path_)) {
51 AERROR << "Fail to transfer discretized path to frenet path.";
52 return false;
53 }
54 DCHECK_EQ(discretized_path_.size(), frenet_path_.size());
55 return true;
56}

◆ SetFrenetPath()

bool apollo::planning::PathData::SetFrenetPath ( FrenetFramePath  frenet_path)

在文件 path_data.cc58 行定义.

58 {
59 if (reference_line_ == nullptr) {
60 AERROR << "Should NOT set frenet path when reference line is nullptr. "
61 "Please set reference line first.";
62 return false;
63 }
64 frenet_path_ = std::move(frenet_path);
65 if (!SLToXY(frenet_path_, &discretized_path_)) {
66 AERROR << "Fail to transfer frenet path to discretized path.";
67 return false;
68 }
69 DCHECK_EQ(discretized_path_.size(), frenet_path_.size());
70 return true;
71}

◆ SetPathPointDecisionGuide()

bool apollo::planning::PathData::SetPathPointDecisionGuide ( std::vector< std::tuple< double, PathPointType, double > >  path_point_decision_guide)

在文件 path_data.cc73 行定义.

75 {
76 if (reference_line_ == nullptr) {
77 AERROR << "Should NOT set path_point_decision_guide when reference line is "
78 "nullptr. ";
79 return false;
80 }
81 if (frenet_path_.empty() || discretized_path_.empty()) {
82 AERROR << "Should NOT set path_point_decision_guide when frenet_path or "
83 "world frame trajectory is empty. ";
84 return false;
85 }
86 path_point_decision_guide_ = std::move(path_point_decision_guide);
87 return true;
88}
const std::vector< std::tuple< double, PathPointType, double > > & path_point_decision_guide() const
Definition path_data.cc:99

◆ SetReferenceLine()

void apollo::planning::PathData::SetReferenceLine ( const ReferenceLine reference_line)

在文件 path_data.cc107 行定义.

107 {
108 Clear();
109 reference_line_ = reference_line;
110}

◆ UpdateFrenetFramePath()

bool apollo::planning::PathData::UpdateFrenetFramePath ( const ReferenceLine reference_line)

在文件 path_data.cc257 行定义.

257 {
258 reference_line_ = reference_line;
259 return SetDiscretizedPath(discretized_path_);
260}
bool SetDiscretizedPath(DiscretizedPath path)
Definition path_data.cc:43

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