Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
f2fb8d54
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,发现更多精彩内容 >>
提交
f2fb8d54
编写于
7月 29, 2017
作者:
Z
Zhang Liangliang
提交者:
Jiangtao Hu
7月 29, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added TestSuite, hdmap_s_path
上级
dcccf41e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
77 addition
and
0 deletion
+77
-0
modules/map/pnc_map/path_test.cc
modules/map/pnc_map/path_test.cc
+77
-0
未找到文件。
modules/map/pnc_map/path_test.cc
浏览文件 @
f2fb8d54
...
...
@@ -558,6 +558,83 @@ TEST(TestSuite, hdmap_jerky_path) {
}
}
TEST
(
TestSuite
,
hdmap_s_path
)
{
std
::
vector
<
MapPathPoint
>
points
;
const
double
kRadius
=
50.0
;
const
int
kNumSegments
=
100
;
for
(
int
i
=
0
;
i
<=
kNumSegments
;
++
i
)
{
if
(
i
<=
kNumSegments
/
2
)
{
const
double
p
=
-
M_PI_2
+
2.0
*
M_PI
*
static_cast
<
double
>
(
i
)
/
static_cast
<
double
>
(
kNumSegments
);
points
.
push_back
(
make_map_path_point
(
kRadius
*
cos
(
p
),
kRadius
*
(
sin
(
p
)
-
1.0
)));
}
else
{
const
double
p
=
M_PI_2
-
2.0
*
M_PI
*
static_cast
<
double
>
(
i
)
/
static_cast
<
double
>
(
kNumSegments
);
points
.
push_back
(
make_map_path_point
(
kRadius
*
cos
(
p
),
kRadius
*
(
sin
(
p
)
+
1.0
)));
}
}
const
Path
path
(
points
,
{},
2.0
);
EXPECT_EQ
(
path
.
num_points
(),
kNumSegments
+
1
);
EXPECT_EQ
(
path
.
num_segments
(),
kNumSegments
);
EXPECT_EQ
(
path
.
path_points
().
size
(),
kNumSegments
+
1
);
EXPECT_EQ
(
path
.
lane_segments
().
size
(),
0
);
EXPECT_EQ
(
path
.
segments
().
size
(),
kNumSegments
);
const
auto
*
path_approximation
=
path
.
approximation
();
EXPECT_NEAR
(
path_approximation
->
max_error
(),
2.0
,
1e-6
);
EXPECT_EQ
(
path_approximation
->
original_ids
().
size
(),
12
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
0
],
0
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
1
],
9
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
2
],
18
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
3
],
27
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
4
],
36
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
5
],
45
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
6
],
57
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
7
],
66
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
8
],
75
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
9
],
84
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
10
],
93
);
EXPECT_EQ
(
path_approximation
->
original_ids
()[
11
],
100
);
const
double
total_length
=
path
.
accumulated_s
().
back
();
const
double
kLargeEps
=
0.1
;
double
accumulate_s
;
double
lateral
;
double
distance
;
EXPECT_TRUE
(
path
.
get_projection
({
-
1
,
-
2.0
*
kRadius
-
1
},
&
accumulate_s
,
&
lateral
,
&
distance
));
EXPECT_NEAR
(
accumulate_s
,
-
1.0
,
kLargeEps
);
EXPECT_NEAR
(
lateral
,
-
1.0
,
kLargeEps
);
EXPECT_NEAR
(
distance
,
sqrt
(
2.0
),
1e-6
);
EXPECT_TRUE
(
path
.
get_projection
({
1
,
2.0
*
kRadius
+
1
},
&
accumulate_s
,
&
lateral
,
&
distance
));
EXPECT_NEAR
(
accumulate_s
,
total_length
+
1.0
,
kLargeEps
);
EXPECT_NEAR
(
lateral
,
1.0
,
kLargeEps
);
EXPECT_NEAR
(
distance
,
sqrt
(
2.0
),
1e-6
);
const
Path
path_no_approximation
(
points
,
{});
for
(
int
case_id
=
0
;
case_id
<
10000
;
++
case_id
)
{
const
double
x
=
random_double
(
-
kRadius
*
1.5
,
kRadius
*
1.5
);
const
double
y
=
random_double
(
-
kRadius
*
2.5
,
kRadius
*
2.5
);
EXPECT_TRUE
(
path
.
get_nearest_point
({
x
,
y
},
&
accumulate_s
,
&
lateral
,
&
distance
));
double
other_accumulate_s
;
double
other_lateral
;
double
other_distance
;
EXPECT_TRUE
(
path_no_approximation
.
get_nearest_point
(
{
x
,
y
},
&
other_accumulate_s
,
&
other_lateral
,
&
other_distance
));
EXPECT_NEAR
(
distance
,
other_distance
,
1e-6
);
EXPECT_NEAR
(
path
.
get_smooth_point
(
accumulate_s
).
DistanceTo
({
x
,
y
}),
distance
,
1e-6
);
}
}
}
// hdmap
}
// apollo
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录