Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
ef253e65
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 搜索 >>
提交
ef253e65
编写于
10月 02, 2017
作者:
D
Dong Li
提交者:
Jiangtao Hu
10月 02, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: added st boundary for keep clear
上级
8954cc94
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
79 addition
and
69 deletion
+79
-69
modules/planning/proto/dp_st_speed_config.proto
modules/planning/proto/dp_st_speed_config.proto
+2
-0
modules/planning/tasks/dp_poly_path/trajectory_cost.cc
modules/planning/tasks/dp_poly_path/trajectory_cost.cc
+1
-1
modules/planning/tasks/dp_st_speed/BUILD
modules/planning/tasks/dp_st_speed/BUILD
+1
-0
modules/planning/tasks/dp_st_speed/dp_st_cost.cc
modules/planning/tasks/dp_st_speed/dp_st_cost.cc
+16
-6
modules/planning/tasks/dp_st_speed/dp_st_cost.h
modules/planning/tasks/dp_st_speed/dp_st_cost.h
+3
-1
modules/planning/tasks/dp_st_speed/dp_st_graph.cc
modules/planning/tasks/dp_st_speed/dp_st_graph.cc
+1
-2
modules/planning/tasks/path_decider/path_decider.cc
modules/planning/tasks/path_decider/path_decider.cc
+5
-0
modules/planning/tasks/speed_decider/speed_decider.h
modules/planning/tasks/speed_decider/speed_decider.h
+1
-1
modules/planning/tasks/st_graph/st_boundary_mapper.cc
modules/planning/tasks/st_graph/st_boundary_mapper.cc
+44
-58
modules/planning/tasks/st_graph/st_boundary_mapper.h
modules/planning/tasks/st_graph/st_boundary_mapper.h
+5
-0
未找到文件。
modules/planning/proto/dp_st_speed_config.proto
浏览文件 @
ef253e65
...
...
@@ -40,4 +40,6 @@ message DpStSpeedConfig {
optional
double
max_deceleration
=
22
[
default
=
-
4.5
];
optional
apollo.planning.StBoundaryConfig
st_boundary_config
=
33
;
optional
double
keep_clear_cost_factor
=
50
[
default
=
1000.0
];
}
modules/planning/tasks/dp_poly_path/trajectory_cost.cc
浏览文件 @
ef253e65
...
...
@@ -54,7 +54,7 @@ TrajectoryCost::TrajectoryCost(
continue
;
}
const
auto
ptr_obstacle
=
ptr_path_obstacle
->
obstacle
();
if
(
ptr_obstacle
->
PerceptionId
()
<
0
)
{
if
(
Obstacle
::
IsVirtualObstacle
(
ptr_obstacle
->
Perception
())
)
{
// Virtual obsatcle
continue
;
}
...
...
modules/planning/tasks/dp_st_speed/BUILD
浏览文件 @
ef253e65
...
...
@@ -25,6 +25,7 @@ cc_library(
"dp_st_cost.h"
,
],
deps
=
[
":st_graph_point"
,
"//modules/common/proto:pnc_point_proto"
,
"//modules/planning/common:frame"
,
"//modules/planning/common/speed:st_boundary"
,
...
...
modules/planning/tasks/dp_st_speed/dp_st_cost.cc
浏览文件 @
ef253e65
...
...
@@ -32,22 +32,32 @@ DpStCost::DpStCost(const DpStSpeedConfig& 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_
.
matrix_dimension_t
())
{
unit_v_
=
unit_s_
/
unit_t_
;
}
// TODO(all): normalize cost with time
double
DpStCost
::
GetObstacleCost
(
const
S
TPoint
&
point
,
const
S
tGraphPoint
&
st_graph_
point
,
const
std
::
vector
<
const
StBoundary
*>&
st_boundaries
)
const
{
double
total_cost
=
0.0
;
constexpr
double
inf
=
std
::
numeric_limits
<
double
>::
infinity
();
if
(
point
.
s
()
<
0
)
{
const
double
unit_v
=
unit_s_
/
unit_t_
;
const
auto
&
st_point
=
st_graph_point
.
point
();
if
(
st_point
.
s
()
<
0
)
{
return
inf
;
}
for
(
const
StBoundary
*
boundary
:
st_boundaries
)
{
if
(
boundary
->
IsPointInBoundary
(
point
))
{
return
inf
;
if
(
boundary
->
IsPointInBoundary
(
st_point
))
{
if
(
boundary
->
boundary_type
()
==
StBoundary
::
BoundaryType
::
KEEP_CLEAR
)
{
total_cost
+=
unit_v
*
((
st_graph_point
.
index_s
()
+
1.0
)
/
(
st_graph_point
.
index_t
()
+
1.0
))
*
dp_st_speed_config_
.
keep_clear_cost_factor
();
}
else
{
return
inf
;
}
}
else
{
const
double
distance
=
boundary
->
DistanceS
(
point
);
const
double
distance
=
boundary
->
DistanceS
(
st_
point
);
total_cost
+=
dp_st_speed_config_
.
default_obstacle_cost
()
*
std
::
exp
(
dp_st_speed_config_
.
obstacle_cost_factor
()
/
boundary
->
characteristic_length
()
*
distance
);
...
...
modules/planning/tasks/dp_st_speed/dp_st_cost.h
浏览文件 @
ef253e65
...
...
@@ -28,6 +28,7 @@
#include "modules/planning/common/speed/st_boundary.h"
#include "modules/planning/common/speed/st_point.h"
#include "modules/planning/tasks/dp_st_speed/st_graph_point.h"
namespace
apollo
{
namespace
planning
{
...
...
@@ -37,7 +38,7 @@ class DpStCost {
explicit
DpStCost
(
const
DpStSpeedConfig
&
dp_st_speed_config
);
double
GetObstacleCost
(
const
S
T
Point
&
point
,
const
S
tGraph
Point
&
point
,
const
std
::
vector
<
const
StBoundary
*>&
st_boundaries
)
const
;
double
GetReferenceCost
(
const
STPoint
&
point
,
...
...
@@ -70,6 +71,7 @@ class DpStCost {
const
DpStSpeedConfig
&
dp_st_speed_config_
;
double
unit_s_
=
0.0
;
double
unit_t_
=
0.0
;
double
unit_v_
=
0.0
;
};
}
// namespace planning
...
...
modules/planning/tasks/dp_st_speed/dp_st_graph.cc
浏览文件 @
ef253e65
...
...
@@ -133,8 +133,7 @@ void DpStGraph::CalculatePointwiseCost(
for
(
auto
&
st_graph_point
:
cost_table_
[
i
])
{
double
ref_cost
=
dp_st_cost_
.
GetReferenceCost
(
st_graph_point
.
point
(),
reference_points
[
i
]);
double
obs_cost
=
dp_st_cost_
.
GetObstacleCost
(
st_graph_point
.
point
(),
boundaries
);
double
obs_cost
=
dp_st_cost_
.
GetObstacleCost
(
st_graph_point
,
boundaries
);
st_graph_point
.
SetReferenceCost
(
ref_cost
);
st_graph_point
.
SetObstacleCost
(
obs_cost
);
st_graph_point
.
SetTotalCost
(
std
::
numeric_limits
<
double
>::
infinity
());
...
...
modules/planning/tasks/path_decider/path_decider.cc
浏览文件 @
ef253e65
...
...
@@ -96,6 +96,11 @@ bool PathDecider::MakeStaticObstacleDecision(
continue
;
}
if
(
path_obstacle
->
st_boundary
().
boundary_type
()
==
StBoundary
::
BoundaryType
::
KEEP_CLEAR
)
{
continue
;
}
// IGNORE by default
ObjectDecisionType
object_decision
;
object_decision
.
mutable_ignore
();
...
...
modules/planning/tasks/speed_decider/speed_decider.h
浏览文件 @
ef253e65
...
...
@@ -35,7 +35,7 @@ class SpeedDecider : public Task {
SpeedDecider
();
~
SpeedDecider
()
=
default
;
bool
Init
(
const
PlanningConfig
&
config
);
bool
Init
(
const
PlanningConfig
&
config
)
override
;
apollo
::
common
::
Status
Execute
(
Frame
*
frame
,
ReferenceLineInfo
*
reference_line_info
)
override
;
...
...
modules/planning/tasks/st_graph/st_boundary_mapper.cc
浏览文件 @
ef253e65
...
...
@@ -206,20 +206,15 @@ Status StBoundaryMapper::MapWithoutDecision(PathObstacle* path_obstacle) const {
return
Status
::
OK
();
}
if
(
lower_points
.
size
()
!=
upper_points
.
size
())
{
std
::
string
msg
=
common
::
util
::
StrCat
(
"lower_points.size()["
,
lower_points
.
size
(),
"] and upper_points.size()["
,
upper_points
.
size
(),
"] does NOT match."
);
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
}
if
(
lower_points
.
size
()
>
1
&&
upper_points
.
size
()
>
1
)
{
auto
boundary
=
StBoundary
::
GenerateStBoundary
(
lower_points
,
upper_points
)
.
ExpandByS
(
boundary_s_buffer
)
.
ExpandByT
(
boundary_t_buffer
);
boundary
.
SetId
(
path_obstacle
->
Id
());
path_obstacle
->
SetStBoundary
(
boundary
);
auto
boundary
=
StBoundary
::
GenerateStBoundary
(
lower_points
,
upper_points
)
.
ExpandByS
(
boundary_s_buffer
)
.
ExpandByT
(
boundary_t_buffer
);
boundary
.
SetId
(
path_obstacle
->
Id
());
const
auto
&
prev_st_boundary
=
path_obstacle
->
st_boundary
();
if
(
!
prev_st_boundary
.
IsEmpty
())
{
boundary
.
SetBoundaryType
(
prev_st_boundary
.
boundary_type
());
}
path_obstacle
->
SetStBoundary
(
boundary
);
return
Status
::
OK
();
}
...
...
@@ -359,7 +354,7 @@ bool StBoundaryMapper::GetOverlapBoundaryPoints(
}
}
DCHECK_EQ
(
lower_points
->
size
(),
upper_points
->
size
());
return
(
lower_points
->
size
()
>
0
&&
upper_points
->
size
()
>
0
);
return
(
lower_points
->
size
()
>
1
&&
upper_points
->
size
()
>
1
);
}
Status
StBoundaryMapper
::
MapWithPredictionTrajectory
(
...
...
@@ -376,55 +371,46 @@ Status StBoundaryMapper::MapWithPredictionTrajectory(
if
(
!
GetOverlapBoundaryPoints
(
path_data_
.
discretized_path
().
path_points
(),
*
(
path_obstacle
->
obstacle
()),
&
upper_points
,
&
lower_points
))
{
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"PLANNING_ERROR"
);
return
Status
::
OK
(
);
}
if
(
lower_points
.
size
()
!=
upper_points
.
size
())
{
std
::
string
msg
=
common
::
util
::
StrCat
(
"lower_points.size()["
,
lower_points
.
size
(),
"] and upper_points.size()["
,
upper_points
.
size
(),
"] does NOT match."
);
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
if
(
obj_decision
.
has_follow
()
&&
lower_points
.
back
().
t
()
<
planning_time_
)
{
const
double
diff_s
=
lower_points
.
back
().
s
()
-
lower_points
.
front
().
s
();
const
double
diff_t
=
lower_points
.
back
().
t
()
-
lower_points
.
front
().
t
();
double
extend_lower_s
=
diff_s
/
diff_t
*
(
planning_time_
-
lower_points
.
front
().
t
())
+
lower_points
.
front
().
s
();
const
double
extend_upper_s
=
extend_lower_s
+
(
upper_points
.
back
().
s
()
-
lower_points
.
back
().
s
())
+
1.0
;
upper_points
.
emplace_back
(
extend_upper_s
,
planning_time_
);
lower_points
.
emplace_back
(
extend_lower_s
,
planning_time_
);
}
if
(
lower_points
.
size
()
>
1
&&
upper_points
.
size
()
>
1
)
{
if
(
obj_decision
.
has_follow
()
&&
lower_points
.
back
().
t
()
<
planning_time_
)
{
const
double
diff_s
=
lower_points
.
back
().
s
()
-
lower_points
.
front
().
s
();
const
double
diff_t
=
lower_points
.
back
().
t
()
-
lower_points
.
front
().
t
();
double
extend_lower_s
=
diff_s
/
diff_t
*
(
planning_time_
-
lower_points
.
front
().
t
())
+
lower_points
.
front
().
s
();
const
double
extend_upper_s
=
extend_lower_s
+
(
upper_points
.
back
().
s
()
-
lower_points
.
back
().
s
())
+
1.0
;
upper_points
.
emplace_back
(
extend_upper_s
,
planning_time_
);
lower_points
.
emplace_back
(
extend_lower_s
,
planning_time_
);
}
auto
boundary
=
StBoundary
::
GenerateStBoundary
(
lower_points
,
upper_points
)
.
ExpandByS
(
boundary_s_buffer
)
.
ExpandByT
(
boundary_t_buffer
);
// get characteristic_length and boundary_type.
StBoundary
::
BoundaryType
b_type
=
StBoundary
::
BoundaryType
::
UNKNOWN
;
double
characteristic_length
=
0.0
;
if
(
obj_decision
.
has_follow
())
{
characteristic_length
=
std
::
fabs
(
obj_decision
.
follow
().
distance_s
());
b_type
=
StBoundary
::
BoundaryType
::
FOLLOW
;
}
else
if
(
obj_decision
.
has_yield
())
{
characteristic_length
=
std
::
fabs
(
obj_decision
.
yield
().
distance_s
());
b_type
=
StBoundary
::
BoundaryType
::
YIELD
;
}
else
if
(
obj_decision
.
has_overtake
())
{
characteristic_length
=
std
::
fabs
(
obj_decision
.
overtake
().
distance_s
());
b_type
=
StBoundary
::
BoundaryType
::
OVERTAKE
;
}
else
{
DCHECK
(
false
)
<<
"Obj decision should be either yield or overtake: "
<<
obj_decision
.
DebugString
();
}
boundary
.
SetBoundaryType
(
b_type
);
boundary
.
SetId
(
path_obstacle
->
obstacle
()
->
Id
());
boundary
.
SetCharacteristicLength
(
characteristic_length
);
path_obstacle
->
SetStBoundary
(
boundary
);
auto
boundary
=
StBoundary
::
GenerateStBoundary
(
lower_points
,
upper_points
)
.
ExpandByS
(
boundary_s_buffer
)
.
ExpandByT
(
boundary_t_buffer
);
// get characteristic_length and boundary_type.
StBoundary
::
BoundaryType
b_type
=
StBoundary
::
BoundaryType
::
UNKNOWN
;
double
characteristic_length
=
0.0
;
if
(
obj_decision
.
has_follow
())
{
characteristic_length
=
std
::
fabs
(
obj_decision
.
follow
().
distance_s
());
b_type
=
StBoundary
::
BoundaryType
::
FOLLOW
;
}
else
if
(
obj_decision
.
has_yield
())
{
characteristic_length
=
std
::
fabs
(
obj_decision
.
yield
().
distance_s
());
b_type
=
StBoundary
::
BoundaryType
::
YIELD
;
}
else
if
(
obj_decision
.
has_overtake
())
{
characteristic_length
=
std
::
fabs
(
obj_decision
.
overtake
().
distance_s
());
b_type
=
StBoundary
::
BoundaryType
::
OVERTAKE
;
}
else
{
DCHECK
(
false
)
<<
"Obj decision should be either yield or overtake: "
<<
obj_decision
.
DebugString
();
}
boundary
.
SetBoundaryType
(
b_type
);
boundary
.
SetId
(
path_obstacle
->
obstacle
()
->
Id
());
boundary
.
SetCharacteristicLength
(
characteristic_length
);
path_obstacle
->
SetStBoundary
(
boundary
);
return
Status
::
OK
();
}
...
...
modules/planning/tasks/st_graph/st_boundary_mapper.h
浏览文件 @
ef253e65
...
...
@@ -59,6 +59,11 @@ class StBoundaryMapper {
const
apollo
::
common
::
math
::
Box2d
&
obs_box
,
const
double
buffer
)
const
;
/**
* Creates valid st boundary upper_points and lower_points
* If return true, upper_points.size() > 1 and
* upper_points.size() = lower_points.size()
*/
bool
GetOverlapBoundaryPoints
(
const
std
::
vector
<
apollo
::
common
::
PathPoint
>&
path_points
,
const
Obstacle
&
obstacle
,
std
::
vector
<
STPoint
>*
upper_points
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录