Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
0edf54f0
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,发现更多精彩内容 >>
提交
0edf54f0
编写于
7月 17, 2017
作者:
C
Calvin Miao
浏览文件
操作
浏览文件
下载
差异文件
Added lint support for prediction module
上级
ed540f7f
8420ea97
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
285 addition
and
0 deletion
+285
-0
modules/planning/math/BUILD
modules/planning/math/BUILD
+18
-0
modules/planning/math/double.cc
modules/planning/math/double.cc
+160
-0
modules/planning/math/double.h
modules/planning/math/double.h
+78
-0
modules/prediction/container/obstacles/obstacle.cc
modules/prediction/container/obstacles/obstacle.cc
+21
-0
modules/prediction/container/obstacles/obstacle.h
modules/prediction/container/obstacles/obstacle.h
+8
-0
未找到文件。
modules/planning/math/BUILD
0 → 100644
浏览文件 @
0edf54f0
load
(
"//tools:cpplint.bzl"
,
"cpplint"
)
package
(
default_visibility
=
[
"//visibility:public"
])
cc_library
(
name
=
"double"
,
srcs
=
[
"double.cc"
,
],
hdrs
=
glob
([
"double.h"
,
]),
deps
=
[
"@glog//:glog"
,
],
)
cpplint
()
modules/planning/math/double.cc
0 → 100644
浏览文件 @
0edf54f0
/******************************************************************************
* Copyright 2017 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.
*****************************************************************************/
#include "modules/planning/math/double.h"
#include <cmath>
#include "glog/logging.h"
namespace
apollo
{
namespace
planning
{
Double
::
Double
(
const
double
value
)
:
value_
(
value
)
{
CHECK
(
!
std
::
isnan
(
value
));
}
double
Double
::
value
()
const
{
return
value_
;
}
int
Double
::
compare
(
const
double
d1
,
const
double
d2
,
const
double
epsilon
)
{
CHECK
(
!
std
::
isnan
(
d1
));
CHECK
(
!
std
::
isnan
(
d2
));
if
(
definitely_greater_than
(
d1
,
d2
,
epsilon
))
{
return
1
;
}
else
if
(
definitely_less_than
(
d1
,
d2
,
epsilon
))
{
return
-
1
;
}
else
{
return
0
;
}
}
int
Double
::
compare
(
const
double
d1
,
const
double
d2
)
{
return
compare
(
d1
,
d2
,
kEpsilon_
);
}
int
Double
::
compare
(
const
Double
&
d1
,
const
Double
&
d2
,
const
double
epsilon
)
{
return
compare
(
d1
.
value
(),
d2
.
value
(),
epsilon
);
}
int
Double
::
compare
(
const
Double
&
d1
,
const
Double
&
d2
)
{
return
compare
(
d1
.
value
(),
d2
.
value
());
}
Double
Double
::
sqrt
(
const
Double
&
d1
)
{
return
Double
(
std
::
sqrt
(
d1
.
value
()));
}
int
Double
::
compare_to
(
const
double
d1
,
const
double
epsilon
)
const
{
CHECK
(
!
std
::
isnan
(
d1
));
if
(
definitely_greater_than
(
value_
,
d1
,
epsilon
))
{
return
1
;
}
else
if
(
definitely_less_than
(
value_
,
d1
,
epsilon
))
{
return
-
1
;
}
else
{
return
0
;
}
}
int
Double
::
compare_to
(
const
double
d1
)
const
{
return
compare_to
(
d1
,
kEpsilon_
);
}
int
Double
::
compare_to
(
const
Double
&
d1
,
const
double
epsilon
)
const
{
return
compare_to
(
d1
.
value
(),
epsilon
);
}
int
Double
::
compare_to
(
const
Double
&
d1
)
const
{
return
compare_to
(
d1
.
value
(),
kEpsilon_
);
}
Double
&
Double
::
operator
=
(
const
Double
&
other
)
{
value_
=
other
.
value
();
return
*
this
;
}
Double
Double
::
operator
+
(
const
Double
&
other
)
const
{
return
Double
(
value_
+
other
.
value
());
}
Double
Double
::
operator
-
(
const
Double
&
other
)
const
{
return
Double
(
value_
-
other
.
value
());
}
Double
Double
::
operator
*
(
const
Double
&
other
)
const
{
return
Double
(
value_
*
other
.
value
());
}
Double
Double
::
operator
/
(
const
Double
&
other
)
const
{
return
Double
(
value_
/
other
.
value
());
}
Double
&
Double
::
operator
+=
(
const
Double
&
other
)
{
value_
+=
other
.
value
();
return
*
this
;
}
Double
&
Double
::
operator
-=
(
const
Double
&
other
)
{
value_
-=
other
.
value
();
return
*
this
;
}
Double
&
Double
::
operator
*=
(
const
Double
&
other
)
{
value_
*=
other
.
value
();
return
*
this
;
}
Double
&
Double
::
operator
/=
(
const
Double
&
other
)
{
value_
/=
other
.
value
();
return
*
this
;
}
bool
Double
::
operator
>
(
const
Double
&
other
)
const
{
return
definitely_greater_than
(
value_
,
other
.
value
(),
kEpsilon_
);
}
bool
Double
::
operator
>=
(
const
Double
&
other
)
const
{
return
!
((
*
this
)
<
other
);
}
bool
Double
::
operator
<
(
const
Double
&
other
)
const
{
return
definitely_less_than
(
value_
,
other
.
value
(),
kEpsilon_
);
}
bool
Double
::
operator
<=
(
const
Double
&
other
)
const
{
return
!
((
*
this
)
>
other
);
}
bool
Double
::
operator
==
(
const
Double
&
other
)
const
{
return
essentially_equal
(
value_
,
other
.
value
(),
kEpsilon_
);
}
bool
Double
::
approximately_equal
(
double
a
,
double
b
,
double
epsilon
)
{
return
std
::
fabs
(
a
-
b
)
<=
std
::
fmax
(
std
::
fabs
(
a
),
std
::
fabs
(
b
))
*
epsilon
;
}
bool
Double
::
essentially_equal
(
double
a
,
double
b
,
double
epsilon
)
{
return
std
::
fabs
(
a
-
b
)
<=
std
::
fmin
(
std
::
fabs
(
a
),
std
::
fabs
(
b
))
*
epsilon
;
}
bool
Double
::
definitely_greater_than
(
double
a
,
double
b
,
double
epsilon
)
{
return
(
a
-
b
)
>
std
::
fmax
(
std
::
fabs
(
a
),
std
::
fabs
(
b
))
*
epsilon
;
}
bool
Double
::
definitely_less_than
(
double
a
,
double
b
,
double
epsilon
)
{
return
(
b
-
a
)
>
std
::
fmax
(
std
::
fabs
(
a
),
std
::
fabs
(
b
))
*
epsilon
;
}
}
// namespace planning
}
// namespace apollo
modules/planning/math/double.h
0 → 100644
浏览文件 @
0edf54f0
/******************************************************************************
* Copyright 2017 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.
*****************************************************************************/
/**
* @file double.h
**/
#ifndef MODULES_PLANNING_MATH_DOUBLE_H_
#define MODULES_PLANNING_MATH_DOUBLE_H_
#include <cmath>
#include <limits>
namespace
apollo
{
namespace
planning
{
class
Double
{
public:
explicit
Double
(
const
double
value
);
~
Double
()
=
default
;
double
value
()
const
;
static
int
compare
(
const
double
d1
,
const
double
d2
,
const
double
epsilon
);
static
int
compare
(
const
double
d1
,
const
double
d2
);
static
int
compare
(
const
Double
&
d1
,
const
Double
&
d2
,
const
double
epsilon
);
static
int
compare
(
const
Double
&
d1
,
const
Double
&
d2
);
static
Double
sqrt
(
const
Double
&
d1
);
int
compare_to
(
const
double
d1
,
const
double
epsilon
)
const
;
int
compare_to
(
const
double
d1
)
const
;
int
compare_to
(
const
Double
&
d1
,
const
double
epsilon
)
const
;
int
compare_to
(
const
Double
&
d1
)
const
;
Double
operator
+
(
const
Double
&
other
)
const
;
Double
operator
-
(
const
Double
&
other
)
const
;
Double
operator
*
(
const
Double
&
other
)
const
;
Double
operator
/
(
const
Double
&
other
)
const
;
Double
&
operator
=
(
const
Double
&
other
);
Double
&
operator
+=
(
const
Double
&
other
);
Double
&
operator
-=
(
const
Double
&
other
);
Double
&
operator
*=
(
const
Double
&
other
);
Double
&
operator
/=
(
const
Double
&
other
);
bool
operator
>
(
const
Double
&
other
)
const
;
bool
operator
>=
(
const
Double
&
other
)
const
;
bool
operator
<
(
const
Double
&
other
)
const
;
bool
operator
<=
(
const
Double
&
other
)
const
;
bool
operator
==
(
const
Double
&
other
)
const
;
private:
double
value_
=
0.0
;
static
constexpr
double
kEpsilon_
=
std
::
numeric_limits
<
double
>::
epsilon
();
static
bool
approximately_equal
(
double
a
,
double
b
,
double
epsilon
);
static
bool
essentially_equal
(
double
a
,
double
b
,
double
epsilon
);
static
bool
definitely_greater_than
(
double
a
,
double
b
,
double
epsilon
);
static
bool
definitely_less_than
(
double
a
,
double
b
,
double
epsilon
);
};
}
// namespace planning
}
// namespace apollo
#endif // MODULES_PLANNING_PLANNER_FACTORY_H_
modules/prediction/container/obstacles/obstacle.cc
浏览文件 @
0edf54f0
...
...
@@ -138,6 +138,11 @@ void Obstacle::Insert(const PerceptionObstacle& perception_obstacle,
InitKFMotionTracker
(
&
feature
);
}
UpdateKFMotionTracker
(
&
feature
);
SetCurrentLanes
(
&
feature
);
SetNearbyLanes
(
&
feature
);
UpdateKFLaneTrackers
(
&
feature
);
InsertFeatureToHistory
(
&
feature
);
SetMotionStatus
();
}
ErrorCode
Obstacle
::
SetId
(
const
PerceptionObstacle
&
perception_obstacle
,
...
...
@@ -595,5 +600,21 @@ void Obstacle::UpdateLaneBelief(Feature* feature) {
<<
" and tracked acc ["
<<
lane_acc
<<
"]"
;
}
void
Obstacle
::
SetCurrentLanes
(
Feature
*
feature
)
{
// TODO(kechxu) implement
}
void
Obstacle
::
SetNearbyLanes
(
Feature
*
feature
)
{
// TODO(kechxu) implement
}
void
Obstacle
::
SetMotionStatus
()
{
// TODO(kechxu) implement
}
void
Obstacle
::
InsertFeatureToHistory
(
Feature
*
feature
)
{
// TODO(kechxu) implement
}
}
// namespace prediction
}
// namespace apollo
modules/prediction/container/obstacles/obstacle.h
浏览文件 @
0edf54f0
...
...
@@ -115,6 +115,14 @@ class Obstacle {
void
UpdateLaneBelief
(
Feature
*
feature
);
void
SetCurrentLanes
(
Feature
*
feature
);
void
SetNearbyLanes
(
Feature
*
feature
);
void
SetMotionStatus
();
void
InsertFeatureToHistory
(
Feature
*
feature
);
private:
int
id_
;
apollo
::
perception
::
PerceptionObstacle
::
Type
type_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录