Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
f77bdb98
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,发现更多精彩内容 >>
提交
f77bdb98
编写于
12月 23, 2017
作者:
D
Dong Li
提交者:
Jiangtao Hu
12月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: refactor coding style
上级
b24a9367
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
34 deletion
+31
-34
modules/planning/common/obstacle.cc
modules/planning/common/obstacle.cc
+9
-4
modules/planning/reference_line/reference_line.h
modules/planning/reference_line/reference_line.h
+8
-0
modules/planning/tasks/dp_st_speed/dp_st_graph.cc
modules/planning/tasks/dp_st_speed/dp_st_graph.cc
+2
-2
modules/planning/tasks/dp_st_speed/dp_st_graph.h
modules/planning/tasks/dp_st_speed/dp_st_graph.h
+1
-1
modules/planning/tasks/st_graph/st_boundary_mapper.cc
modules/planning/tasks/st_graph/st_boundary_mapper.cc
+9
-25
modules/planning/tasks/st_graph/st_boundary_mapper.h
modules/planning/tasks/st_graph/st_boundary_mapper.h
+2
-2
未找到文件。
modules/planning/common/obstacle.cc
浏览文件 @
f77bdb98
...
@@ -67,18 +67,23 @@ Obstacle::Obstacle(const std::string& id,
...
@@ -67,18 +67,23 @@ Obstacle::Obstacle(const std::string& id,
const
PerceptionObstacle
&
perception_obstacle
,
const
PerceptionObstacle
&
perception_obstacle
,
const
prediction
::
Trajectory
&
trajectory
)
const
prediction
::
Trajectory
&
trajectory
)
:
Obstacle
(
id
,
perception_obstacle
)
{
:
Obstacle
(
id
,
perception_obstacle
)
{
has_trajectory_
=
true
;
trajectory_
=
trajectory
;
trajectory_
=
trajectory
;
auto
&
trajectory_points
=
*
trajectory_
.
mutable_trajectory_point
();
auto
&
trajectory_points
=
*
trajectory_
.
mutable_trajectory_point
();
double
cumulative_s
=
0.0
;
double
cumulative_s
=
0.0
;
if
(
trajectory_points
.
size
()
>
0
)
{
if
(
trajectory_points
.
size
()
>
0
)
{
trajectory_points
[
0
].
mutable_path_point
()
->
set_s
(
0.0
);
trajectory_points
[
0
].
mutable_path_point
()
->
set_s
(
0.0
);
has_trajectory_
=
true
;
}
}
for
(
int
i
=
1
;
i
<
trajectory_points
.
size
();
++
i
)
{
for
(
int
i
=
1
;
i
<
trajectory_points
.
size
();
++
i
)
{
const
auto
&
prev
=
trajectory_points
[
i
-
1
];
const
auto
&
cur
=
trajectory_points
[
i
];
if
(
prev
.
relative_time
()
>=
cur
.
relative_time
())
{
AERROR
<<
"prediction time is not increasing."
<<
"current point: "
<<
cur
.
ShortDebugString
()
<<
"previous point: "
<<
prev
.
ShortDebugString
();
}
cumulative_s
+=
cumulative_s
+=
common
::
util
::
DistanceXY
(
trajectory_points
[
i
-
1
].
path_point
(),
common
::
util
::
DistanceXY
(
prev
.
path_point
(),
cur
.
path_point
());
trajectory_points
[
i
].
path_point
());
trajectory_points
[
i
].
mutable_path_point
()
->
set_s
(
cumulative_s
);
trajectory_points
[
i
].
mutable_path_point
()
->
set_s
(
cumulative_s
);
}
}
}
}
...
...
modules/planning/reference_line/reference_line.h
浏览文件 @
f77bdb98
...
@@ -91,11 +91,19 @@ class ReferenceLine {
...
@@ -91,11 +91,19 @@ class ReferenceLine {
common
::
math
::
Vec2d
*
const
xy_point
)
const
;
common
::
math
::
Vec2d
*
const
xy_point
)
const
;
bool
XYToSL
(
const
common
::
math
::
Vec2d
&
xy_point
,
bool
XYToSL
(
const
common
::
math
::
Vec2d
&
xy_point
,
common
::
SLPoint
*
const
sl_point
)
const
;
common
::
SLPoint
*
const
sl_point
)
const
;
template
<
class
XYPoint
>
bool
XYToSL
(
const
XYPoint
&
xy
,
common
::
SLPoint
*
const
sl_point
)
const
{
return
XYToSL
(
common
::
math
::
Vec2d
(
xy
.
x
(),
xy
.
y
()),
sl_point
);
}
bool
GetLaneWidth
(
const
double
s
,
double
*
const
left_width
,
bool
GetLaneWidth
(
const
double
s
,
double
*
const
left_width
,
double
*
const
right_width
)
const
;
double
*
const
right_width
)
const
;
bool
IsOnRoad
(
const
common
::
SLPoint
&
sl_point
)
const
;
bool
IsOnRoad
(
const
common
::
SLPoint
&
sl_point
)
const
;
bool
IsOnRoad
(
const
common
::
math
::
Vec2d
&
vec2d_point
)
const
;
bool
IsOnRoad
(
const
common
::
math
::
Vec2d
&
vec2d_point
)
const
;
template
<
class
XYPoint
>
bool
IsOnRoad
(
const
XYPoint
&
xy
)
const
{
return
IsOnRoad
(
common
::
math
::
Vec2d
(
xy
.
x
(),
xy
.
y
()));
}
bool
IsOnRoad
(
const
SLBoundary
&
sl_boundary
)
const
;
bool
IsOnRoad
(
const
SLBoundary
&
sl_boundary
)
const
;
/**
/**
...
...
modules/planning/tasks/dp_st_speed/dp_st_graph.cc
浏览文件 @
f77bdb98
...
@@ -63,19 +63,19 @@ DpStGraph::DpStGraph(const ReferenceLine& reference_line,
...
@@ -63,19 +63,19 @@ DpStGraph::DpStGraph(const ReferenceLine& reference_line,
:
reference_line_
(
reference_line
),
:
reference_line_
(
reference_line
),
dp_st_speed_config_
(
dp_config
),
dp_st_speed_config_
(
dp_config
),
st_graph_data_
(
st_graph_data
),
st_graph_data_
(
st_graph_data
),
vehicle_param_
(
VehicleConfigHelper
::
GetConfig
().
vehicle_param
()),
adc_sl_boundary_
(
adc_sl_boundary
),
adc_sl_boundary_
(
adc_sl_boundary
),
dp_st_cost_
(
dp_config
),
dp_st_cost_
(
dp_config
),
init_point_
(
st_graph_data
.
init_point
())
{
init_point_
(
st_graph_data
.
init_point
())
{
dp_st_speed_config_
.
set_total_path_length
(
dp_st_speed_config_
.
set_total_path_length
(
std
::
fmin
(
dp_st_speed_config_
.
total_path_length
(),
std
::
fmin
(
dp_st_speed_config_
.
total_path_length
(),
st_graph_data_
.
path_data_length
()));
st_graph_data_
.
path_data_length
()));
vehicle_param_
=
VehicleConfigHelper
::
GetConfig
().
vehicle_param
();
}
}
Status
DpStGraph
::
Search
(
PathDecision
*
const
path_decision
,
Status
DpStGraph
::
Search
(
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
)
{
SpeedData
*
const
speed_data
)
{
constexpr
double
kBounadryEpsilon
=
1e-2
;
constexpr
double
kBounadryEpsilon
=
1e-2
;
for
(
auto
boundary
:
st_graph_data_
.
st_boundaries
())
{
for
(
const
auto
&
boundary
:
st_graph_data_
.
st_boundaries
())
{
if
(
boundary
->
IsPointInBoundary
({
0.0
,
0.0
})
||
if
(
boundary
->
IsPointInBoundary
({
0.0
,
0.0
})
||
(
std
::
fabs
(
boundary
->
min_t
())
<
kBounadryEpsilon
&&
(
std
::
fabs
(
boundary
->
min_t
())
<
kBounadryEpsilon
&&
std
::
fabs
(
boundary
->
min_s
())
<
kBounadryEpsilon
))
{
std
::
fabs
(
boundary
->
min_s
())
<
kBounadryEpsilon
))
{
...
...
modules/planning/tasks/dp_st_speed/dp_st_graph.h
浏览文件 @
f77bdb98
...
@@ -83,7 +83,7 @@ class DpStGraph {
...
@@ -83,7 +83,7 @@ class DpStGraph {
const
StGraphData
&
st_graph_data_
;
const
StGraphData
&
st_graph_data_
;
// vehicle configuration parameter
// vehicle configuration parameter
co
mmon
::
VehicleParam
vehicle_param_
;
co
nst
common
::
VehicleParam
&
vehicle_param_
;
const
SLBoundary
&
adc_sl_boundary_
;
const
SLBoundary
&
adc_sl_boundary_
;
...
...
modules/planning/tasks/st_graph/st_boundary_mapper.cc
浏览文件 @
f77bdb98
...
@@ -49,6 +49,7 @@ using apollo::common::TrajectoryPoint;
...
@@ -49,6 +49,7 @@ using apollo::common::TrajectoryPoint;
using
apollo
::
common
::
VehicleParam
;
using
apollo
::
common
::
VehicleParam
;
using
apollo
::
common
::
math
::
Box2d
;
using
apollo
::
common
::
math
::
Box2d
;
using
apollo
::
common
::
math
::
Vec2d
;
using
apollo
::
common
::
math
::
Vec2d
;
using
apollo
::
common
::
util
::
StrCat
;
namespace
{
namespace
{
constexpr
double
boundary_t_buffer
=
0.1
;
constexpr
double
boundary_t_buffer
=
0.1
;
...
@@ -65,8 +66,7 @@ StBoundaryMapper::StBoundaryMapper(const SLBoundary& adc_sl_boundary,
...
@@ -65,8 +66,7 @@ StBoundaryMapper::StBoundaryMapper(const SLBoundary& adc_sl_boundary,
st_boundary_config_
(
config
),
st_boundary_config_
(
config
),
reference_line_
(
reference_line
),
reference_line_
(
reference_line
),
path_data_
(
path_data
),
path_data_
(
path_data
),
vehicle_param_
(
vehicle_param_
(
common
::
VehicleConfigHelper
::
GetConfig
().
vehicle_param
()),
common
::
VehicleConfigHelper
::
instance
()
->
GetConfig
().
vehicle_param
()),
planning_distance_
(
planning_distance
),
planning_distance_
(
planning_distance
),
planning_time_
(
planning_time
)
{}
planning_time_
(
planning_time
)
{}
...
@@ -95,10 +95,9 @@ Status StBoundaryMapper::GetGraphBoundary(PathDecision* path_decision) const {
...
@@ -95,10 +95,9 @@ Status StBoundaryMapper::GetGraphBoundary(PathDecision* path_decision) const {
StBoundary
boundary
;
StBoundary
boundary
;
boundary
.
SetId
(
path_obstacle
->
Id
());
boundary
.
SetId
(
path_obstacle
->
Id
());
if
(
!
path_obstacle
->
HasLongitudinalDecision
())
{
if
(
!
path_obstacle
->
HasLongitudinalDecision
())
{
const
auto
ret
=
MapWithoutDecision
(
path_obstacle
);
if
(
!
MapWithoutDecision
(
path_obstacle
).
ok
())
{
if
(
!
ret
.
ok
())
{
std
::
string
msg
=
StrCat
(
"Fail to map obstacle "
,
path_obstacle
->
Id
(),
std
::
string
msg
=
common
::
util
::
StrCat
(
" without decision."
);
"Fail to map obstacle "
,
path_obstacle
->
Id
(),
" without decision."
);
AERROR
<<
msg
;
AERROR
<<
msg
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
}
}
...
@@ -118,26 +117,21 @@ Status StBoundaryMapper::GetGraphBoundary(PathDecision* path_decision) const {
...
@@ -118,26 +117,21 @@ Status StBoundaryMapper::GetGraphBoundary(PathDecision* path_decision) const {
<<
adc_sl_boundary_
.
end_s
();
<<
adc_sl_boundary_
.
end_s
();
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"invalid decision"
);
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"invalid decision"
);
}
}
if
(
!
stop_obstacle
)
{
if
(
stop_s
<
min_stop_s
)
{
stop_obstacle
=
path_obstacle
;
stop_decision
=
decision
;
min_stop_s
=
stop_s
;
}
else
if
(
stop_s
<
min_stop_s
)
{
stop_obstacle
=
path_obstacle
;
stop_obstacle
=
path_obstacle
;
min_stop_s
=
stop_s
;
min_stop_s
=
stop_s
;
stop_decision
=
decision
;
stop_decision
=
decision
;
}
}
}
else
if
(
decision
.
has_follow
()
||
decision
.
has_overtake
()
||
}
else
if
(
decision
.
has_follow
()
||
decision
.
has_overtake
()
||
decision
.
has_yield
())
{
decision
.
has_yield
())
{
const
auto
ret
=
MapWithPredictionTrajectory
(
path_obstacle
);
if
(
!
MapWithPredictionTrajectory
(
path_obstacle
).
ok
())
{
if
(
!
ret
.
ok
())
{
AERROR
<<
"Fail to map obstacle "
<<
path_obstacle
->
Id
()
AERROR
<<
"Fail to map obstacle "
<<
path_obstacle
->
Id
()
<<
" with decision: "
<<
decision
.
DebugString
();
<<
" with decision: "
<<
decision
.
DebugString
();
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"Fail to map overtake/yield decision"
);
"Fail to map overtake/yield decision"
);
}
}
}
else
{
}
else
{
A
DEBUG
<<
"No mapping for decision: "
<<
decision
.
DebugString
();
A
WARN
<<
"No mapping for decision: "
<<
decision
.
DebugString
();
}
}
}
}
...
@@ -276,20 +270,10 @@ bool StBoundaryMapper::GetOverlapBoundaryPoints(
...
@@ -276,20 +270,10 @@ bool StBoundaryMapper::GetOverlapBoundaryPoints(
}
}
for
(
int
i
=
0
;
i
<
trajectory
.
trajectory_point_size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
trajectory
.
trajectory_point_size
();
++
i
)
{
const
auto
&
trajectory_point
=
trajectory
.
trajectory_point
(
i
);
const
auto
&
trajectory_point
=
trajectory
.
trajectory_point
(
i
);
if
(
i
>
0
)
{
const
auto
&
pre_point
=
trajectory
.
trajectory_point
(
i
-
1
);
if
(
trajectory_point
.
relative_time
()
<=
pre_point
.
relative_time
())
{
AERROR
<<
"Fail to map because prediction time is not increasing."
<<
"current point: "
<<
trajectory_point
.
ShortDebugString
()
<<
"previous point: "
<<
pre_point
.
ShortDebugString
();
return
false
;
}
}
const
Box2d
obs_box
=
obstacle
.
GetBoundingBox
(
trajectory_point
);
const
Box2d
obs_box
=
obstacle
.
GetBoundingBox
(
trajectory_point
);
double
trajectory_point_time
=
trajectory_point
.
relative_time
();
double
trajectory_point_time
=
trajectory_point
.
relative_time
();
const
double
kNegtiveTimeThreshold
=
-
1.0
;
const
expr
double
kNegtiveTimeThreshold
=
-
1.0
;
if
(
trajectory_point_time
<
kNegtiveTimeThreshold
)
{
if
(
trajectory_point_time
<
kNegtiveTimeThreshold
)
{
continue
;
continue
;
}
}
...
...
modules/planning/tasks/st_graph/st_boundary_mapper.h
浏览文件 @
f77bdb98
...
@@ -84,10 +84,10 @@ class StBoundaryMapper {
...
@@ -84,10 +84,10 @@ class StBoundaryMapper {
private:
private:
const
SLBoundary
&
adc_sl_boundary_
;
const
SLBoundary
&
adc_sl_boundary_
;
StBoundaryConfig
st_boundary_config_
;
const
StBoundaryConfig
&
st_boundary_config_
;
const
ReferenceLine
&
reference_line_
;
const
ReferenceLine
&
reference_line_
;
const
PathData
&
path_data_
;
const
PathData
&
path_data_
;
const
apollo
::
common
::
VehicleParam
vehicle_param_
;
const
apollo
::
common
::
VehicleParam
&
vehicle_param_
;
const
double
planning_distance_
;
const
double
planning_distance_
;
const
double
planning_time_
;
const
double
planning_time_
;
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录