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

#include <piecewise_trajectory1d.h>

类 apollo::planning::PiecewiseTrajectory1d 继承关系图:
apollo::planning::PiecewiseTrajectory1d 的协作图:

Public 成员函数

 PiecewiseTrajectory1d ()=default
 
virtual ~PiecewiseTrajectory1d ()=default
 
double Evaluate (const std::uint32_t order, const double param) const
 
double ParamLength () const
 
std::string ToString () const
 
void AppendSegment (const std::shared_ptr< Curve1d > trajectory)
 
void PopSegment ()
 
size_t NumOfSegments () const
 
- Public 成员函数 继承自 apollo::planning::Curve1d
 Curve1d ()=default
 
virtual ~Curve1d ()=default
 

详细描述

在文件 piecewise_trajectory1d.h 第 32 行定义.

构造及析构函数说明

◆ PiecewiseTrajectory1d()

apollo::planning::PiecewiseTrajectory1d::PiecewiseTrajectory1d ( )
default

◆ ~PiecewiseTrajectory1d()

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

成员函数说明

◆ AppendSegment()

void apollo::planning::PiecewiseTrajectory1d::AppendSegment ( const std::shared_ptr< Curve1d >  trajectory)

在文件 piecewise_trajectory1d.cc 第 54 行定义.

55 {
56 if (trajectory_segments_.empty()) {
57 trajectory_segments_.push_back(trajectory);
58 } else {
59 double s1 = trajectory->Evaluate(0, 0.0);
60 double v1 = trajectory->Evaluate(1, 0.0);
61 double a1 = trajectory->Evaluate(2, 0.0);
62 double j1 = trajectory->Evaluate(3, 0.0);
63
64 auto last_trajectory = trajectory_segments_.back();
65 double last_param_length = last_trajectory->ParamLength();
66 double s0 = last_trajectory->Evaluate(0, last_param_length);
67 double v0 = last_trajectory->Evaluate(1, last_param_length);
68 double a0 = last_trajectory->Evaluate(2, last_param_length);
69 double j0 = last_trajectory->Evaluate(3, last_param_length);
70
71 if (std::fabs(s0 - s1) > 1.0e-4) {
72 AWARN << "The appended segment is not smooth in order 0";
73 }
74
75 if (std::fabs(v0 - v1) > 1.0e-4) {
76 AWARN << "The appended segment is not smooth in order 1";
77 }
78
79 if (std::fabs(a0 - a1) > 1.0e-4) {
80 AWARN << "The appended segment is not smooth in order 2";
81 }
82
83 if (std::fabs(j0 - j1) > 1.0e-4) {
84 AWARN << "The appended segment is not smooth in order 3";
85 }
86 trajectory_segments_.push_back(trajectory);
87 }
88
89 double accumulated_param_length = trajectory->ParamLength();
90 if (accumulated_param_lengths_.size() > 0) {
91 accumulated_param_length += accumulated_param_lengths_.back();
92 }
93 accumulated_param_lengths_.push_back(accumulated_param_length);
94}
#define AWARN
Definition log.h:43

◆ Evaluate()

double apollo::planning::PiecewiseTrajectory1d::Evaluate ( const std::uint32_t  order,
const double  param 
) const
virtual

实现了 apollo::planning::Curve1d.

在文件 piecewise_trajectory1d.cc 第 30 行定义.

31 {
32 auto it_lower = std::lower_bound(accumulated_param_lengths_.begin(),
33 accumulated_param_lengths_.end(), param);
34 ACHECK(it_lower != accumulated_param_lengths_.end());
35
36 size_t index = (size_t)(it_lower - accumulated_param_lengths_.begin());
37
38 double param_overhead = 0.0;
39 if (index != 0) {
40 param_overhead = accumulated_param_lengths_[index - 1];
41 }
42 return trajectory_segments_[index]->Evaluate(order, param - param_overhead);
43}
#define ACHECK(cond)
Definition log.h:80

◆ NumOfSegments()

size_t apollo::planning::PiecewiseTrajectory1d::NumOfSegments ( ) const

在文件 piecewise_trajectory1d.cc 第 104 行定义.

104 {
105 return trajectory_segments_.size();
106}

◆ ParamLength()

double apollo::planning::PiecewiseTrajectory1d::ParamLength ( ) const
virtual

实现了 apollo::planning::Curve1d.

在文件 piecewise_trajectory1d.cc 第 45 行定义.

45 {
46 if (accumulated_param_lengths_.empty()) {
47 return 0.0;
48 }
49 return accumulated_param_lengths_.back();
50}

◆ PopSegment()

void apollo::planning::PiecewiseTrajectory1d::PopSegment ( )

在文件 piecewise_trajectory1d.cc 第 96 行定义.

96 {
97 if (trajectory_segments_.empty()) {
98 return;
99 }
100 trajectory_segments_.pop_back();
101 accumulated_param_lengths_.pop_back();
102}

◆ ToString()

std::string apollo::planning::PiecewiseTrajectory1d::ToString ( ) const
virtual

实现了 apollo::planning::Curve1d.

在文件 piecewise_trajectory1d.cc 第 52 行定义.

52{ return ""; }

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