Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
356f3727
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
356f3727
编写于
8月 09, 2017
作者:
K
kechxu
提交者:
Jiangtao Hu
8月 09, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
small coding style fix for private data members in dp_st_cost.cc
上级
5f329995
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
40 deletion
+40
-40
modules/planning/optimizer/dp_st_speed/dp_st_cost.cc
modules/planning/optimizer/dp_st_speed/dp_st_cost.cc
+37
-37
modules/planning/optimizer/dp_st_speed/dp_st_cost.h
modules/planning/optimizer/dp_st_speed/dp_st_cost.h
+3
-3
未找到文件。
modules/planning/optimizer/dp_st_speed/dp_st_cost.cc
浏览文件 @
356f3727
...
...
@@ -29,11 +29,11 @@ namespace apollo {
namespace
planning
{
DpStCost
::
DpStCost
(
const
DpStSpeedConfig
&
dp_st_speed_config
)
:
_dp_st_speed_config
(
dp_st_speed_config
)
{
_unit_s
=
_dp_st_speed_config
.
total_path_length
()
/
_dp_st_speed_config
.
matrix_dimension_s
();
_unit_t
=
_dp_st_speed_config
.
total_time
()
/
_dp_st_speed_config
.
matrix_dimension_t
();
:
dp_st_speed_config_
(
dp_st_speed_config
)
{
unit_s_
=
dp_st_speed_config_
.
total_path_length
()
/
dp_st_speed_config_
.
matrix_dimension_s
();
unit_t_
=
dp_st_speed_config_
.
total_time
()
/
dp_st_speed_config_
.
matrix_dimension_t
();
}
// TODO(all): normalize cost with time
...
...
@@ -43,11 +43,11 @@ double DpStCost::GetObstacleCost(
double
total_cost
=
0.0
;
for
(
const
StGraphBoundary
&
boundary
:
st_graph_boundaries
)
{
if
(
point
.
s
()
<
0
||
boundary
.
IsPointInBoundary
(
point
))
{
total_cost
+=
_dp_st_speed_config
.
st_graph_default_point_cost
();
total_cost
+=
dp_st_speed_config_
.
st_graph_default_point_cost
();
}
else
{
double
distance
=
boundary
.
DistanceTo
(
point
);
total_cost
+=
_dp_st_speed_config
.
st_graph_default_point_cost
()
*
std
::
exp
(
_dp_st_speed_config
.
obstacle_cost_factor
()
/
total_cost
+=
dp_st_speed_config_
.
st_graph_default_point_cost
()
*
std
::
exp
(
dp_st_speed_config_
.
obstacle_cost_factor
()
/
boundary
.
characteristic_length
()
*
distance
);
}
}
...
...
@@ -56,26 +56,26 @@ double DpStCost::GetObstacleCost(
double
DpStCost
::
GetReferenceCost
(
const
STPoint
&
point
,
const
STPoint
&
reference_point
)
const
{
return
_dp_st_speed_config
.
reference_weight
()
*
return
dp_st_speed_config_
.
reference_weight
()
*
(
point
.
s
()
-
reference_point
.
s
())
*
(
point
.
s
()
-
reference_point
.
s
())
*
_unit_t
;
unit_t_
;
}
double
DpStCost
::
GetSpeedCost
(
const
STPoint
&
first
,
const
STPoint
&
second
,
const
double
speed_limit
)
const
{
double
cost
=
0.0
;
double
speed
=
(
second
.
s
()
-
first
.
s
())
/
_unit_t
;
double
speed
=
(
second
.
s
()
-
first
.
s
())
/
unit_t_
;
if
(
Double
::
Compare
(
speed
,
0.0
)
<
0
)
{
cost
=
_dp_st_speed_config
.
st_graph_default_point_cost
();
cost
=
dp_st_speed_config_
.
st_graph_default_point_cost
();
}
double
det_speed
=
(
speed
-
speed_limit
)
/
speed_limit
;
if
(
Double
::
Compare
(
det_speed
,
0.0
)
>
0
)
{
cost
=
_dp_st_speed_config
.
exceed_speed_penalty
()
*
_dp_st_speed_config
.
default_speed_cost
()
*
fabs
(
speed
*
speed
)
*
_unit_t
;
cost
=
dp_st_speed_config_
.
exceed_speed_penalty
()
*
dp_st_speed_config_
.
default_speed_cost
()
*
fabs
(
speed
*
speed
)
*
unit_t_
;
}
else
if
(
Double
::
Compare
(
det_speed
,
0.0
)
<
0
)
{
cost
=
_dp_st_speed_config
.
low_speed_penalty
()
*
_dp_st_speed_config
.
default_speed_cost
()
*
-
det_speed
*
_unit_t
;
cost
=
dp_st_speed_config_
.
low_speed_penalty
()
*
dp_st_speed_config_
.
default_speed_cost
()
*
-
det_speed
*
unit_t_
;
}
else
{
cost
=
0.0
;
}
...
...
@@ -84,15 +84,15 @@ double DpStCost::GetSpeedCost(const STPoint& first, const STPoint& second,
double
DpStCost
::
GetAccelCost
(
const
double
accel
)
const
{
double
accel_sq
=
accel
*
accel
;
double
max_acc
=
_dp_st_speed_config
.
max_acceleration
();
double
max_dec
=
_dp_st_speed_config
.
max_deceleration
();
double
accel_penalty
=
_dp_st_speed_config
.
accel_penalty
();
double
decel_penalty
=
_dp_st_speed_config
.
decel_penalty
();
double
max_acc
=
dp_st_speed_config_
.
max_acceleration
();
double
max_dec
=
dp_st_speed_config_
.
max_deceleration
();
double
accel_penalty
=
dp_st_speed_config_
.
accel_penalty
();
double
decel_penalty
=
dp_st_speed_config_
.
decel_penalty
();
double
cost
=
0.0
;
if
(
accel
>
0.0
)
{
cost
=
accel_penalty
*
accel_sq
*
_unit_t
;
cost
=
accel_penalty
*
accel_sq
*
unit_t_
;
}
else
{
cost
=
decel_penalty
*
accel_sq
*
_unit_t
;
cost
=
decel_penalty
*
accel_sq
*
unit_t_
;
}
cost
+=
accel_sq
*
decel_penalty
*
decel_penalty
/
(
1
+
std
::
exp
(
1.0
*
(
accel
-
max_dec
)))
+
...
...
@@ -104,15 +104,15 @@ double DpStCost::GetAccelCost(const double accel) const {
double
DpStCost
::
GetAccelCostByThreePoints
(
const
STPoint
&
first
,
const
STPoint
&
second
,
const
STPoint
&
third
)
const
{
double
accel
=
(
first
.
s
()
+
third
.
s
()
-
2
*
second
.
s
())
/
(
_unit_t
*
_unit_t
);
double
accel
=
(
first
.
s
()
+
third
.
s
()
-
2
*
second
.
s
())
/
(
unit_t_
*
unit_t_
);
return
GetAccelCost
(
accel
);
}
double
DpStCost
::
GetAccelCostByTwoPoints
(
const
double
pre_speed
,
const
STPoint
&
pre_point
,
const
STPoint
&
curr_point
)
const
{
double
current_speed
=
(
curr_point
.
s
()
-
pre_point
.
s
())
/
_unit_t
;
double
accel
=
(
current_speed
-
pre_speed
)
/
_unit_t
;
double
current_speed
=
(
curr_point
.
s
()
-
pre_point
.
s
())
/
unit_t_
;
double
accel
=
(
current_speed
-
pre_speed
)
/
unit_t_
;
return
GetAccelCost
(
accel
);
}
...
...
@@ -120,9 +120,9 @@ double DpStCost::JerkCost(const double jerk) const {
double
jerk_sq
=
jerk
*
jerk
;
double
cost
=
0.0
;
if
(
Double
::
Compare
(
jerk
,
0.0
)
>
0
)
{
cost
=
_dp_st_speed_config
.
positive_jerk_coeff
()
*
jerk_sq
*
_unit_t
;
cost
=
dp_st_speed_config_
.
positive_jerk_coeff
()
*
jerk_sq
*
unit_t_
;
}
else
if
(
Double
::
Compare
(
jerk
,
0.0
)
<
0
)
{
cost
=
_dp_st_speed_config
.
negative_jerk_coeff
()
*
jerk_sq
*
_unit_t
;
cost
=
dp_st_speed_config_
.
negative_jerk_coeff
()
*
jerk_sq
*
unit_t_
;
}
else
{
cost
=
0.0
;
}
...
...
@@ -134,7 +134,7 @@ double DpStCost::GetJerkCostByFourPoints(const STPoint& first,
const
STPoint
&
third
,
const
STPoint
&
fourth
)
const
{
double
jerk
=
(
fourth
.
s
()
-
3
*
third
.
s
()
+
3
*
second
.
s
()
-
first
.
s
())
/
(
_unit_t
*
_unit_t
*
_unit_t
);
(
unit_t_
*
unit_t_
*
unit_t_
);
return
JerkCost
(
jerk
);
}
...
...
@@ -142,9 +142,9 @@ double DpStCost::GetJerkCostByTwoPoints(const double pre_speed,
const
double
pre_acc
,
const
STPoint
&
pre_point
,
const
STPoint
&
curr_point
)
const
{
double
curr_speed
=
(
curr_point
.
s
()
-
pre_point
.
s
())
/
_unit_t
;
double
curr_accel
=
(
curr_speed
-
pre_speed
)
/
_unit_t
;
double
jerk
=
(
curr_accel
-
pre_acc
)
/
_unit_t
;
double
curr_speed
=
(
curr_point
.
s
()
-
pre_point
.
s
())
/
unit_t_
;
double
curr_accel
=
(
curr_speed
-
pre_speed
)
/
unit_t_
;
double
jerk
=
(
curr_accel
-
pre_acc
)
/
unit_t_
;
return
JerkCost
(
jerk
);
}
...
...
@@ -152,11 +152,11 @@ double DpStCost::GetJerkCostByThreePoints(const double first_speed,
const
STPoint
&
first
,
const
STPoint
&
second
,
const
STPoint
&
third
)
const
{
double
pre_speed
=
(
second
.
s
()
-
first
.
s
())
/
_unit_t
;
double
pre_acc
=
(
pre_speed
-
first_speed
)
/
_unit_t
;
double
curr_speed
=
(
third
.
s
()
-
second
.
s
())
/
_unit_t
;
double
curr_acc
=
(
curr_speed
-
pre_speed
)
/
_unit_t
;
double
jerk
=
(
curr_acc
-
pre_acc
)
/
_unit_t
;
double
pre_speed
=
(
second
.
s
()
-
first
.
s
())
/
unit_t_
;
double
pre_acc
=
(
pre_speed
-
first_speed
)
/
unit_t_
;
double
curr_speed
=
(
third
.
s
()
-
second
.
s
())
/
unit_t_
;
double
curr_acc
=
(
curr_speed
-
pre_speed
)
/
unit_t_
;
double
jerk
=
(
curr_acc
-
pre_acc
)
/
unit_t_
;
return
JerkCost
(
jerk
);
}
...
...
modules/planning/optimizer/dp_st_speed/dp_st_cost.h
浏览文件 @
356f3727
...
...
@@ -67,9 +67,9 @@ class DpStCost {
double
GetAccelCost
(
const
double
accel
)
const
;
double
JerkCost
(
const
double
jerk
)
const
;
const
DpStSpeedConfig
&
_dp_st_speed_config
;
double
_unit_s
=
0.0
;
double
_unit_t
=
0.0
;
const
DpStSpeedConfig
&
dp_st_speed_config_
;
double
unit_s_
=
0.0
;
double
unit_t_
=
0.0
;
};
}
// namespace planning
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录