Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
e79ee61a
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,发现更多精彩内容 >>
提交
e79ee61a
编写于
3月 01, 2018
作者:
K
kechxu
提交者:
Jiangtao Hu
3月 02, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: implement cost evaluator
上级
340c976d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
180 addition
and
0 deletion
+180
-0
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
+3
-0
modules/prediction/evaluator/vehicle/BUILD
modules/prediction/evaluator/vehicle/BUILD
+21
-0
modules/prediction/evaluator/vehicle/cost_evaluator.cc
modules/prediction/evaluator/vehicle/cost_evaluator.cc
+95
-0
modules/prediction/evaluator/vehicle/cost_evaluator.h
modules/prediction/evaluator/vehicle/cost_evaluator.h
+57
-0
未找到文件。
modules/prediction/common/prediction_gflags.cc
浏览文件 @
e79ee61a
...
...
@@ -105,6 +105,10 @@ DEFINE_bool(enable_adjust_velocity_heading, false,
"adjust velocity heading to lane heading"
);
DEFINE_double
(
heading_filter_param
,
0.99
,
"heading filter parameter"
);
// Cost evaluator
DEFINE_double
(
cost_exp_coeff
,
1.5
,
"Coefficient of the exponential term in cost evaluator."
);
// Obstacle trajectory
DEFINE_double
(
lane_sequence_threshold
,
0.5
,
"Threshold for trimming lane sequence trajectories"
);
...
...
modules/prediction/common/prediction_gflags.h
浏览文件 @
e79ee61a
...
...
@@ -78,6 +78,9 @@ DECLARE_double(rnn_min_lane_relatice_s);
DECLARE_bool
(
enable_adjust_velocity_heading
);
DECLARE_double
(
heading_filter_param
);
// Cost evaluator
DECLARE_double
(
cost_exp_coeff
);
// Obstacle trajectory
DECLARE_double
(
lane_sequence_threshold
);
DECLARE_double
(
lane_change_dist
);
...
...
modules/prediction/evaluator/vehicle/BUILD
浏览文件 @
e79ee61a
...
...
@@ -84,5 +84,26 @@ cc_test(
],
)
cc_library
(
name
=
"cost_evaluator"
,
srcs
=
[
"cost_evaluator.cc"
,
],
hdrs
=
[
"cost_evaluator.h"
,
],
deps
=
[
"//modules/common/math:math_utils"
,
"//modules/common/util"
,
"//modules/map/proto:map_proto"
,
"//modules/prediction/common:prediction_gflags"
,
"//modules/prediction/common:prediction_util"
,
"//modules/prediction/common:feature_output"
,
"//modules/prediction/container/obstacles:obstacle"
,
"//modules/prediction/evaluator"
,
"//modules/prediction/proto:feature_proto"
,
"//modules/prediction/proto:lane_graph_proto"
,
],
)
cpplint
()
modules/prediction/evaluator/vehicle/cost_evaluator.cc
0 → 100644
浏览文件 @
e79ee61a
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/prediction/evaluator/vehicle/cost_evaluator.h"
#include "modules/prediction/common/prediction_gflags.h"
namespace
apollo
{
namespace
prediction
{
void
CostEvaluator
::
Evaluate
(
Obstacle
*
obstacle_ptr
)
{
CHECK_NOTNULL
(
obstacle_ptr
);
int
id
=
obstacle_ptr
->
id
();
if
(
!
obstacle_ptr
->
latest_feature
().
IsInitialized
())
{
AERROR
<<
"Obstacle ["
<<
id
<<
"] has no latest feature."
;
return
;
}
Feature
*
latest_feature_ptr
=
obstacle_ptr
->
mutable_latest_feature
();
CHECK_NOTNULL
(
latest_feature_ptr
);
if
(
!
latest_feature_ptr
->
has_lane
()
||
!
latest_feature_ptr
->
lane
().
has_lane_graph
())
{
ADEBUG
<<
"Obstacle ["
<<
id
<<
"] has no lane graph."
;
return
;
}
double
obstacle_length
=
0.0
;
if
(
latest_feature_ptr
->
has_length
())
{
obstacle_length
=
latest_feature_ptr
->
length
();
}
double
obstacle_width
=
0.0
;
if
(
latest_feature_ptr
->
has_width
())
{
obstacle_width
=
latest_feature_ptr
->
width
();
}
CHECK
(
latest_feature_ptr
->
has_velocity_heading
());
double
obstacle_heading
=
latest_feature_ptr
->
velocity_heading
();
LaneGraph
*
lane_graph_ptr
=
latest_feature_ptr
->
mutable_lane
()
->
mutable_lane_graph
();
CHECK_NOTNULL
(
lane_graph_ptr
);
if
(
lane_graph_ptr
->
lane_sequence_size
()
==
0
)
{
AERROR
<<
"Obstacle ["
<<
id
<<
"] has no lane sequences."
;
return
;
}
for
(
int
i
=
0
;
i
<
lane_graph_ptr
->
lane_sequence_size
();
++
i
)
{
LaneSequence
*
lane_sequence_ptr
=
lane_graph_ptr
->
mutable_lane_sequence
(
i
);
CHECK_NOTNULL
(
lane_sequence_ptr
);
double
probability
=
ComputeProbability
(
obstacle_length
,
obstacle_width
,
obstacle_heading
,
*
lane_sequence_ptr
);
lane_sequence_ptr
->
set_probability
(
probability
);
}
}
double
CostEvaluator
::
ComputeProbability
(
const
double
obstacle_length
,
const
double
obstacle_width
,
const
double
obstacle_heading
,
const
LaneSequence
&
lane_sequence
)
{
if
(
lane_sequence
.
lane_segment_size
()
==
0
||
lane_sequence
.
lane_segment
(
0
).
lane_point_size
()
==
0
)
{
return
0.0
;
}
const
LanePoint
&
lane_point
=
lane_sequence
.
lane_segment
(
0
).
lane_point
(
0
);
double
lane_l
=
-
lane_point
.
relative_l
();
double
distance
=
lane_l
-
obstacle_length
/
2.0
*
std
::
sin
(
lane_point
.
angle_diff
());
if
(
lane_l
>
0.0
)
{
distance
-=
obstacle_width
/
2.0
*
std
::
cos
(
lane_point
.
angle_diff
());
}
else
{
distance
+=
obstacle_width
/
2.0
*
std
::
cos
(
lane_point
.
angle_diff
());
}
distance
=
std
::
abs
(
distance
);
double
half_lane_width
=
lane_point
.
width
()
/
2.0
;
if
(
distance
<
half_lane_width
+
FLAGS_double_precision
)
{
return
1.0
;
}
return
std
::
exp
(
FLAGS_cost_exp_coeff
*
(
half_lane_width
-
distance
));
}
}
// namespace prediction
}
// namespace apollo
modules/prediction/evaluator/vehicle/cost_evaluator.h
0 → 100644
浏览文件 @
e79ee61a
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef MODULES_PREDICTION_EVALUATOR_VEHICLE_COST_EVALUATOR_H_
#define MODULES_PREDICTION_EVALUATOR_VEHICLE_COST_EVALUATOR_H_
#include "modules/prediction/container/obstacles/obstacle.h"
#include "modules/prediction/evaluator/evaluator.h"
#include "modules/prediction/proto/feature.pb.h"
#include "modules/prediction/proto/lane_graph.pb.h"
namespace
apollo
{
namespace
prediction
{
class
CostEvaluator
:
public
Evaluator
{
public:
/**
* @brief Constructor
*/
CostEvaluator
()
=
default
;
/**
* @brief Destructor
*/
virtual
~
CostEvaluator
()
=
default
;
/**
* @brief Override Evaluate
* @param Obstacle pointer
*/
void
Evaluate
(
Obstacle
*
obstacle_ptr
)
override
;
private:
double
ComputeProbability
(
const
double
obstacle_length
,
const
double
obstacle_width
,
const
double
obstacle_heading
,
const
LaneSequence
&
lane_sequence
);
};
}
// namespace prediction
}
// namespace apollo
#endif // MODULES_PREDICTION_EVALUATOR_VEHICLE_COST_EVALUATOR_H_
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录