Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
5dca75aa
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 搜索 >>
提交
5dca75aa
编写于
9月 06, 2017
作者:
Z
Zhang Liangliang
提交者:
Dong Li
9月 06, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Planning: added more functions into reference_line_provider.
上级
3e6ab913
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
88 addition
and
6 deletion
+88
-6
modules/planning/reference_line/BUILD
modules/planning/reference_line/BUILD
+1
-0
modules/planning/reference_line/reference_line_provider.cc
modules/planning/reference_line/reference_line_provider.cc
+68
-3
modules/planning/reference_line/reference_line_provider.h
modules/planning/reference_line/reference_line_provider.h
+19
-3
未找到文件。
modules/planning/reference_line/BUILD
浏览文件 @
5dca75aa
...
...
@@ -58,6 +58,7 @@ cc_library(
deps
=
[
"reference_line"
,
"reference_line_smoother"
,
"//modules/map/pnc_map"
,
],
)
...
...
modules/planning/reference_line/reference_line_provider.cc
浏览文件 @
5dca75aa
...
...
@@ -20,6 +20,7 @@
* @brief Implementation of the class ReferenceLineProvider.
*/
#include "modules/planning/common/planning_gflags.h"
#include "modules/planning/reference_line/reference_line_provider.h"
/**
...
...
@@ -29,8 +30,15 @@
namespace
apollo
{
namespace
planning
{
void
ReferenceLineProvider
::
Init
()
{
// TODO: implement this function.
using
apollo
::
common
::
VehicleState
;
void
ReferenceLineProvider
::
Init
(
const
hdmap
::
PncMap
*
pnc_map
,
const
routing
::
RoutingResponse
&
routing_response
,
const
ReferenceLineSmootherConfig
&
smoother_config
)
{
pnc_map_
=
pnc_map
;
routing_response_
=
routing_response
;
smoother_config_
=
smoother_config
;
is_initialized_
=
true
;
}
...
...
@@ -46,12 +54,69 @@ bool ReferenceLineProvider::Start() {
void
ReferenceLineProvider
::
Generate
()
{
// TODO: implement this function.
const
auto
&
curr_adc_position
=
common
::
VehicleState
::
instance
()
->
pose
().
position
();
const
auto
adc_point_enu
=
common
::
util
::
MakePointENU
(
curr_adc_position
.
x
(),
curr_adc_position
.
y
(),
curr_adc_position
.
z
());
if
(
!
CreateReferenceLineFromRouting
(
adc_point_enu
,
routing_response_
))
{
AERROR
<<
"Fail to create reference line at position: "
<<
curr_adc_position
.
ShortDebugString
();
};
}
std
::
vector
<
ReferenceLine
>
ReferenceLineProvider
::
GetReferenceLines
()
{
// TODO: implement this function.
// TODO: implement this function using the current adc position and the
// existing reference lines. It is required that the current reference lines
// can cover thoroughly the current adc position so that planning can be make
// with a minimum planning distance of 100 meters ahead and 10 meters
// backward.
std
::
lock_guard
<
std
::
mutex
>
lock
(
reference_line_groups_mutex_
);
return
reference_line_groups_
.
back
();
}
bool
ReferenceLineProvider
::
CreateReferenceLineFromRouting
(
const
common
::
PointENU
&
position
,
const
routing
::
RoutingResponse
&
routing
)
{
std
::
vector
<
ReferenceLine
>
reference_lines
;
std
::
vector
<
std
::
vector
<
hdmap
::
LaneSegment
>>
route_segments
;
const
double
kBackwardDistance
=
20
;
const
double
kForwardDistance
=
100
;
if
(
!
pnc_map_
->
GetLaneSegmentsFromRouting
(
routing
,
position
,
kBackwardDistance
,
kForwardDistance
,
&
route_segments
))
{
AERROR
<<
"Failed to extract segments from routing"
;
return
false
;
}
ReferenceLineSmoother
smoother
;
smoother
.
Init
(
smoother_config_
);
for
(
const
auto
&
segments
:
route_segments
)
{
hdmap
::
Path
hdmap_path
;
pnc_map_
->
CreatePathFromLaneSegments
(
segments
,
&
hdmap_path
);
if
(
FLAGS_enable_smooth_reference_line
)
{
ReferenceLine
reference_line
;
if
(
!
smoother
.
Smooth
(
ReferenceLine
(
hdmap_path
),
&
reference_line
))
{
AERROR
<<
"Failed to smooth reference line"
;
continue
;
}
reference_lines
.
push_back
(
std
::
move
(
reference_line
));
}
else
{
reference_lines
.
emplace_back
(
hdmap_path
);
}
}
if
(
reference_lines
.
empty
())
{
AERROR
<<
"No smooth reference lines available"
;
return
false
;
}
std
::
lock_guard
<
std
::
mutex
>
lock
(
reference_line_groups_mutex_
);
reference_line_groups_
.
push_back
(
reference_lines
);
return
true
;
}
}
// namespace planning
}
// namespace apollo
modules/planning/reference_line/reference_line_provider.h
浏览文件 @
5dca75aa
...
...
@@ -22,9 +22,13 @@
#define MODULES_PLANNING_REFERENCE_LINE_REFERENCE_LINE_PROVIDER_H_
#include <memory>
#include <mutex>
#include <thread>
#include <vector>
#include "modules/common/util/util.h"
#include "modules/common/vehicle_state/vehicle_state.h"
#include "modules/map/pnc_map/pnc_map.h"
#include "modules/planning/reference_line/reference_line.h"
#include "modules/planning/reference_line/reference_line_smoother.h"
...
...
@@ -47,19 +51,31 @@ class ReferenceLineProvider {
*/
virtual
~
ReferenceLineProvider
()
=
default
;
void
Init
();
void
Init
(
const
hdmap
::
PncMap
*
pnc_map_
,
const
routing
::
RoutingResponse
&
routing_response
,
const
ReferenceLineSmootherConfig
&
smoother_config
);
bool
Start
();
std
::
vector
<
ReferenceLine
>
GetReferenceLines
();
private:
DECLARE_SINGLETON
(
ReferenceLineProvider
);
void
Generate
();
void
IsValidReferenceLine
();
bool
CreateReferenceLineFromRouting
(
const
common
::
PointENU
&
position
,
const
routing
::
RoutingResponse
&
routing
);
private:
DECLARE_SINGLETON
(
ReferenceLineProvider
);
bool
is_initialized_
=
false
;
std
::
unique_ptr
<
std
::
thread
>
thread_
;
const
hdmap
::
PncMap
*
pnc_map_
=
nullptr
;
routing
::
RoutingResponse
routing_response_
;
ReferenceLineSmootherConfig
smoother_config_
;
std
::
mutex
reference_line_groups_mutex_
;
std
::
vector
<
std
::
vector
<
ReferenceLine
>>
reference_line_groups_
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录