Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
b4e712b1
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 搜索 >>
提交
b4e712b1
编写于
7月 28, 2017
作者:
D
Dong Li
提交者:
lianglia-apollo
7月 28, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove sl_point input in path sampler
上级
1c5b179d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
18 deletion
+27
-18
modules/planning/optimizer/dp_poly_path/dp_road_graph.cc
modules/planning/optimizer/dp_poly_path/dp_road_graph.cc
+1
-2
modules/planning/optimizer/dp_poly_path/path_sampler.cc
modules/planning/optimizer/dp_poly_path/path_sampler.cc
+13
-2
modules/planning/optimizer/dp_poly_path/path_sampler.h
modules/planning/optimizer/dp_poly_path/path_sampler.h
+0
-1
modules/planning/optimizer/dp_poly_path/path_sampler_test.cc
modules/planning/optimizer/dp_poly_path/path_sampler_test.cc
+13
-13
未找到文件。
modules/planning/optimizer/dp_poly_path/dp_road_graph.cc
浏览文件 @
b4e712b1
...
...
@@ -167,8 +167,7 @@ bool DpRoadGraph::generate_graph(const ReferenceLine &reference_line,
}
std
::
vector
<
std
::
vector
<
common
::
SLPoint
>>
points
;
PathSampler
path_sampler
(
config_
);
if
(
!
path_sampler
.
sample
(
reference_line
,
init_point_
,
init_sl_point_
,
&
points
))
{
if
(
!
path_sampler
.
sample
(
reference_line
,
init_point_
,
&
points
))
{
AERROR
<<
"Fail to sampling point with path sampler!"
;
return
false
;
}
...
...
modules/planning/optimizer/dp_poly_path/path_sampler.cc
浏览文件 @
b4e712b1
...
...
@@ -39,9 +39,20 @@ PathSampler::PathSampler(const DpPolyPathConfig& config) : config_(config) {}
bool
PathSampler
::
sample
(
const
ReferenceLine
&
reference_line
,
const
::
apollo
::
common
::
TrajectoryPoint
&
init_point
,
const
::
apollo
::
common
::
SLPoint
&
init_sl_point
,
std
::
vector
<
std
::
vector
<::
apollo
::
common
::
SLPoint
>>*
const
points
)
{
CHECK_NOTNULL
(
points
);
if
(
!
points
)
{
AERROR
<<
"The provided points are null"
;
return
false
;
}
::
apollo
::
common
::
SLPoint
init_sl_point
;
common
::
math
::
Vec2d
init_point_vec2d
{
init_point
.
path_point
().
x
(),
init_point
.
path_point
().
y
()};
if
(
!
reference_line
.
get_point_in_frenet_frame
(
init_point_vec2d
,
&
init_sl_point
))
{
AERROR
<<
"Failed to get sl point from point "
<<
init_point_vec2d
.
DebugString
();
return
false
;
}
const
double
reference_line_length
=
reference_line
.
reference_map_line
().
accumulated_s
().
back
();
double
level_distance
=
...
...
modules/planning/optimizer/dp_poly_path/path_sampler.h
浏览文件 @
b4e712b1
...
...
@@ -36,7 +36,6 @@ class PathSampler {
~
PathSampler
()
=
default
;
bool
sample
(
const
ReferenceLine
&
reference_line
,
const
common
::
TrajectoryPoint
&
init_point
,
const
common
::
SLPoint
&
init_sl_point
,
std
::
vector
<
std
::
vector
<
common
::
SLPoint
>>
*
const
points
);
private:
...
...
modules/planning/optimizer/dp_poly_path/path_sampler_test.cc
浏览文件 @
b4e712b1
...
...
@@ -39,49 +39,49 @@ class PathSamplerTest : public OptimizerTestBase {
virtual
void
SetUp
()
{
OptimizerTestBase
::
SetUp
();
sampled_points_
.
clear
();
init_point_
.
mutable_path_point
()
->
set_x
(
586392.84003
);
init_point_
.
mutable_path_point
()
->
set_y
(
4140673.01232
);
init_sl_point_
.
set_s
(
0.0
);
init_sl_point_
.
set_l
(
0.0
);
init_point_
.
mutable_path_point
()
->
set_x
(
pose_
.
position
().
x
());
init_point_
.
mutable_path_point
()
->
set_y
(
pose_
.
position
().
y
());
init_point_
.
mutable_path_point
()
->
set_z
(
0.0
);
init_point_
.
set_a
(
0.0
);
init_point_
.
set_v
(
0.0
);
reference_line_
=
&
(
frame_
->
planning_data
().
reference_line
());
}
protected:
std
::
vector
<
std
::
vector
<
common
::
SLPoint
>>
sampled_points_
;
common
::
TrajectoryPoint
init_point_
;
common
::
SLPoint
init_sl_point_
;
const
ReferenceLine
*
reference_line_
=
nullptr
;
};
TEST_F
(
PathSamplerTest
,
sample_one_point
)
{
dp_poly_path_config_
.
set_sample_points_num_each_level
(
1
);
PathSampler
sampler
(
dp_poly_path_config_
);
bool
sample_result
=
sampler
.
sample
(
*
reference_line_
,
init_point_
,
init_sl
_point_
,
&
sampled_points_
);
bool
sample_result
=
sampler
.
sample
(
*
reference_line_
,
init
_point_
,
&
sampled_points_
);
EXPECT_TRUE
(
sample_result
);
// export_sl_points(sampled_points_, "/tmp/points.txt");
ASSERT_EQ
(
8
,
sampled_points_
.
size
());
ASSERT_EQ
(
1
,
sampled_points_
[
0
].
size
());
ASSERT_EQ
(
1
,
sampled_points_
[
7
].
size
());
EXPECT_FLOAT_EQ
(
64
,
sampled_points_
[
7
][
0
].
s
());
EXPECT_FLOAT_EQ
(
70.419151
,
sampled_points_
[
7
][
0
].
s
());
EXPECT_FLOAT_EQ
(
0
,
sampled_points_
[
7
][
0
].
l
());
}
TEST_F
(
PathSamplerTest
,
sample_three_points
)
{
dp_poly_path_config_
.
set_sample_points_num_each_level
(
3
);
PathSampler
sampler
(
dp_poly_path_config_
);
bool
sample_result
=
sampler
.
sample
(
*
reference_line_
,
init_point_
,
init_sl
_point_
,
&
sampled_points_
);
bool
sample_result
=
sampler
.
sample
(
*
reference_line_
,
init
_point_
,
&
sampled_points_
);
EXPECT_TRUE
(
sample_result
);
// export_sl_points(sampled_points_, "/tmp/points.txt");
ASSERT_EQ
(
8
,
sampled_points_
.
size
());
ASSERT_EQ
(
3
,
sampled_points_
[
0
].
size
());
ASSERT_EQ
(
3
,
sampled_points_
[
7
].
size
());
EXPECT_FLOAT_EQ
(
64
,
sampled_points_
[
7
][
0
].
s
());
EXPECT_FLOAT_EQ
(
70.419151
,
sampled_points_
[
7
][
0
].
s
());
EXPECT_FLOAT_EQ
(
-
0.5
,
sampled_points_
[
7
][
0
].
l
());
EXPECT_FLOAT_EQ
(
64
,
sampled_points_
[
7
][
1
].
s
());
EXPECT_FLOAT_EQ
(
70.419151
,
sampled_points_
[
7
][
1
].
s
());
EXPECT_FLOAT_EQ
(
0
,
sampled_points_
[
7
][
1
].
l
());
EXPECT_FLOAT_EQ
(
64
,
sampled_points_
[
7
][
2
].
s
());
EXPECT_FLOAT_EQ
(
70.419151
,
sampled_points_
[
7
][
2
].
s
());
EXPECT_FLOAT_EQ
(
0.5
,
sampled_points_
[
7
][
2
].
l
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录