Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
d707ca95
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,发现更多精彩内容 >>
提交
d707ca95
编写于
9月 19, 2018
作者:
S
siyangy
提交者:
Liangliang Zhang
9月 19, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Switch unit test in simulation mode (#326)
上级
73db043d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
16 addition
and
38 deletion
+16
-38
modules/dreamview/backend/sim_control/sim_control_test.cc
modules/dreamview/backend/sim_control/sim_control_test.cc
+12
-29
modules/dreamview/backend/simulation_world/simulation_world_service_test.cc
...backend/simulation_world/simulation_world_service_test.cc
+4
-9
未找到文件。
modules/dreamview/backend/sim_control/sim_control_test.cc
浏览文件 @
d707ca95
...
...
@@ -18,6 +18,8 @@
#include <cmath>
#include "cybertron/blocker/blocker_manager.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
...
...
@@ -32,6 +34,7 @@ using apollo::common::time::Clock;
using
apollo
::
localization
::
LocalizationEstimate
;
using
apollo
::
planning
::
ADCTrajectory
;
using
apollo
::
routing
::
RoutingResponse
;
using
apollo
::
cybertron
::
blocker
::
BlockerManager
;
namespace
apollo
{
namespace
dreamview
{
...
...
@@ -39,8 +42,7 @@ namespace dreamview {
class
SimControlTest
:
public
::
testing
::
Test
{
public:
static
void
SetUpTestCase
()
{
// init cybertron framework
apollo
::
cybertron
::
Init
(
"simulation_world_service_test"
);
cybertron
::
GlobalData
::
Instance
()
->
EnableSimulationMode
();
}
virtual
void
SetUp
()
{
...
...
@@ -49,19 +51,9 @@ class SimControlTest : public ::testing::Test {
map_service_
.
reset
(
new
MapService
(
false
));
sim_control_
.
reset
(
new
SimControl
(
map_service_
.
get
()));
node_
=
cybertron
::
CreateNode
(
"sim_control_test"
);
chassis_reader_
=
node_
->
CreateReader
<
Chassis
>
(
FLAGS_chassis_topic
);
localization_reader_
=
node_
->
CreateReader
<
LocalizationEstimate
>
(
FLAGS_localization_topic
);
}
protected:
std
::
shared_ptr
<
cybertron
::
Node
>
node_
;
std
::
shared_ptr
<
cybertron
::
Reader
<
Chassis
>>
chassis_reader_
;
std
::
shared_ptr
<
cybertron
::
Reader
<
LocalizationEstimate
>>
localization_reader_
;
std
::
unique_ptr
<
MapService
>
map_service_
;
std
::
unique_ptr
<
SimControl
>
sim_control_
;
};
...
...
@@ -124,23 +116,14 @@ TEST_F(SimControlTest, Test) {
Clock
::
SetNow
(
timestamp
.
time_since_epoch
());
sim_control_
->
RunOnce
();
node_
->
Observe
();
int32_t
count
=
100
;
while
(
count
--
>
0
&&
nullptr
==
chassis_reader_
->
GetLatestObserved
())
{
usleep
(
10000
);
continue
;
}
count
=
100
;
while
(
count
--
>
0
&&
nullptr
==
localization_reader_
->
GetLatestObserved
())
{
usleep
(
10000
);
continue
;
}
const
auto
chassis
=
chassis_reader_
->
GetLatestObserved
();
const
auto
localization
=
localization_reader_
->
GetLatestObserved
();
ASSERT_TRUE
(
chassis
!=
nullptr
);
ASSERT_TRUE
(
localization
!=
nullptr
);
BlockerManager
::
Instance
()
->
Observe
();
auto
localization
=
BlockerManager
::
Instance
()
->
GetBlocker
<
LocalizationEstimate
>
(
FLAGS_localization_topic
)
->
GetLatestObservedPtr
();
auto
chassis
=
BlockerManager
::
Instance
()
->
GetBlocker
<
Chassis
>
(
FLAGS_chassis_topic
)
->
GetLatestObservedPtr
();
EXPECT_TRUE
(
chassis
->
engine_started
());
EXPECT_EQ
(
Chassis
::
COMPLETE_AUTO_DRIVE
,
chassis
->
driving_mode
());
...
...
modules/dreamview/backend/simulation_world/simulation_world_service_test.cc
浏览文件 @
d707ca95
...
...
@@ -27,6 +27,8 @@
using
apollo
::
canbus
::
Chassis
;
using
apollo
::
common
::
TrajectoryPoint
;
using
apollo
::
common
::
monitor
::
MonitorMessage
;
using
apollo
::
common
::
util
::
StrCat
;
using
apollo
::
cybertron
::
blocker
::
BlockerManager
;
using
apollo
::
localization
::
LocalizationEstimate
;
using
apollo
::
perception
::
PerceptionObstacle
;
using
apollo
::
perception
::
PerceptionObstacles
;
...
...
@@ -35,8 +37,6 @@ using apollo::planning::DecisionResult;
using
apollo
::
prediction
::
PredictionObstacle
;
using
apollo
::
prediction
::
PredictionObstacles
;
using
apollo
::
common
::
util
::
StrCat
;
namespace
apollo
{
namespace
dreamview
{
...
...
@@ -45,8 +45,7 @@ const float kEpsilon = 0.01;
class
SimulationWorldServiceTest
:
public
::
testing
::
Test
{
public:
static
void
SetUpTestCase
()
{
// init cybertron framework
apollo
::
cybertron
::
Init
(
"simulation_world_service_test"
);
cybertron
::
GlobalData
::
Instance
()
->
EnableSimulationMode
();
}
virtual
void
SetUp
()
{
...
...
@@ -454,11 +453,7 @@ TEST_F(SimulationWorldServiceTest, UpdateRouting) {
sim_world_service_
.
reset
(
new
SimulationWorldService
(
map_service_
.
get
(),
true
));
// Wait until the message has been published
while
(
sim_world_service_
->
routing_response_reader_
->
Empty
())
{
sleep
(
1
);
sim_world_service_
->
routing_response_reader_
->
Observe
();
}
BlockerManager
::
Instance
()
->
Observe
();
sim_world_service_
->
UpdateWithLatestObserved
(
sim_world_service_
->
routing_response_reader_
.
get
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录