Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
c9b4769f
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,发现更多精彩内容 >>
提交
c9b4769f
编写于
8月 02, 2017
作者:
K
kechxu
提交者:
Calvin Miao
8月 02, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add unit test for obstacles_container.cc
上级
00cc3323
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
237 addition
and
0 deletion
+237
-0
modules/prediction/container/obstacles/BUILD
modules/prediction/container/obstacles/BUILD
+19
-0
modules/prediction/container/obstacles/obstacle.cc
modules/prediction/container/obstacles/obstacle.cc
+4
-0
modules/prediction/container/obstacles/obstacle.h
modules/prediction/container/obstacles/obstacle.h
+2
-0
modules/prediction/container/obstacles/obstacles_container_test.cc
...rediction/container/obstacles/obstacles_container_test.cc
+86
-0
modules/prediction/proto/fnn_model_base.proto
modules/prediction/proto/fnn_model_base.proto
+1
-0
modules/prediction/testdata/perception_vehicles_pedestrians.pb.txt
...rediction/testdata/perception_vehicles_pedestrians.pb.txt
+125
-0
未找到文件。
modules/prediction/container/obstacles/BUILD
浏览文件 @
c9b4769f
...
@@ -34,4 +34,23 @@ cc_library(
...
@@ -34,4 +34,23 @@ cc_library(
],
],
)
)
cc_test
(
name
=
"obstacles_container_test"
,
size
=
"small"
,
srcs
=
[
"obstacles_container_test.cc"
,
],
data
=
[
"//modules/prediction:prediction_data"
,
"//modules/prediction:prediction_testdata"
,
],
deps
=
[
"//modules/prediction/container/obstacles:obstacles_container"
,
"@gtest//:main"
,
"//modules/prediction/common:prediction_gflags"
,
"//modules/perception/proto:perception_proto"
,
"//modules/common/util:util"
,
],
)
cpplint
()
cpplint
()
modules/prediction/container/obstacles/obstacle.cc
浏览文件 @
c9b4769f
...
@@ -70,6 +70,10 @@ Obstacle::~Obstacle() {
...
@@ -70,6 +70,10 @@ Obstacle::~Obstacle() {
current_lanes_
.
clear
();
current_lanes_
.
clear
();
}
}
PerceptionObstacle
::
Type
Obstacle
::
type
()
const
{
return
type_
;
}
int
Obstacle
::
id
()
const
{
int
Obstacle
::
id
()
const
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
return
id_
;
return
id_
;
...
...
modules/prediction/container/obstacles/obstacle.h
浏览文件 @
c9b4769f
...
@@ -47,6 +47,8 @@ class Obstacle {
...
@@ -47,6 +47,8 @@ class Obstacle {
void
Insert
(
const
apollo
::
perception
::
PerceptionObstacle
&
perception_obstacle
,
void
Insert
(
const
apollo
::
perception
::
PerceptionObstacle
&
perception_obstacle
,
const
double
timestamp
);
const
double
timestamp
);
apollo
::
perception
::
PerceptionObstacle
::
Type
type
()
const
;
int
id
()
const
;
int
id
()
const
;
double
timestamp
()
const
;
double
timestamp
()
const
;
...
...
modules/prediction/container/obstacles/obstacles_container_test.cc
0 → 100644
浏览文件 @
c9b4769f
/******************************************************************************
* 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/prediction/container/obstacles/obstacles_container.h"
#include <string>
#include "gtest/gtest.h"
#include "modules/perception/proto/perception_obstacle.pb.h"
#include "modules/prediction/common/prediction_gflags.h"
#include "modules/common/util/file.h"
#include "modules/prediction/container/obstacles/obstacle.h"
namespace
apollo
{
namespace
prediction
{
class
ObstaclesContainerTest
:
public
::
testing
::
Test
{
public:
virtual
void
SetUp
()
{
std
::
string
file
=
"modules/prediction/testdata/perception_vehicles_pedestrians.pb.txt"
;
apollo
::
perception
::
PerceptionObstacles
perception_obstacles
;
apollo
::
common
::
util
::
GetProtoFromFile
(
file
,
&
perception_obstacles
);
FLAGS_map_file
=
"modules/prediction/testdata/kml_map.bin"
;
container_
.
Insert
(
perception_obstacles
);
}
protected:
ObstaclesContainer
container_
;
};
TEST_F
(
ObstaclesContainerTest
,
Vehicles
)
{
Obstacle
*
obstacle_ptr0
=
container_
.
GetObstacle
(
0
);
EXPECT_TRUE
(
obstacle_ptr0
!=
nullptr
);
EXPECT_EQ
(
obstacle_ptr0
->
id
(),
0
);
EXPECT_EQ
(
obstacle_ptr0
->
type
(),
apollo
::
perception
::
PerceptionObstacle
::
VEHICLE
);
Obstacle
*
obstacle_ptr1
=
container_
.
GetObstacle
(
1
);
EXPECT_TRUE
(
obstacle_ptr1
!=
nullptr
);
EXPECT_EQ
(
obstacle_ptr1
->
id
(),
1
);
EXPECT_EQ
(
obstacle_ptr1
->
type
(),
apollo
::
perception
::
PerceptionObstacle
::
VEHICLE
);
Obstacle
*
obstacle_ptr2
=
container_
.
GetObstacle
(
2
);
EXPECT_TRUE
(
obstacle_ptr2
!=
nullptr
);
EXPECT_EQ
(
obstacle_ptr2
->
id
(),
2
);
EXPECT_EQ
(
obstacle_ptr2
->
type
(),
apollo
::
perception
::
PerceptionObstacle
::
VEHICLE
);
Obstacle
*
obstacle_ptr3
=
container_
.
GetObstacle
(
3
);
EXPECT_TRUE
(
obstacle_ptr3
!=
nullptr
);
EXPECT_EQ
(
obstacle_ptr3
->
id
(),
3
);
EXPECT_EQ
(
obstacle_ptr3
->
type
(),
apollo
::
perception
::
PerceptionObstacle
::
VEHICLE
);
Obstacle
*
obstacle_ptr4
=
container_
.
GetObstacle
(
4
);
EXPECT_TRUE
(
obstacle_ptr4
==
nullptr
);
}
TEST_F
(
ObstaclesContainerTest
,
Pedestrian
)
{
Obstacle
*
obstacle_ptr101
=
container_
.
GetObstacle
(
101
);
EXPECT_TRUE
(
obstacle_ptr101
!=
nullptr
);
EXPECT_EQ
(
obstacle_ptr101
->
id
(),
101
);
EXPECT_EQ
(
obstacle_ptr101
->
type
(),
apollo
::
perception
::
PerceptionObstacle
::
PEDESTRIAN
);
Obstacle
*
obstacle_ptr102
=
container_
.
GetObstacle
(
102
);
EXPECT_TRUE
(
obstacle_ptr102
!=
nullptr
);
EXPECT_EQ
(
obstacle_ptr102
->
id
(),
102
);
EXPECT_EQ
(
obstacle_ptr102
->
type
(),
apollo
::
perception
::
PerceptionObstacle
::
PEDESTRIAN
);
Obstacle
*
obstacle_ptr103
=
container_
.
GetObstacle
(
103
);
EXPECT_TRUE
(
obstacle_ptr103
==
nullptr
);
}
}
// namespace prediction
}
// namespace apollo
modules/prediction/proto/fnn_model_base.proto
浏览文件 @
c9b4769f
...
@@ -20,5 +20,6 @@ message Layer {
...
@@ -20,5 +20,6 @@ message Layer {
optional
int32
layer_output_dim
=
2
;
optional
int32
layer_output_dim
=
2
;
optional
Matrix
layer_input_weight
=
3
;
// weight matrix of |input_dim| x |output_dim|
optional
Matrix
layer_input_weight
=
3
;
// weight matrix of |input_dim| x |output_dim|
optional
Vector
layer_bias
=
4
;
// vector of bias, size of |output_dim|
optional
Vector
layer_bias
=
4
;
// vector of bias, size of |output_dim|
optional
string
layer_activation_type
=
5
[
deprecated
=
true
];
optional
ActivationFunc
layer_activation_func
=
6
;
optional
ActivationFunc
layer_activation_func
=
6
;
}
}
modules/prediction/testdata/perception_vehicles_pedestrians.pb.txt
0 → 100644
浏览文件 @
c9b4769f
header {
timestamp_sec: 1501183430.161906
module_name: "perception"
sequence_num: 15839
}
perception_obstacle {
id: 0
position {
x: -449.952,
y: -161.917,
z: 0.0
}
theta: -0.349
velocity {
x: 18.794
y: -6.839
z: 0
}
length: 4
width: 2
height: 1
tracking_time: 1
type: VEHICLE
timestamp: 1501183430.1619561
}
perception_obstacle {
id: 1
position {
x: -458.941,
y: -159.240,
z: 0.0
}
theta: -0.349
velocity {
x: 18.794
y: -6.839
z: 0
}
length: 4
width: 2
height: 1
tracking_time: 1
type: VEHICLE
timestamp: 1501183430.1619561
}
perception_obstacle {
id: 2
position {
x: -469.239,
y: -156.665,
z: 0.0
}
theta: -0.349
velocity {
x: 18.794
y: -6.839
z: 0
}
length: 4
width: 2
height: 1
tracking_time: 1
type: VEHICLE
timestamp: 1501183430.1619561
}
perception_obstacle {
id: 3
position {
x: -461.000,
y: -155.018,
z: 0.0
}
theta: -0.349
velocity {
x: 18.794
y: -6.839
z: 0
}
length: 4
width: 2
height: 1
tracking_time: 1
type: VEHICLE
timestamp: 1501183430.1619561
}
perception_obstacle {
id: 101
position {
x: -438.879,
y: -161.931,
z: 0.0
}
theta: 1.222
velocity {
x: 1.710
y: 4.699
z: 0
}
length: 0.5
width: 0.5
height: 1.8
tracking_time: 1
type: PEDESTRIAN
timestamp: 1501183430.161906
}
perception_obstacle {
id: 102
position {
x: -411.557,
y: -182.382,
z: 0.0
}
theta: -0.200
velocity {
x: 0.001
y: 0.001
z: 0
}
length: 0.5
width: 0.5
height: 1.6
tracking_time: 1
type: PEDESTRIAN
timestamp: 1501183430.161906
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录