Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
f5c253ab
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,发现更多精彩内容 >>
提交
f5c253ab
编写于
7月 25, 2017
作者:
J
Jinghao Miao
提交者:
lianglia-apollo
7月 25, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added lane sequence filters
上级
f880fe8a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
131 addition
and
10 deletion
+131
-10
modules/prediction/predictor/vehicle/free_move_predictor.cc
modules/prediction/predictor/vehicle/free_move_predictor.cc
+3
-0
modules/prediction/predictor/vehicle/lane_sequence_predictor.cc
...s/prediction/predictor/vehicle/lane_sequence_predictor.cc
+91
-10
modules/prediction/predictor/vehicle/lane_sequence_predictor.h
...es/prediction/predictor/vehicle/lane_sequence_predictor.h
+37
-0
未找到文件。
modules/prediction/predictor/vehicle/free_move_predictor.cc
浏览文件 @
f5c253ab
...
...
@@ -70,6 +70,9 @@ void FreeMovePredictor::Predict(Obstacle* obstacle) {
prediction_obstacle_
.
set_predicted_period
(
FLAGS_prediction_duration
);
prediction_obstacle_
.
add_trajectory
()
->
CopyFrom
(
trajectory
);
SetEqualProbability
(
1.0
,
start_index
);
ADEBUG
<<
"Obstacle ["
<<
obstacle
->
id
()
<<
"] has "
<<
prediction_obstacle_
.
trajectory_size
()
<<
" trajectories."
;
}
void
FreeMovePredictor
::
DrawFreeMoveTrajectoryPoints
(
...
...
modules/prediction/predictor/vehicle/lane_sequence_predictor.cc
浏览文件 @
f5c253ab
...
...
@@ -42,18 +42,27 @@ void LaneSequencePredictor::Predict(Obstacle* obstacle) {
return
;
}
for
(
const
auto
&
sequence
:
feature
.
lane
().
lane_graph
().
lane_sequence
())
{
std
::
string
lane_id
=
""
;
if
(
feature
.
lane
().
has_lane_feature
())
{
lane_id
=
feature
.
lane
().
lane_feature
().
lane_id
();
}
int
num_lane_sequence
=
feature
.
lane
().
lane_graph
().
lane_sequence_size
();
std
::
vector
<
bool
>
enable_lane_sequence
(
num_lane_sequence
,
true
);
FilterLaneSequences
(
feature
.
lane
().
lane_graph
(),
lane_id
,
&
enable_lane_sequence
);
for
(
int
i
=
0
;
i
<
num_lane_sequence
;
++
i
)
{
const
LaneSequence
&
sequence
=
feature
.
lane
().
lane_graph
().
lane_sequence
(
i
);
if
(
sequence
.
lane_segment_size
()
==
0
)
{
AERROR
<<
"Empty lane segments."
;
continue
;
}
if
(
!
sequence
.
has_probability
()
||
sequence
.
probability
()
<
FLAGS_lane_sequence_threshold
)
{
AERROR
<<
"Lane sequence ["
<<
ToString
(
sequence
)
<<
"] has probability ["
<<
sequence
.
probability
()
<<
"] less than threshold ["
<<
FLAGS_lane_sequence_threshold
<<
"]"
;
if
(
!
enable_lane_sequence
[
i
])
{
ADEBUG
<<
"Lane sequence ["
<<
ToString
(
sequence
)
<<
"] with probability ["
<<
sequence
.
probability
()
<<
"] is disqualified."
;
continue
;
}
...
...
@@ -68,7 +77,76 @@ void LaneSequencePredictor::Predict(Obstacle* obstacle) {
trajectory
.
set_probability
(
sequence
.
probability
());
prediction_obstacle_
.
set_predicted_period
(
FLAGS_prediction_duration
);
prediction_obstacle_
.
add_trajectory
()
->
CopyFrom
(
trajectory
);
ADEBUG
<<
"Obstacle ["
<<
obstacle
->
id
()
<<
"] has "
<<
prediction_obstacle_
.
trajectory_size
()
<<
" trajectories."
;
}
}
void
LaneSequencePredictor
::
FilterLaneSequences
(
const
LaneGraph
&
lane_graph
,
const
std
::
string
&
lane_id
,
std
::
vector
<
bool
>
*
enable_lane_sequence
)
{
int
num_lane_sequence
=
lane_graph
.
lane_sequence_size
();
std
::
vector
<
int
>
lane_change_type
(
num_lane_sequence
,
-
1
);
std
::
pair
<
int
,
double
>
change
(
-
1
,
-
1.0
);
std
::
pair
<
int
,
double
>
all
(
-
1
,
-
1.0
);
for
(
int
i
=
0
;
i
<
num_lane_sequence
;
++
i
)
{
const
LaneSequence
&
sequence
=
lane_graph
.
lane_sequence
(
i
);
// Get lane change type
int
lane_change
=
GetLaneChangeType
(
lane_id
,
sequence
);
lane_change_type
[
i
]
=
lane_change
;
double
probability
=
sequence
.
probability
();
if
(
::
apollo
::
common
::
math
::
DoubleCompare
(
probability
,
all
.
second
)
>
0
||
(
::
apollo
::
common
::
math
::
DoubleCompare
(
probability
,
all
.
second
)
==
0
&&
lane_change_type
[
i
]
==
0
))
{
all
.
first
=
i
;
all
.
second
=
probability
;
}
if
(
lane_change_type
[
i
]
>
0
&&
::
apollo
::
common
::
math
::
DoubleCompare
(
probability
,
change
.
second
)
>
0
)
{
change
.
first
=
i
;
change
.
second
=
probability
;
}
}
for
(
int
i
=
0
;
i
<
num_lane_sequence
;
++
i
)
{
const
LaneSequence
&
sequence
=
lane_graph
.
lane_sequence
(
i
);
double
probability
=
sequence
.
probability
();
if
(
::
apollo
::
common
::
math
::
DoubleCompare
(
probability
,
FLAGS_lane_sequence_threshold
)
<
0
&&
i
!=
all
.
first
)
{
(
*
enable_lane_sequence
)[
i
]
=
false
;
}
else
if
(
lane_change_type
[
i
]
>
0
&&
lane_change_type
[
i
]
!=
change
.
first
)
{
(
*
enable_lane_sequence
)[
i
]
=
false
;
}
}
}
int
LaneSequencePredictor
::
GetLaneChangeType
(
const
std
::
string
&
lane_id
,
const
LaneSequence
&
lane_sequence
)
{
PredictionMap
*
map
=
PredictionMap
::
instance
();
CHECK_NOTNULL
(
map
);
std
::
string
lane_change_id
=
lane_sequence
.
lane_segment
(
0
).
lane_id
();
if
(
lane_id
==
lane_change_id
)
{
return
0
;
}
else
{
if
(
map
->
IsLeftNeighborLane
(
map
->
LaneById
(
lane_change_id
),
map
->
LaneById
(
lane_id
)))
{
return
1
;
}
else
if
(
map
->
IsRightNeighborLane
(
map
->
LaneById
(
lane_change_id
),
map
->
LaneById
(
lane_id
)))
{
return
2
;
}
}
return
-
1
;
}
void
LaneSequencePredictor
::
DrawLaneSequenceTrajectoryPoints
(
...
...
@@ -168,9 +246,12 @@ void LaneSequencePredictor::DrawLaneSequenceTrajectoryPoints(
}
std
::
string
LaneSequencePredictor
::
ToString
(
const
LaneSequence
&
sequence
)
{
std
::
string
str_lane_sequence
;
for
(
const
auto
&
lane_segment
:
sequence
.
lane_segment
())
{
str_lane_sequence
=
str_lane_sequence
+
"->"
+
lane_segment
.
lane_id
();
std
::
string
str_lane_sequence
=
""
;
if
(
sequence
.
lane_segment_size
()
>
0
)
{
str_lane_sequence
+=
sequence
.
lane_segment
(
0
).
lane_id
();
}
for
(
int
i
=
1
;
i
<
sequence
.
lane_segment_size
();
++
i
)
{
str_lane_sequence
+=
(
"->"
+
sequence
.
lane_segment
(
i
).
lane_id
());
}
return
str_lane_sequence
;
}
...
...
modules/prediction/predictor/vehicle/lane_sequence_predictor.h
浏览文件 @
f5c253ab
...
...
@@ -25,6 +25,7 @@
#include "modules/prediction/predictor/predictor.h"
#include <string>
#include <vector>
#include "modules/prediction/proto/lane_graph.pb.h"
#include "modules/common/proto/path_point.pb.h"
...
...
@@ -51,6 +52,37 @@ class LaneSequencePredictor : public Predictor {
void
Predict
(
Obstacle
*
obstacle
)
override
;
protected:
/**
* @brief Filter lane sequences
* @param Lane graph
* @param Current lane id
* @param Vector of boolean indicating if a lane sequence is disqualified
*/
void
FilterLaneSequences
(
const
LaneGraph
&
lane_graph
,
const
std
::
string
&
lane_id
,
std
::
vector
<
bool
>
*
enable_lane_sequence
);
/**
* @brief Get lane change type
* @param Current lane id
* @param Lane sequence
* @return Integer indicating lane change type:
* 0: no lane change
* 1: left lane change
* 2: right lane change
* -1: other
*/
int
GetLaneChangeType
(
const
std
::
string
&
lane_id
,
const
LaneSequence
&
lane_sequence
);
/**
* @brief Draw lane sequence trajectory points
* @param Kalman filter
* @param Lane sequence
* @param Total prediction time
* @param Prediction frequency
* @param A vector of generated trajectory points
*/
void
DrawLaneSequenceTrajectoryPoints
(
const
::
apollo
::
common
::
math
::
KalmanFilter
<
double
,
4
,
2
,
0
>&
kf
,
const
LaneSequence
&
sequence
,
...
...
@@ -58,6 +90,11 @@ class LaneSequencePredictor : public Predictor {
double
freq
,
std
::
vector
<::
apollo
::
common
::
TrajectoryPoint
>
*
points
);
/**
* @brief Convert a lane sequence to string
* @param Lane sequence
* @return String describing the lane sequence
*/
std
::
string
ToString
(
const
LaneSequence
&
sequence
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录