Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
f1924491
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,发现更多精彩内容 >>
提交
f1924491
编写于
8月 08, 2017
作者:
Y
Yajia Zhang
提交者:
Kecheng Xu
8月 08, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: improved the implementation of get_speed_limit_by_t in class SpeedLimit
上级
c19048cb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
12 addition
and
9 deletion
+12
-9
modules/planning/common/speed_limit.cc
modules/planning/common/speed_limit.cc
+12
-9
未找到文件。
modules/planning/common/speed_limit.cc
浏览文件 @
f1924491
...
...
@@ -22,6 +22,7 @@
#include <algorithm>
#include "modules/common/math/linear_interpolation.h"
#include "modules/common/util/util.h"
#include "modules/planning/common/planning_util.h"
...
...
@@ -78,7 +79,6 @@ double SpeedLimit::get_speed_limit_by_s(const double s) const {
}
double
SpeedLimit
::
get_speed_limit_by_t
(
const
double
t
)
const
{
double
ref_t
=
t
;
if
(
speed_points_
.
size
()
==
0
)
{
return
0.0
;
}
...
...
@@ -87,11 +87,11 @@ double SpeedLimit::get_speed_limit_by_t(const double t) const {
return
speed_points_
.
front
().
v
();
}
if
(
ref_
t
>
speed_points_
.
back
().
t
())
{
if
(
t
>
speed_points_
.
back
().
t
())
{
return
speed_points_
.
back
().
v
();
}
if
(
ref_
t
<
speed_points_
.
front
().
t
())
{
if
(
t
<
speed_points_
.
front
().
t
())
{
return
speed_points_
.
front
().
v
();
}
...
...
@@ -101,14 +101,17 @@ double SpeedLimit::get_speed_limit_by_t(const double t) const {
std
::
lower_bound
(
speed_points_
.
begin
(),
speed_points_
.
end
(),
t
,
func
);
if
(
it_lower
==
speed_points_
.
begin
())
{
return
speed_points_
.
front
().
v
();
}
else
if
(
it_lower
==
speed_points_
.
end
())
{
return
speed_points_
.
back
().
v
();
}
double
weight
=
0.0
;
double
range
=
(
*
it_lower
).
t
()
-
(
*
(
it_lower
-
1
)).
t
();
if
(
range
>
0
)
{
weight
=
(
t
-
(
*
(
it_lower
-
1
)).
t
())
/
range
;
}
return
util
::
interpolate
(
*
(
it_lower
-
1
),
*
it_lower
,
weight
).
v
();
double
v0
=
(
it_lower
-
1
)
->
v
();
double
t0
=
(
it_lower
-
1
)
->
t
();
double
v1
=
it_lower
->
v
();
double
t1
=
it_lower
->
t
();
return
common
::
math
::
lerp
(
v0
,
t0
,
v1
,
t1
,
t
);
}
}
// namespace planning
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录