Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
4d156dd4
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,发现更多精彩内容 >>
提交
4d156dd4
编写于
3月 26, 2019
作者:
K
kechxu
提交者:
Kecheng Xu
3月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: implement simplified lane sequence
上级
6db2afb7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
88 addition
and
15 deletion
+88
-15
modules/prediction/common/prediction_gflags.cc
modules/prediction/common/prediction_gflags.cc
+2
-0
modules/prediction/common/prediction_gflags.h
modules/prediction/common/prediction_gflags.h
+1
-0
modules/prediction/common/prediction_map.cc
modules/prediction/common/prediction_map.cc
+4
-0
modules/prediction/common/road_graph.cc
modules/prediction/common/road_graph.cc
+60
-13
modules/prediction/common/road_graph.h
modules/prediction/common/road_graph.h
+20
-0
modules/prediction/container/obstacles/obstacle.cc
modules/prediction/container/obstacles/obstacle.cc
+1
-2
未找到文件。
modules/prediction/common/prediction_gflags.cc
浏览文件 @
4d156dd4
...
...
@@ -162,6 +162,8 @@ DEFINE_double(distance_threshold_to_junction_exit, 1.0,
"Threshold of distance to junction exit"
);
DEFINE_double
(
angle_threshold_to_junction_exit
,
M_PI
*
0.25
,
"Threshold of angle to junction exit"
);
DEFINE_uint32
(
sample_size_for_average_lane_curvature
,
10
,
"The sample size to compute average lane curvature"
);
// Validation checker
DEFINE_double
(
centripetal_acc_coeff
,
0.5
,
...
...
modules/prediction/common/prediction_gflags.h
浏览文件 @
4d156dd4
...
...
@@ -102,6 +102,7 @@ DECLARE_double(heading_filter_param);
DECLARE_uint64
(
max_num_lane_point
);
DECLARE_double
(
distance_threshold_to_junction_exit
);
DECLARE_double
(
angle_threshold_to_junction_exit
);
DECLARE_uint32
(
sample_size_for_average_lane_curvature
);
// Validation checker
DECLARE_double
(
centripetal_acc_coeff
);
...
...
modules/prediction/common/prediction_map.cc
浏览文件 @
4d156dd4
...
...
@@ -51,6 +51,10 @@ double PredictionMap::HeadingOnLane(
double
PredictionMap
::
CurvatureOnLane
(
const
std
::
string
&
lane_id
,
const
double
s
)
{
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>
lane_info
=
LaneById
(
lane_id
);
if
(
lane_info
==
nullptr
)
{
AERROR
<<
"Null lane_info ptr found"
;
return
0.0
;
}
return
lane_info
->
Curvature
(
s
);
}
...
...
modules/prediction/common/road_graph.cc
浏览文件 @
4d156dd4
...
...
@@ -178,30 +178,77 @@ void RoadGraph::ComputeLaneSequence(
// Sort the successor lane_segments from left to right.
std
::
vector
<
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>>
successor_lanes
;
for
(
const
auto
&
successor_lane_id
:
lane_info_ptr
->
lane
().
successor_id
())
{
successor_lanes
.
push
_back
(
successor_lanes
.
emplace
_back
(
PredictionMap
::
LaneById
(
successor_lane_id
.
id
()));
}
std
::
sort
(
successor_lanes
.
begin
(),
successor_lanes
.
end
(),
IsAtLeft
);
if
(
consider_divide
)
{
if
(
successor_lanes
.
size
()
>
1
)
{
// Run recursion function to perform DFS.
for
(
size_t
i
=
0
;
i
<
successor_lanes
.
size
();
i
++
)
{
ComputeLaneSequence
(
successor_accumulated_s
,
0.0
,
successor_lanes
[
i
],
graph_search_horizon
-
1
,
false
,
lane_segments
,
lane_graph_ptr
);
if
(
!
successor_lanes
.
empty
())
{
if
(
consider_divide
)
{
if
(
successor_lanes
.
size
()
>
1
)
{
// Run recursion function to perform DFS.
for
(
size_t
i
=
0
;
i
<
successor_lanes
.
size
();
i
++
)
{
ComputeLaneSequence
(
successor_accumulated_s
,
0.0
,
successor_lanes
[
i
],
graph_search_horizon
-
1
,
false
,
lane_segments
,
lane_graph_ptr
);
}
}
else
{
ComputeLaneSequence
(
successor_accumulated_s
,
0.0
,
successor_lanes
[
0
],
graph_search_horizon
-
1
,
true
,
lane_segments
,
lane_graph_ptr
);
}
}
else
{
ComputeLaneSequence
(
successor_accumulated_s
,
0.0
,
successor_lanes
[
0
],
graph_search_horizon
-
1
,
true
,
lane_segments
,
lane_graph_ptr
);
auto
selected_successor_lane
=
LaneWithSmallestAverageCurvature
(
successor_lanes
);
ComputeLaneSequence
(
successor_accumulated_s
,
0.0
,
selected_successor_lane
,
graph_search_horizon
-
1
,
false
,
lane_segments
,
lane_graph_ptr
);
}
}
else
{
// TODO(kechxu) select a successor lane
}
}
lane_segments
->
pop_back
();
}
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>
RoadGraph
::
LaneWithSmallestAverageCurvature
(
const
std
::
vector
<
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>>&
lane_infos
)
const
{
CHECK
(
!
lane_infos
.
empty
());
size_t
sample_size
=
FLAGS_sample_size_for_average_lane_curvature
;
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>
selected_lane_info
=
lane_infos
[
0
];
double
smallest_curvature
=
AverageCurvature
(
selected_lane_info
->
id
().
id
(),
sample_size
);
for
(
size_t
i
=
1
;
i
<
lane_infos
.
size
();
++
i
)
{
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>
lane_info
=
lane_infos
[
i
];
double
curvature
=
AverageCurvature
(
lane_info
->
id
().
id
(),
sample_size
);
if
(
curvature
<
smallest_curvature
)
{
smallest_curvature
=
curvature
;
selected_lane_info
=
lane_info
;
}
}
return
selected_lane_info
;
}
double
RoadGraph
::
AverageCurvature
(
const
std
::
string
&
lane_id
,
const
size_t
sample_size
)
const
{
CHECK_GT
(
sample_size
,
0
);
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>
lane_info_ptr
=
PredictionMap
::
LaneById
(
lane_id
);
if
(
lane_info_ptr
==
nullptr
)
{
return
0.0
;
}
double
lane_length
=
lane_info_ptr
->
total_length
();
double
s_gap
=
lane_length
/
static_cast
<
double
>
(
sample_size
);
double
curvature_sum
=
0.0
;
for
(
size_t
i
=
0
;
i
<
sample_size
;
++
i
)
{
double
s
=
s_gap
*
static_cast
<
double
>
(
i
);
curvature_sum
+=
PredictionMap
::
CurvatureOnLane
(
lane_id
,
s
);
}
return
curvature_sum
/
static_cast
<
double
>
(
sample_size
);
}
}
// namespace prediction
}
// namespace apollo
modules/prediction/common/road_graph.h
浏览文件 @
4d156dd4
...
...
@@ -17,6 +17,7 @@
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "modules/prediction/proto/lane_graph.pb.h"
...
...
@@ -78,6 +79,25 @@ class RoadGraph {
std
::
vector
<
LaneSegment
>*
const
lane_segments
,
LaneGraph
*
const
lane_graph_ptr
)
const
;
/**
* @brief Get the pointer to the lane with the smallest average curvature
* @param The vector of lane infos
* @return The pointer to the lane with the smallest average curvature
*/
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>
LaneWithSmallestAverageCurvature
(
const
std
::
vector
<
std
::
shared_ptr
<
const
hdmap
::
LaneInfo
>>&
lane_infos
)
const
;
/**
* @brief Get the average curvature along a lane with the ID lane_id
* @param The ID of the lane
* @param The size of samples alone the lane to compute the average curvature
* @return The average curvature
*/
double
AverageCurvature
(
const
std
::
string
&
lane_id
,
const
size_t
sample_size
)
const
;
private:
// The s of the obstacle on its own lane_segment.
double
start_s_
=
0
;
...
...
modules/prediction/container/obstacles/obstacle.cc
浏览文件 @
4d156dd4
...
...
@@ -988,8 +988,7 @@ void Obstacle::BuildLaneGraph() {
}
double
speed
=
feature
->
speed
();
double
t_max
=
FLAGS_prediction_trajectory_time_length
;
double
a_max
=
FLAGS_vehicle_max_linear_acc
;
auto
estimated_move_distance
=
speed
*
t_max
+
0.5
*
a_max
*
t_max
*
t_max
;
auto
estimated_move_distance
=
speed
*
t_max
;
double
road_graph_search_distance
=
std
::
fmax
(
estimated_move_distance
,
FLAGS_min_prediction_trajectory_spatial_length
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录