Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
313c0aee
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,体验更适合开发者的 AI 搜索 >>
提交
313c0aee
编写于
3月 05, 2018
作者:
Z
zhujun08
提交者:
Liangliang Zhang
3月 05, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add lane post-processing subnode
上级
b8960c50
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
288 addition
and
1 deletion
+288
-1
modules/perception/obstacle/camera/lane_post_process/cc_lane_post_processor/cc_lane_post_processor.cc
..._process/cc_lane_post_processor/cc_lane_post_processor.cc
+0
-1
modules/perception/obstacle/onboard/lane_post_processing_subnode.cc
...rception/obstacle/onboard/lane_post_processing_subnode.cc
+217
-0
modules/perception/obstacle/onboard/lane_post_processing_subnode.h
...erception/obstacle/onboard/lane_post_processing_subnode.h
+69
-0
modules/perception/obstacle/onboard/object_shared_data.h
modules/perception/obstacle/onboard/object_shared_data.h
+2
-0
未找到文件。
modules/perception/obstacle/camera/lane_post_process/cc_lane_post_processor/cc_lane_post_processor.cc
浏览文件 @
313c0aee
...
...
@@ -42,7 +42,6 @@ bool CompOriginLateralDistObjectID(const pair<ScalarType, int> &a,
bool
CCLanePostProcessor
::
Init
()
{
// 1. get model config
ConfigManager
*
config_manager
=
ConfigManager
::
instance
();
// Singleton<config_manager::ConfigManager>::get();
const
ModelConfig
*
model_config
=
NULL
;
if
(
!
config_manager
->
GetModelConfig
(
this
->
name
(),
&
model_config
))
{
...
...
modules/perception/obstacle/onboard/lane_post_processing_subnode.cc
0 → 100644
浏览文件 @
313c0aee
/******************************************************************************
* 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.
*****************************************************************************/
// @brief: lane_post_processing_subnode source file
#include "modules/perception/obstacle/onboard/lane_post_processing_subnode.h"
#include <yaml-cpp/yaml.h>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <cfloat>
#include "modules/common/log.h"
#include "modules/perception/common/perception_gflags.h"
#include "modules/perception/lib/config_manager/config_manager.h"
#include "modules/perception/lib/base/time_util.h"
#include "modules/perception/onboard/event_manager.h"
#include "modules/perception/onboard/shared_data_manager.h"
#include "modules/perception/onboard/types.h"
namespace
apollo
{
namespace
perception
{
using
std
::
string
;
bool
LanePostProcessingSubnode
::
InitInternal
()
{
// init shared data
if
(
!
InitSharedData
())
{
AERROR
<<
"failed to init shared data."
;
return
false
;
}
// init plugins
if
(
!
InitAlgorithmPlugins
())
{
AERROR
<<
"failed to init algorithm plugins."
;
return
false
;
}
// init work_root
if
(
!
InitWorkRoot
())
{
AERROR
<<
"failed to init work root."
;
return
false
;
}
AINFO
<<
"init LanePostProcessing subnode successfully."
;
return
true
;
}
bool
LanePostProcessingSubnode
::
InitSharedData
()
{
if
(
shared_data_manager_
==
nullptr
)
{
AERROR
<<
"shared data manager is a null pointer."
;
return
false
;
}
// init preprocess_data
camera_object_data_
=
dynamic_cast
<
CameraObjectData
*>
(
shared_data_manager_
->
GetSharedData
(
"CameraObjectData"
));
if
(
camera_object_data_
==
nullptr
)
{
AERROR
<<
"failed to get shared data instance: CameraObjectData "
;
return
false
;
}
lane_shared_data_
=
dynamic_cast
<
LaneSharedData
*>
(
shared_data_manager_
->
GetSharedData
(
"LaneSharedData"
));
if
(
lane_shared_data_
==
nullptr
)
{
AERROR
<<
"failed to get shared data instance: LaneSharedData "
;
return
false
;
}
AINFO
<<
"init shared data successfully, data: "
<<
camera_object_data_
->
name
()
<<
" and "
<<
lane_shared_data_
->
name
();
return
true
;
}
bool
LanePostProcessingSubnode
::
InitAlgorithmPlugin
()
{
// init lane post-processer
lane_post_processor_
.
reset
(
BaseCameraLanePostProcessorRegisterer
::
GetInstanceByName
(
FLAGS_onboard_lane_post_processer
));
if
(
!
lane_post_processor_
)
{
AERROR
<<
"failed to get instance: "
<<
FLAGS_onboard_lane_post_processer
;
return
false
;
}
if
(
!
lane_post_processor_
->
Init
())
{
AERROR
<<
"failed to init lane post-processor: "
<<
lane_post_processor_
->
name
();
return
false
;
}
AINFO
<<
"init alg pulgins successfully
\n
"
<<
" lane post-processer: "
<<
FLAGS_onboard_lane_post_processer
;
return
true
;
}
bool
LanePostProcessingSubnode
::
InitWorkRoot
()
{
ConfigManager
*
config_manager
=
ConfigManager
::
instance
();
if
(
config_manager
==
NULL
)
{
AERROR
<<
"failed to get ConfigManager instance."
;
return
false
;
}
if
(
!
config_manager
->
Init
())
{
AERROR
<<
"failed to init ConfigManager"
;
return
false
;
}
// get work root dir
work_root_dir_
=
config_manager
->
work_root
();
AINFO
<<
"init config manager successfully, work_root: "
<<
work_root_dir_
;
return
true
;
}
Status
LanePostProcessingSubnode
::
ProcEvents
()
{
// fusion output subnode only subcribe the fusion subnode
CHECK_EQ
(
sub_meta_events_
.
size
(),
1u
)
<<
"only subcribe one event."
;
const
EventMeta
&
event_meta
=
sub_meta_events_
[
0
];
Event
event
;
event_manager_
->
Subscribe
(
event_meta
.
event_id
,
&
event
);
PERF_FUNCTION
();
++
seq_num_
;
std
::
shared_ptr
<
SensorObjects
>
objs
;
bool
status
=
GetSharedData
(
event
,
&
objs
);
if
(
!
status
)
{
AERROR
<<
"failed to get shared data. event:"
<<
event
.
to_string
();
return
FAIL
;
}
cv
::
Mat
lane_map
=
objs
->
camera_frame_supplement
->
lane_map
;
LaneObjectsPtr
lane_instances
(
new
LaneObjects
());
CameraLanePostProcessOptions
options
;
options
.
timestamp
=
event
.
timestamp
;
lane_post_processor_
->
Process
(
lane_map
,
options
,
lane_instances
);
for
(
size_t
i
=
0
;
i
<
lane_instances
->
size
();
++
i
)
{
(
*
lane_instances
)[
i
].
timestamp
=
event
.
timestamp
;
(
*
lane_instances
)[
i
].
seq_num
=
seq_num_
;
}
AINFO
<<
"before publish lane objects, objects num: "
<<
lane_instances
->
size
();
PublishDataAndEvent
(
event
.
timestamp
,
lane_instances
);
AINFO
<<
"successfully finished lane post processing"
;
return
SUCC
;
}
bool
LanePostProcessingSubnode
::
GetSharedData
(
const
Event
&
event
,
std
::
shared_ptr
<
SensorObjects
>
*
objs
)
{
double
timestamp
=
event
.
timestamp
;
string
device_id
=
event
.
reserve
;
device_id_
=
device_id
;
string
data_key
;
if
(
!
SubnodeHelper
::
ProduceSharedDataKey
(
timestamp
,
device_id
,
&
data_key
))
{
AERROR
<<
"failed to produce shared data key. EventID:"
<<
event
.
event_id
<<
" timestamp:"
<<
timestamp
<<
" device_id:"
<<
device_id
;
return
false
;
}
//bool get_data_succ = false;
//get_data_succ = _camera_object_data->get(data_key, objs);
if
(
!
camera_object_data_
->
get
(
data_key
,
objs
))
{
AERROR
<<
"failed to get shared data. event:"
<<
event
.
to_string
();
return
false
;
}
return
true
;
}
void
LanePostProcessingSubnode
::
PublishDataAndEvent
(
double
timestamp
,
const
SharedDataPtr
<
LaneObjects
>
&
lane_objects
)
{
string
key
;
if
(
!
SubnodeHelper
::
ProduceSharedDataKey
(
timestamp
,
device_id_
,
&
key
))
{
AERROR
<<
"failed to produce shared key. time: "
<<
GLOG_TIMESTAMP
(
timestamp
)
<<
", device_id: "
<<
device_id_
;
return
;
}
if
(
!
lane_shared_data_
->
add
(
key
,
lane_objects
))
{
AWARN
<<
"failed to add LaneSharedData. key: "
<<
key
<<
" num_detected_objects: "
<<
lane_objects
->
size
();
return
;
}
// pub events
for
(
size_t
idx
=
0
;
idx
<
pub_meta_events_
.
size
();
++
idx
)
{
const
EventMeta
&
event_meta
=
pub_meta_events_
[
idx
];
Event
event
;
event
.
event_id
=
event_meta
.
event_id
;
event
.
timestamp
=
timestamp
;
event
.
reserve
=
_device_id
;
event_manager_
->
Publish
(
event
);
}
AINFO
<<
"succeed to publish data and event."
;
}
REGISTER_SUBNODE
(
LanePostProcessingSubnode
);
}
// namespace perception
}
// namespace apollo
modules/perception/obstacle/onboard/lane_post_processing_subnode.h
0 → 100644
浏览文件 @
313c0aee
/******************************************************************************
* 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.
*****************************************************************************/
// @brief: lane_post_processing_subnode header file
#ifndef MODULES_PERCEPTION_OBSTACLE_ONBOARD_LANE_POST_PROCESSING_SUBNODE_H_
#define MODULES_PERCEPTION_OBSTACLE_ONBOARD_LANE_POST_PROCESSING_SUBNODE_H_
#include <Eigen/Core>
#include "modules/common/adapters/adapter_manager.h"
#include "modules/perception/obstacle/base/object.h"
#include "modules/perception/obstacle/camera/interface/base_lane_post_processor.h"
#include "modules/perception/obstacle/onboard/camera_shared_data.h"
#include "modules/perception/obstacle/onboard/fusion_shared_data.h"
#include "modules/perception/obstacle/onboard/lane_shared_data.h"
#include "modules/perception/obstacle/onboard/object_shared_data.h"
#include "modules/perception/onboard/subnode.h"
#include "modules/perception/onboard/subnode_helper.h"
namespace
apollo
{
namespace
perception
{
class
LanePostProcessingSubnode
:
public
Subnode
{
public:
LanePostProcessingSubnode
()
=
default
;
virtual
~
LanePostProcessingSubnode
()
{}
apollo
::
common
::
Status
ProcEvents
()
override
;
protected:
bool
InitInternal
()
override
;
private:
bool
InitSharedData
();
bool
InitAlgorithmPlugin
();
bool
InitWorkRoot
();
bool
GetSharedData
(
const
Event
&
event
,
std
::
shared_ptr
<
SensorObjects
>*
objs
);
void
PublishDataAndEvent
(
double
timestamp
,
const
SharedDataPtr
<
LaneObjects
>&
lane_objects
);
std
::
unique_ptr
<
BaseCameraLanePostProcessor
>
lane_post_processor_
;
CameraObjectData
*
camera_object_data_
=
nullptr
;
std
::
string
device_id_
;
std
::
string
work_root_dir_
;
LaneSharedData
*
lane_shared_data_
;
uint64_t
seq_num_
;
DISALLOW_COPY_AND_ASSIGN
(
LanePostProcessingSubnode
);
};
}
// namespace perception
}
// namespace apollo
#endif // MODULES_PERCEPTION_OBSTACLE_ONBOARD_LANE_POST_PROCESSING_SUBNODE_H_
modules/perception/obstacle/onboard/object_shared_data.h
浏览文件 @
313c0aee
...
...
@@ -40,9 +40,11 @@ namespace perception {
OBJECT_SHARED_DATA
(
LidarObjectData
);
OBJECT_SHARED_DATA
(
RadarObjectData
);
OBJECT_SHARED_DATA
(
CameraObjectData
);
REGISTER_SHAREDDATA
(
LidarObjectData
);
REGISTER_SHAREDDATA
(
RadarObjectData
);
REGISTER_SHAREDDATA
(
CameraObjectData
);
}
// namespace perception
}
// namespace apollo
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录