Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
d28f71ff
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,发现更多精彩内容 >>
提交
d28f71ff
编写于
7月 27, 2017
作者:
C
Calvin Miao
提交者:
Jiangtao Hu
7月 27, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated container names from string to adapter config message type
上级
1bc6a5cd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
48 addition
and
29 deletion
+48
-29
modules/prediction/conf/adapter.conf
modules/prediction/conf/adapter.conf
+1
-1
modules/prediction/container/BUILD
modules/prediction/container/BUILD
+1
-0
modules/prediction/container/container_manager.cc
modules/prediction/container/container_manager.cc
+15
-11
modules/prediction/container/container_manager.h
modules/prediction/container/container_manager.h
+13
-8
modules/prediction/evaluator/evaluator_manager.cc
modules/prediction/evaluator/evaluator_manager.cc
+3
-1
modules/prediction/prediction.cc
modules/prediction/prediction.cc
+11
-6
modules/prediction/prediction.h
modules/prediction/prediction.h
+1
-1
modules/prediction/predictor/predictor_manager.cc
modules/prediction/predictor/predictor_manager.cc
+3
-1
未找到文件。
modules/prediction/conf/adapter.conf
浏览文件 @
d28f71ff
config
{
type
:
PERCEPTION_OBSTACLES
mode
:
RECEIVE_ONLY
message_history_limit
:
1
0
message_history_limit
:
1
}
config
{
type
:
LOCALIZATION
...
...
modules/prediction/container/BUILD
浏览文件 @
d28f71ff
...
...
@@ -9,6 +9,7 @@ cc_library(
deps
=
[
"//modules/common:macro"
,
"//modules/common:log"
,
"//modules/common/adapters/proto:adapter_config_proto"
,
"//modules/prediction/container/obstacles:obstacles_container"
,
"//modules/prediction/container/pose:pose_container"
,
"@glog//:glog"
,
...
...
modules/prediction/container/container_manager.cc
浏览文件 @
d28f71ff
...
...
@@ -23,6 +23,8 @@
namespace
apollo
{
namespace
prediction
{
using
::
apollo
::
common
::
adapter
::
AdapterConfig
;
ContainerManager
::
ContainerManager
()
{
RegisterContainers
();
}
...
...
@@ -32,32 +34,34 @@ ContainerManager::~ContainerManager() {
}
void
ContainerManager
::
RegisterContainers
()
{
RegisterContainer
(
"PerceptionObstacles"
);
RegisterContainer
(
"Pose"
);
RegisterContainer
(
AdapterConfig
::
PERCEPTION_OBSTACLES
);
RegisterContainer
(
AdapterConfig
::
LOCALIZATION
);
}
Container
*
ContainerManager
::
GetContainer
(
const
std
::
string
&
name
)
{
if
(
containers_
.
find
(
name
)
!=
containers_
.
end
())
{
return
containers_
[
name
].
get
();
Container
*
ContainerManager
::
GetContainer
(
const
::
apollo
::
common
::
adapter
::
AdapterConfig
::
MessageType
&
type
)
{
if
(
containers_
.
find
(
type
)
!=
containers_
.
end
())
{
return
containers_
[
type
].
get
();
}
else
{
return
nullptr
;
}
}
std
::
unique_ptr
<
Container
>
ContainerManager
::
CreateContainer
(
const
std
::
string
&
nam
e
)
{
const
::
apollo
::
common
::
adapter
::
AdapterConfig
::
MessageType
&
typ
e
)
{
std
::
unique_ptr
<
Container
>
container_ptr
(
nullptr
);
if
(
name
==
"PerceptionObstacles"
)
{
if
(
type
==
AdapterConfig
::
PERCEPTION_OBSTACLES
)
{
container_ptr
.
reset
(
new
ObstaclesContainer
());
}
else
if
(
name
==
"Pose"
)
{
}
else
if
(
type
==
AdapterConfig
::
LOCALIZATION
)
{
container_ptr
.
reset
(
new
PoseContainer
());
}
return
container_ptr
;
}
void
ContainerManager
::
RegisterContainer
(
const
std
::
string
&
name
)
{
containers_
[
name
]
=
CreateContainer
(
name
);
ADEBUG
<<
"Container ["
<<
name
<<
"] is registered."
;
void
ContainerManager
::
RegisterContainer
(
const
::
apollo
::
common
::
adapter
::
AdapterConfig
::
MessageType
&
type
)
{
containers_
[
type
]
=
CreateContainer
(
type
);
ADEBUG
<<
"Container ["
<<
type
<<
"] is registered."
;
}
}
// namespace prediction
...
...
modules/prediction/container/container_manager.h
浏览文件 @
d28f71ff
...
...
@@ -22,11 +22,12 @@
#ifndef MODULES_PREDICTION_CONTAINER_CONTAINER_MANAGER_H_
#define MODULES_PREDICTION_CONTAINER_CONTAINER_MANAGER_H_
#include <
unordered_
map>
#include <map>
#include <string>
#include <memory>
#include "modules/prediction/container/container.h"
#include "modules/common/adapters/proto/adapter_config.pb.h"
#include "modules/common/macro.h"
/**
...
...
@@ -45,24 +46,27 @@ class ContainerManager {
/**
* @brief Get mutable container
* @param
Nam
e of the container
* @param
Typ
e of the container
* @return Pointer to the container given the name
*/
Container
*
GetContainer
(
const
std
::
string
&
name
);
Container
*
GetContainer
(
const
::
apollo
::
common
::
adapter
::
AdapterConfig
::
MessageType
&
type
);
private:
/**
* @breif Register a container
* @param Container
nam
e
* @param Container
typ
e
*/
void
RegisterContainer
(
const
std
::
string
&
name
);
void
RegisterContainer
(
const
::
apollo
::
common
::
adapter
::
AdapterConfig
::
MessageType
&
type
);
/**
* @brief Create a container
* @param Container
nam
e
* @param Container
typ
e
* @return Container pointer
*/
std
::
unique_ptr
<
Container
>
CreateContainer
(
const
std
::
string
&
name
);
std
::
unique_ptr
<
Container
>
CreateContainer
(
const
::
apollo
::
common
::
adapter
::
AdapterConfig
::
MessageType
&
type
);
/**
* @brief Register all containers
...
...
@@ -70,7 +74,8 @@ class ContainerManager {
void
RegisterContainers
();
private:
std
::
unordered_map
<
std
::
string
,
std
::
unique_ptr
<
Container
>>
containers_
;
std
::
map
<::
apollo
::
common
::
adapter
::
AdapterConfig
::
MessageType
,
std
::
unique_ptr
<
Container
>>
containers_
;
DECLARE_SINGLETON
(
ContainerManager
)
};
...
...
modules/prediction/evaluator/evaluator_manager.cc
浏览文件 @
d28f71ff
...
...
@@ -26,6 +26,7 @@ namespace prediction {
using
::
apollo
::
perception
::
PerceptionObstacles
;
using
::
apollo
::
perception
::
PerceptionObstacle
;
using
::
apollo
::
common
::
adapter
::
AdapterConfig
;
EvaluatorManager
::
EvaluatorManager
()
{
RegisterEvaluators
();
...
...
@@ -48,7 +49,8 @@ void EvaluatorManager::Run(
const
::
apollo
::
perception
::
PerceptionObstacles
&
perception_obstacles
)
{
AINFO
<<
"Start run evaluator manager"
;
ObstaclesContainer
*
container
=
dynamic_cast
<
ObstaclesContainer
*>
(
ContainerManager
::
instance
()
->
GetContainer
(
"PerceptionObstacles"
));
ContainerManager
::
instance
()
->
GetContainer
(
AdapterConfig
::
PERCEPTION_OBSTACLES
));
CHECK_NOTNULL
(
container
);
AINFO
<<
"Start for loop"
;
...
...
modules/prediction/prediction.cc
浏览文件 @
d28f71ff
...
...
@@ -33,21 +33,24 @@ namespace prediction {
using
::
apollo
::
perception
::
PerceptionObstacles
;
using
::
apollo
::
localization
::
LocalizationEstimate
;
using
::
apollo
::
common
::
adapter
::
AdapterManager
;
using
::
apollo
::
common
::
adapter
::
AdapterConfig
;
using
::
apollo
::
common
::
Status
;
using
::
apollo
::
common
::
ErrorCode
;
std
::
string
Prediction
::
Name
()
const
{
return
FLAGS_prediction_module_name
;
}
std
::
string
Prediction
::
Name
()
const
{
return
FLAGS_prediction_module_name
;
}
Status
Prediction
::
Init
()
{
// Load prediction conf
conf_
.
Clear
();
prediction_
conf_
.
Clear
();
if
(
!::
apollo
::
common
::
util
::
GetProtoFromFile
(
FLAGS_prediction_conf_file
,
&
conf_
))
{
&
prediction_
conf_
))
{
return
OnError
(
"Unable to load prediction conf file: "
+
FLAGS_prediction_conf_file
);
}
else
{
ADEBUG
<<
"Config file is loaded into: "
<<
conf_
.
ShortDebugString
();
<<
prediction_
conf_
.
ShortDebugString
();
}
// Initialize the adapters
...
...
@@ -74,7 +77,8 @@ void Prediction::Stop() {}
void
Prediction
::
OnPerception
(
const
PerceptionObstacles
&
perception_obstacles
)
{
auto
localization_adapter
=
AdapterManager
::
GetLocalization
();
ObstaclesContainer
*
obstacles_container
=
dynamic_cast
<
ObstaclesContainer
*>
(
ContainerManager
::
instance
()
->
GetContainer
(
"PerceptionObstacles"
));
ContainerManager
::
instance
()
->
GetContainer
(
AdapterConfig
::
PERCEPTION_OBSTACLES
));
if
(
localization_adapter
->
Empty
())
{
ADEBUG
<<
"No localization message."
;
}
else
{
...
...
@@ -84,7 +88,8 @@ void Prediction::OnPerception(const PerceptionObstacles &perception_obstacles) {
<<
localization
.
ShortDebugString
()
<<
"]."
;
PoseContainer
*
pose_container
=
dynamic_cast
<
PoseContainer
*>
(
ContainerManager
::
instance
()
->
GetContainer
(
"Pose"
));
ContainerManager
::
instance
()
->
GetContainer
(
AdapterConfig
::
LOCALIZATION
));
pose_container
->
Insert
(
localization
);
obstacles_container
->
InsertPerceptionObstacle
(
*
(
pose_container
->
ToPerceptionObstacle
()),
...
...
modules/prediction/prediction.h
浏览文件 @
d28f71ff
...
...
@@ -73,7 +73,7 @@ class Prediction : public apollo::common::ApolloApp {
const
perception
::
PerceptionObstacles
&
perception_obstacles
);
private:
PredictionConf
conf_
;
PredictionConf
prediction_
conf_
;
};
}
// namespace prediction
...
...
modules/prediction/predictor/predictor_manager.cc
浏览文件 @
d28f71ff
...
...
@@ -29,6 +29,7 @@ namespace prediction {
using
::
apollo
::
perception
::
PerceptionObstacles
;
using
::
apollo
::
perception
::
PerceptionObstacle
;
using
::
apollo
::
common
::
adapter
::
AdapterConfig
;
PredictorManager
::
PredictorManager
()
{
RegisterPredictors
();
...
...
@@ -53,7 +54,8 @@ void PredictorManager::Run(
const
PerceptionObstacles
&
perception_obstacles
)
{
prediction_obstacles_
.
Clear
();
ObstaclesContainer
*
container
=
dynamic_cast
<
ObstaclesContainer
*>
(
ContainerManager
::
instance
()
->
GetContainer
(
"PerceptionObstacles"
));
ContainerManager
::
instance
()
->
GetContainer
(
AdapterConfig
::
PERCEPTION_OBSTACLES
));
CHECK_NOTNULL
(
container
);
Predictor
*
predictor
=
nullptr
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录