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

#include <comparable_cost.h>

apollo::planning::ComparableCost 的协作图:

Public 成员函数

 ComparableCost ()=default
 
 ComparableCost (const bool has_collision, const bool out_of_boundary, const bool out_of_lane, const double safety_cost_, const double smoothness_cost_)
 
 ComparableCost (const ComparableCost &)=default
 
int CompareTo (const ComparableCost &other) const
 
ComparableCost operator+ (const ComparableCost &other)
 
ComparableCost & operator+= (const ComparableCost &other)
 
bool operator> (const ComparableCost &other) const
 
bool operator>= (const ComparableCost &other) const
 
bool operator< (const ComparableCost &other) const
 
bool operator<= (const ComparableCost &other) const
 

Public 属性

std::array< bool, 3 > cost_items = {{false, false, false}}
 
double safety_cost = 0.0f
 
double smoothness_cost = 0.0f
 

静态 Public 属性

static const size_t HAS_COLLISION = 0
 
static const size_t OUT_OF_BOUNDARY = 1
 
static const size_t OUT_OF_LANE = 2
 

详细描述

在文件 comparable_cost.h 第 26 行定义.

构造及析构函数说明

◆ ComparableCost() [1/3]

apollo::planning::ComparableCost::ComparableCost ( )
default

◆ ComparableCost() [2/3]

apollo::planning::ComparableCost::ComparableCost ( const bool  has_collision,
const bool  out_of_boundary,
const bool  out_of_lane,
const double  safety_cost_,
const double  smoothness_cost_ 
)
inline

在文件 comparable_cost.h 第 29 行定义.

32 : safety_cost(safety_cost_), smoothness_cost(smoothness_cost_) {
33 cost_items[HAS_COLLISION] = has_collision;
34 cost_items[OUT_OF_BOUNDARY] = out_of_boundary;
35 cost_items[OUT_OF_LANE] = out_of_lane;
36 }

◆ ComparableCost() [3/3]

apollo::planning::ComparableCost::ComparableCost ( const ComparableCost &  )
default

成员函数说明

◆ CompareTo()

int apollo::planning::ComparableCost::CompareTo ( const ComparableCost &  other) const
inline

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

39 {
40 for (size_t i = 0; i < cost_items.size(); ++i) {
41 if (cost_items[i]) {
42 if (other.cost_items[i]) {
43 continue;
44 } else {
45 return 1;
46 }
47 } else {
48 if (other.cost_items[i]) {
49 return -1;
50 } else {
51 continue;
52 }
53 }
54 }
55
56 static constexpr double kEpsilon = 1e-12;
57 const double diff = safety_cost + smoothness_cost - other.safety_cost -
58 other.smoothness_cost;
59 if (std::fabs(diff) < kEpsilon) {
60 return 0;
61 } else if (diff > 0) {
62 return 1;
63 } else {
64 return -1;
65 }
66 }
float diff(Image< float > *I, int x1, int y1, int x2, int y2)
Dissimilarity measure between pixels

◆ operator+()

ComparableCost apollo::planning::ComparableCost::operator+ ( const ComparableCost &  other)
inline

在文件 comparable_cost.h 第 67 行定义.

67 {
68 ComparableCost lhs = *this;
69 lhs += other;
70 return lhs;
71 }

◆ operator+=()

ComparableCost & apollo::planning::ComparableCost::operator+= ( const ComparableCost &  other)
inline

在文件 comparable_cost.h 第 72 行定义.

72 {
73 for (size_t i = 0; i < cost_items.size(); ++i) {
74 cost_items[i] = (cost_items[i] || other.cost_items[i]);
75 }
76 safety_cost += other.safety_cost;
77 smoothness_cost += other.smoothness_cost;
78 return *this;
79 }

◆ operator<()

bool apollo::planning::ComparableCost::operator< ( const ComparableCost &  other) const
inline

在文件 comparable_cost.h 第 86 行定义.

86 {
87 return this->CompareTo(other) < 0;
88 }
int CompareTo(const ComparableCost &other) const

◆ operator<=()

bool apollo::planning::ComparableCost::operator<= ( const ComparableCost &  other) const
inline

在文件 comparable_cost.h 第 89 行定义.

89 {
90 return this->CompareTo(other) <= 0;
91 }

◆ operator>()

bool apollo::planning::ComparableCost::operator> ( const ComparableCost &  other) const
inline

在文件 comparable_cost.h 第 80 行定义.

80 {
81 return this->CompareTo(other) > 0;
82 }

◆ operator>=()

bool apollo::planning::ComparableCost::operator>= ( const ComparableCost &  other) const
inline

在文件 comparable_cost.h 第 83 行定义.

83 {
84 return this->CompareTo(other) >= 0;
85 }

类成员变量说明

◆ cost_items

std::array<bool, 3> apollo::planning::ComparableCost::cost_items = {{false, false, false}}

在文件 comparable_cost.h 第 104 行定义.

104{{false, false, false}};

◆ HAS_COLLISION

const size_t apollo::planning::ComparableCost::HAS_COLLISION = 0
static

在文件 comparable_cost.h 第 101 行定义.

◆ OUT_OF_BOUNDARY

const size_t apollo::planning::ComparableCost::OUT_OF_BOUNDARY = 1
static

在文件 comparable_cost.h 第 102 行定义.

◆ OUT_OF_LANE

const size_t apollo::planning::ComparableCost::OUT_OF_LANE = 2
static

在文件 comparable_cost.h 第 103 行定义.

◆ safety_cost

double apollo::planning::ComparableCost::safety_cost = 0.0f

在文件 comparable_cost.h 第 107 行定义.

◆ smoothness_cost

double apollo::planning::ComparableCost::smoothness_cost = 0.0f

在文件 comparable_cost.h 第 109 行定义.


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