Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
8c7f4623
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,发现更多精彩内容 >>
提交
8c7f4623
编写于
12月 10, 2018
作者:
K
kechxu
提交者:
Jiangtao Hu
12月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: resolve some TODOs in cruise_mlp_evaluator
上级
23070996
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
58 deletion
+22
-58
modules/prediction/common/prediction_gflags.cc
modules/prediction/common/prediction_gflags.cc
+4
-0
modules/prediction/common/prediction_gflags.h
modules/prediction/common/prediction_gflags.h
+2
-0
modules/prediction/container/obstacles/obstacles_container.cc
...les/prediction/container/obstacles/obstacles_container.cc
+0
-5
modules/prediction/evaluator/vehicle/cruise_mlp_evaluator.cc
modules/prediction/evaluator/vehicle/cruise_mlp_evaluator.cc
+14
-51
modules/prediction/evaluator/vehicle/cruise_mlp_evaluator.h
modules/prediction/evaluator/vehicle/cruise_mlp_evaluator.h
+2
-1
modules/prediction/prediction_component.cc
modules/prediction/prediction_component.cc
+0
-1
未找到文件。
modules/prediction/common/prediction_gflags.cc
浏览文件 @
8c7f4623
...
...
@@ -178,6 +178,10 @@ DEFINE_double(defualt_junction_range, 10.0,
// Evaluator
DEFINE_double
(
time_to_center_if_not_reach
,
10.0
,
"Default value of time to lane center of not reach."
);
DEFINE_double
(
default_s_if_no_obstacle_in_lane_sequence
,
1000.0
,
"The default s value if no obstacle in the lane sequence."
);
DEFINE_double
(
default_l_if_no_obstacle_in_lane_sequence
,
10.0
,
"The default l value if no obstacle in the lane sequence."
);
// Obstacle trajectory
DEFINE_bool
(
enable_cruise_regression
,
false
,
...
...
modules/prediction/common/prediction_gflags.h
浏览文件 @
8c7f4623
...
...
@@ -114,6 +114,8 @@ DECLARE_double(defualt_junction_range);
// Evaluator
DECLARE_double
(
time_to_center_if_not_reach
);
DECLARE_double
(
default_s_if_no_obstacle_in_lane_sequence
);
DECLARE_double
(
default_l_if_no_obstacle_in_lane_sequence
);
// Obstacle trajectory
DECLARE_bool
(
enable_cruise_regression
);
...
...
modules/prediction/container/obstacles/obstacles_container.cc
浏览文件 @
8c7f4623
...
...
@@ -143,11 +143,6 @@ void ObstaclesContainer::BuildLaneGraph() {
ADEBUG
<<
"Ignore obstacle ["
<<
obstacle_ptr
->
id
()
<<
"]"
;
continue
;
}
// TODO(all) check
// if (obstacle_ptr->HasJunctionFeatureWithExits() &&
// !obstacle_ptr->IsClosedToJunctionExit()) {
// continue;
// }
obstacle_ptr
->
BuildLaneGraph
();
}
}
...
...
modules/prediction/evaluator/vehicle/cruise_mlp_evaluator.cc
浏览文件 @
8c7f4623
...
...
@@ -143,17 +143,17 @@ void CruiseMLPEvaluator::Evaluate(Obstacle* obstacle_ptr) {
ExtractFeatureValues
(
obstacle_ptr
,
lane_sequence_ptr
,
&
feature_values
);
if
(
feature_values
.
size
()
!=
OBSTACLE_FEATURE_SIZE
+
INTERACTION_FEATURE_SIZE
+
LANE_FEATURE
_SIZE
)
{
SINGLE_LANE_FEATURE_SIZE
*
LANE_POINTS
_SIZE
)
{
lane_sequence_ptr
->
set_probability
(
0.0
);
ADEBUG
<<
"Skip lane sequence due to incorrect feature size"
;
continue
;
}
Eigen
::
MatrixXf
obs_feature_mat
=
VectorToMatrixXf
(
feature_values
,
0
,
OBSTACLE_FEATURE_SIZE
);
// TODO(kechxu) move 5 and 30 to gflags
Eigen
::
MatrixXf
lane_feature_mat
=
VectorToMatrixXf
(
feature_values
,
OBSTACLE_FEATURE_SIZE
+
INTERACTION_FEATURE_SIZE
,
static_cast
<
int
>
(
feature_values
.
size
()),
5
,
30
);
static_cast
<
int
>
(
feature_values
.
size
()),
SINGLE_LANE_FEATURE_SIZE
,
LANE_POINTS_SIZE
);
Eigen
::
MatrixXf
model_output
;
if
(
lane_sequence_ptr
->
vehicle_on_lane
())
{
go_model_ptr_
->
Run
({
lane_feature_mat
,
obs_feature_mat
},
&
model_output
);
...
...
@@ -214,7 +214,8 @@ void CruiseMLPEvaluator::ExtractFeatureValues
// Extract lane related features.
std
::
vector
<
double
>
lane_feature_values
;
SetLaneFeatureValues
(
obstacle_ptr
,
lane_sequence_ptr
,
&
lane_feature_values
);
if
(
lane_feature_values
.
size
()
!=
LANE_FEATURE_SIZE
)
{
if
(
lane_feature_values
.
size
()
!=
SINGLE_LANE_FEATURE_SIZE
*
LANE_POINTS_SIZE
)
{
ADEBUG
<<
"Obstacle ["
<<
id
<<
"] has fewer than "
<<
"expected lane feature_values"
<<
lane_feature_values
.
size
()
<<
"."
;
...
...
@@ -439,10 +440,10 @@ void CruiseMLPEvaluator::SetInteractionFeatureValues(Obstacle* obstacle_ptr,
// Initialize forward and backward obstacles
NearbyObstacle
forward_obstacle
;
NearbyObstacle
backward_obstacle
;
forward_obstacle
.
set_s
(
1000.0
);
// TODO(kechxu) move to gflags
forward_obstacle
.
set_l
(
10.0
);
// TODO(kechxu) move to gflags
backward_obstacle
.
set_s
(
-
1000.0
);
// TODO(kechxu) move to gflags
backward_obstacle
.
set_l
(
10.0
);
// TODO(kechxu) move to gflags
forward_obstacle
.
set_s
(
FLAGS_default_s_if_no_obstacle_in_lane_sequence
);
forward_obstacle
.
set_l
(
FLAGS_default_l_if_no_obstacle_in_lane_sequence
);
backward_obstacle
.
set_s
(
-
FLAGS_default_s_if_no_obstacle_in_lane_sequence
);
backward_obstacle
.
set_l
(
FLAGS_default_l_if_no_obstacle_in_lane_sequence
);
for
(
const
auto
&
nearby_obstacle
:
lane_sequence_ptr
->
nearby_obstacle
())
{
if
(
nearby_obstacle
.
s
()
<
0.0
)
{
...
...
@@ -496,7 +497,7 @@ void CruiseMLPEvaluator::SetLaneFeatureValues
std
::
vector
<
double
>*
feature_values
)
{
// Sanity checks.
feature_values
->
clear
();
feature_values
->
reserve
(
LANE_FEATURE
_SIZE
);
feature_values
->
reserve
(
SINGLE_LANE_FEATURE_SIZE
*
LANE_POINTS
_SIZE
);
const
Feature
&
feature
=
obstacle_ptr
->
latest_feature
();
if
(
!
feature
.
IsInitialized
())
{
ADEBUG
<<
"Obstacle ["
<<
obstacle_ptr
->
id
()
<<
"] has no latest feature."
;
...
...
@@ -509,12 +510,13 @@ void CruiseMLPEvaluator::SetLaneFeatureValues
double
heading
=
feature
.
velocity_heading
();
double
speed
=
feature
.
speed
();
for
(
int
i
=
0
;
i
<
lane_sequence_ptr
->
lane_segment_size
();
++
i
)
{
if
(
feature_values
->
size
()
>=
LANE_FEATURE
_SIZE
)
{
if
(
feature_values
->
size
()
>=
SINGLE_LANE_FEATURE_SIZE
*
LANE_POINTS
_SIZE
)
{
break
;
}
const
LaneSegment
&
lane_segment
=
lane_sequence_ptr
->
lane_segment
(
i
);
for
(
int
j
=
0
;
j
<
lane_segment
.
lane_point_size
();
++
j
)
{
if
(
feature_values
->
size
()
>=
LANE_FEATURE_SIZE
)
{
if
(
feature_values
->
size
()
>=
SINGLE_LANE_FEATURE_SIZE
*
LANE_POINTS_SIZE
)
{
break
;
}
const
LanePoint
&
lane_point
=
lane_segment
.
lane_point
(
j
);
...
...
@@ -535,30 +537,12 @@ void CruiseMLPEvaluator::SetLaneFeatureValues
feature_values
->
push_back
(
relative_ang
);
feature_values
->
push_back
(
speed
*
speed
*
lane_point
.
kappa
());
feature_values
->
push_back
(
lane_point
.
kappa
());
/*
double diff_x = lane_point.position().x() - feature.position().x();
double diff_y = lane_point.position().y() - feature.position().y();
double angle = std::atan2(diff_y, diff_x);
double deviation_angle = angle - heading;
double relative_l = std::sqrt(diff_x * diff_x + diff_y * diff_y)
* std::sin(deviation_angle);
// The lateral deviation of the lane-point from vehicle facing:
feature_values->push_back(relative_l);
// The extrapolated normal acceleration:
feature_values->push_back(speed * speed * lane_point.kappa());
// The lane-point's heading w.r.t. vehicle's facing direction:
feature_values->push_back(common::math::AngleDiff
(heading, lane_point.heading()));
feature_values->push_back(diff_x);
feature_values->push_back(diff_y);
*/
}
}
// If the lane points are not sufficient, apply a linear extrapolation.
std
::
size_t
size
=
feature_values
->
size
();
while
(
size
>=
10
&&
size
<
LANE_FEATURE
_SIZE
)
{
while
(
size
>=
10
&&
size
<
SINGLE_LANE_FEATURE_SIZE
*
LANE_POINTS
_SIZE
)
{
double
relative_l_new
=
2
*
feature_values
->
operator
[](
size
-
5
)
-
feature_values
->
operator
[](
size
-
10
);
double
relative_s_new
=
2
*
feature_values
->
operator
[](
size
-
4
)
-
...
...
@@ -573,30 +557,9 @@ void CruiseMLPEvaluator::SetLaneFeatureValues
feature_values
->
push_back
(
0.0
);
size
=
feature_values
->
size
();
/*
double diff_x_new = 2 * feature_values->operator[](size - 2) -
feature_values->operator[](size - 7);
double diff_y_new = 2 * feature_values->operator[](size - 1) -
feature_values->operator[](size - 6);
double angle_new = std::atan2(diff_y_new, diff_x_new);
double deviation_angle_new = angle_new - heading;
double relative_l_new = std::sqrt(diff_x_new * diff_x_new +
diff_y_new * diff_y_new)
* std::sin(deviation_angle_new);
double centri_acc_new = 0.0;
double angle_diff_new = feature_values->operator[](size - 3);
feature_values->push_back(relative_l_new);
feature_values->push_back(centri_acc_new);
feature_values->push_back(angle_diff_new);
feature_values->push_back(diff_x_new);
feature_values->push_back(diff_y_new);
size = feature_values->size();
*/
}
}
// TODO(all): uncomment this once the model is trained and ready.
void
CruiseMLPEvaluator
::
LoadModels
(
const
std
::
string
&
go_model_file
,
const
std
::
string
&
cutin_model_file
)
{
go_model_ptr_
.
reset
(
new
network
::
CruiseModel
());
...
...
modules/prediction/evaluator/vehicle/cruise_mlp_evaluator.h
浏览文件 @
8c7f4623
...
...
@@ -112,7 +112,8 @@ class CruiseMLPEvaluator : public Evaluator {
private:
static
const
size_t
OBSTACLE_FEATURE_SIZE
=
23
+
24
;
static
const
size_t
INTERACTION_FEATURE_SIZE
=
8
;
static
const
size_t
LANE_FEATURE_SIZE
=
150
;
static
const
size_t
SINGLE_LANE_FEATURE_SIZE
=
5
;
static
const
size_t
LANE_POINTS_SIZE
=
30
;
std
::
shared_ptr
<
network
::
CruiseModel
>
go_model_ptr_
;
std
::
shared_ptr
<
network
::
CruiseModel
>
cutin_model_ptr_
;
...
...
modules/prediction/prediction_component.cc
浏览文件 @
8c7f4623
...
...
@@ -220,7 +220,6 @@ void PredictionComponent::OnPerception(
diff
=
end_time4
-
end_time3
;
ADEBUG
<<
"Time to build junction features: "
<<
diff
.
count
()
*
1000
<<
" msec."
;
// TODO(kechxu) refactor logic of build lane graph and build junction feature
ptr_obstacles_container
->
BuildLaneGraph
();
auto
end_time5
=
std
::
chrono
::
system_clock
::
now
();
diff
=
end_time5
-
end_time4
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录