Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
b919d1ac
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,发现更多精彩内容 >>
提交
b919d1ac
编写于
9月 24, 2018
作者:
K
kechxu
提交者:
Qi Luo
9月 28, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: Implement build lane features in cruise scenario
上级
ecd0ff56
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
87 addition
and
17 deletion
+87
-17
modules/prediction/scenario/analyzer/scenario_analyzer.cc
modules/prediction/scenario/analyzer/scenario_analyzer.cc
+10
-8
modules/prediction/scenario/analyzer/scenario_analyzer.h
modules/prediction/scenario/analyzer/scenario_analyzer.h
+1
-4
modules/prediction/scenario/feature_extractor/feature_extractor.cc
...rediction/scenario/feature_extractor/feature_extractor.cc
+1
-1
modules/prediction/scenario/scenario_features/BUILD
modules/prediction/scenario/scenario_features/BUILD
+3
-0
modules/prediction/scenario/scenario_features/cruise_scenario_features.cc
...on/scenario/scenario_features/cruise_scenario_features.cc
+63
-4
modules/prediction/scenario/scenario_features/cruise_scenario_features.h
...ion/scenario/scenario_features/cruise_scenario_features.h
+9
-0
未找到文件。
modules/prediction/scenario/analyzer/scenario_analyzer.cc
浏览文件 @
b919d1ac
...
...
@@ -15,8 +15,10 @@
*****************************************************************************/
#include "modules/prediction/scenario/analyzer/scenario_analyzer.h"
#include <string>
#include "modules/prediction/common/prediction_gflags.h"
#include "modules/prediction/scenario/scenario_features/cruise_scenario_features.h"
namespace
apollo
{
namespace
prediction
{
...
...
@@ -32,6 +34,13 @@ void ScenarioAnalyzer::Analyze(
}
else
if
(
environment_features
.
has_ego_lane
())
{
scenario_
.
set_type
(
Scenario
::
CRUISE
);
}
if
(
scenario_
.
type
()
==
Scenario
::
CRUISE
)
{
std
::
shared_ptr
<
CruiseScenarioFeatures
>
cruise_scenario_features
=
std
::
make_shared
<
CruiseScenarioFeatures
>
();
cruise_scenario_features
->
BuildCruiseScenarioFeatures
(
environment_features
);
scenario_features_
=
cruise_scenario_features
;
}
}
const
Scenario
&
ScenarioAnalyzer
::
scenario
()
const
{
...
...
@@ -43,12 +52,5 @@ ScenarioAnalyzer::GetScenarioFeatures() {
return
scenario_features_
;
}
void
ScenarioAnalyzer
::
BuildCruiseScenarioFeatures
(
const
EnvironmentFeatures
&
environment_features
)
{
// TODO(kechxu) implement
std
::
shared_ptr
<
CruiseScenarioFeatures
>
cruise_scenario_features
;
scenario_features_
=
cruise_scenario_features
;
}
}
// namespace prediction
}
// namespace apollo
modules/prediction/scenario/analyzer/scenario_analyzer.h
浏览文件 @
b919d1ac
...
...
@@ -22,6 +22,7 @@
#include "modules/prediction/proto/scenario.pb.h"
#include "modules/prediction/common/environment_features.h"
#include "modules/prediction/scenario/scenario_features/scenario_features.h"
#include "modules/prediction/scenario/scenario_features/cruise_scenario_features.h"
namespace
apollo
{
namespace
prediction
{
...
...
@@ -38,10 +39,6 @@ class ScenarioAnalyzer {
std
::
shared_ptr
<
ScenarioFeatures
>
GetScenarioFeatures
();
private:
void
BuildCruiseScenarioFeatures
(
const
EnvironmentFeatures
&
environment_features
);
private:
Scenario
scenario_
;
...
...
modules/prediction/scenario/feature_extractor/feature_extractor.cc
浏览文件 @
b919d1ac
...
...
@@ -87,7 +87,7 @@ void FeatureExtractor::ExtractEgoLaneFeatures(const LaneInfoPtr& ptr_ego_lane,
const
common
::
math
::
Vec2d
&
ego_position
)
{
if
(
ptr_ego_lane
==
nullptr
)
{
A
ERROR
<<
"Ego vehicle is not on any lane."
;
A
DEBUG
<<
"Ego vehicle is not on any lane."
;
return
;
}
double
curr_lane_s
=
0.0
;
...
...
modules/prediction/scenario/scenario_features/BUILD
浏览文件 @
b919d1ac
...
...
@@ -9,6 +9,9 @@ cc_library(
hdrs
=
[
"cruise_scenario_features.h"
,
"scenario_features.h"
],
deps
=
[
"//modules/prediction/common:prediction_gflags"
,
"//modules/prediction/common:prediction_map"
,
"//modules/prediction/common:environment_features"
,
"//framework:cybertron"
,
],
)
...
...
modules/prediction/scenario/scenario_features/cruise_scenario_features.cc
浏览文件 @
b919d1ac
...
...
@@ -14,15 +14,22 @@
* limitations under the License.
*****************************************************************************/
/**
* @file
*/
#include "modules/prediction/scenario/scenario_features/cruise_scenario_features.h"
#include <queue>
#include <memory>
#include <utility>
#include "modules/prediction/common/prediction_gflags.h"
#include "modules/prediction/common/prediction_map.h"
namespace
apollo
{
namespace
prediction
{
using
apollo
::
hdmap
::
LaneInfo
;
using
ConstLaneInfoPtr
=
std
::
shared_ptr
<
const
LaneInfo
>
;
using
apollo
::
hdmap
::
Lane
;
CruiseScenarioFeatures
::
CruiseScenarioFeatures
()
{}
CruiseScenarioFeatures
::~
CruiseScenarioFeatures
()
{}
...
...
@@ -35,5 +42,57 @@ void CruiseScenarioFeatures::InsertLaneOfInterest(const std::string lane_id) {
lane_ids_of_interest_
.
insert
(
lane_id
);
}
void
CruiseScenarioFeatures
::
BuildCruiseScenarioFeatures
(
const
EnvironmentFeatures
&
environment_features
)
{
if
(
environment_features
.
has_ego_lane
())
{
auto
ego_lane
=
environment_features
.
GetEgoLane
();
const
std
::
string
&
ego_lane_id
=
ego_lane
.
first
;
double
ego_lane_s
=
ego_lane
.
second
;
SearchAndInsertLanes
(
ego_lane_id
,
ego_lane_s
,
50.0
);
}
if
(
environment_features
.
has_left_neighbor_lane
())
{
auto
left_lane
=
environment_features
.
GetLeftNeighborLane
();
const
std
::
string
&
left_lane_id
=
left_lane
.
first
;
double
left_lane_s
=
left_lane
.
second
;
SearchAndInsertLanes
(
left_lane_id
,
left_lane_s
,
50.0
);
}
if
(
environment_features
.
has_right_neighbor_lane
())
{
auto
right_lane
=
environment_features
.
GetRightNeighborLane
();
const
std
::
string
&
right_lane_id
=
right_lane
.
first
;
double
right_lane_s
=
right_lane
.
second
;
SearchAndInsertLanes
(
right_lane_id
,
right_lane_s
,
50.0
);
}
}
void
CruiseScenarioFeatures
::
SearchAndInsertLanes
(
const
std
::
string
&
start_lane_id
,
const
double
start_lane_s
,
const
double
range
)
{
ConstLaneInfoPtr
start_lane_info
=
PredictionMap
::
LaneById
(
start_lane_id
);
double
start_lane_length
=
start_lane_info
->
total_length
();
double
start_accumulated_s
=
start_lane_length
-
start_lane_s
;
std
::
queue
<
std
::
pair
<
ConstLaneInfoPtr
,
double
>>
lane_queue
;
lane_queue
.
emplace
(
start_lane_info
,
start_accumulated_s
);
while
(
!
lane_queue
.
empty
())
{
ConstLaneInfoPtr
lane_info
=
lane_queue
.
front
().
first
;
double
accumulated_s
=
lane_queue
.
front
().
second
;
lane_queue
.
pop
();
InsertLaneOfInterest
(
lane_info
->
id
().
id
());
const
Lane
&
lane
=
lane_info
->
lane
();
for
(
const
auto
prede_lane_id
:
lane
.
predecessor_id
())
{
InsertLaneOfInterest
(
prede_lane_id
.
id
());
}
if
(
accumulated_s
>
range
)
{
continue
;
}
for
(
const
auto
succ_lane_id
:
lane
.
successor_id
())
{
ConstLaneInfoPtr
succ_lane_info
=
PredictionMap
::
LaneById
(
succ_lane_id
.
id
());
double
succ_lane_length
=
succ_lane_info
->
total_length
();
lane_queue
.
emplace
(
succ_lane_info
,
accumulated_s
+
succ_lane_length
);
}
}
}
}
// namespace prediction
}
// namespace apollo
modules/prediction/scenario/scenario_features/cruise_scenario_features.h
浏览文件 @
b919d1ac
...
...
@@ -25,6 +25,7 @@
#include <unordered_set>
#include "modules/prediction/scenario/scenario_features/scenario_features.h"
#include "modules/prediction/common/environment_features.h"
namespace
apollo
{
namespace
prediction
{
...
...
@@ -39,6 +40,14 @@ class CruiseScenarioFeatures : public ScenarioFeatures {
void
InsertLaneOfInterest
(
const
std
::
string
lane_id
);
void
BuildCruiseScenarioFeatures
(
const
EnvironmentFeatures
&
environment_features
);
private:
void
SearchAndInsertLanes
(
const
std
::
string
&
lane_id
,
const
double
start_lane_s
,
const
double
range
);
private:
std
::
unordered_set
<
std
::
string
>
lane_ids_of_interest_
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录