Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
3c77ff2f
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,发现更多精彩内容 >>
提交
3c77ff2f
编写于
8月 06, 2017
作者:
D
Dong Li
提交者:
Jiangtao Hu
8月 06, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: prepare planning_test_base for end-to-end planning integration tests
上级
0a2fbf32
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
36 deletion
+37
-36
modules/planning/integration_tests/planning_test_base.cc
modules/planning/integration_tests/planning_test_base.cc
+13
-23
modules/planning/integration_tests/planning_test_base.h
modules/planning/integration_tests/planning_test_base.h
+9
-0
modules/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
...les/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
+4
-3
modules/planning/planning.cc
modules/planning/planning.cc
+8
-7
modules/planning/planning.h
modules/planning/planning.h
+3
-3
未找到文件。
modules/planning/integration_tests/planning_test_base.cc
浏览文件 @
3c77ff2f
...
@@ -33,6 +33,7 @@ DEFINE_string(test_localization_file,
...
@@ -33,6 +33,7 @@ DEFINE_string(test_localization_file,
DEFINE_string
(
test_chassis_file
,
DEFINE_string
(
test_chassis_file
,
"modules/planning/testdata/garage_chassis.pb.txt"
,
"modules/planning/testdata/garage_chassis.pb.txt"
,
"The chassis test file"
);
"The chassis test file"
);
DEFINE_string
(
test_prediction_file
,
""
,
"The prediction module test file"
);
void
PlanningTestBase
::
SetDataConfigs
()
{
void
PlanningTestBase
::
SetDataConfigs
()
{
FLAGS_qp_spline_path_config_file
=
FLAGS_qp_spline_path_config_file
=
...
@@ -82,35 +83,24 @@ bool PlanningTestBase::SetUpAdapters() {
...
@@ -82,35 +83,24 @@ bool PlanningTestBase::SetUpAdapters() {
AERROR
<<
"Failed to load chassis file: "
<<
FLAGS_test_chassis_file
;
AERROR
<<
"Failed to load chassis file: "
<<
FLAGS_test_chassis_file
;
return
false
;
return
false
;
}
}
AdapterManager
::
Observe
();
if
(
!
FLAGS_test_prediction_file
.
empty
()
&&
AdapterManager
::
FeedPredictionFile
(
FLAGS_test_prediction_file
))
{
AERROR
<<
"Failed to load prediction file: "
<<
FLAGS_test_prediction_file
;
return
false
;
}
return
true
;
return
true
;
}
}
void
PlanningTestBase
::
SetUp
()
{
void
PlanningTestBase
::
SetUp
()
{
SetDataConfigs
();
SetDataConfigs
();
adc_trajectory_
=
nullptr
;
SetUpAdapters
();
planning_
.
Init
();
planning_
.
Init
();
if
(
!
SetUpAdapters
())
{
}
AERROR
<<
"Failed to setup adapters"
;
return
;
void
PlanningTestBase
::
RunPlanning
()
{
}
planning_
.
RunOnce
();
common
::
VehicleState
::
instance
()
->
Update
(
adc_trajectory_
=
AdapterManager
::
GetPlanning
()
->
GetLatestPublished
();
AdapterManager
::
GetLocalization
()
->
GetLatestObserved
(),
AdapterManager
::
GetChassis
()
->
GetLatestObserved
());
pose_
=
common
::
VehicleState
::
instance
()
->
pose
();
if
(
!
common
::
util
::
GetProtoFromFile
(
FLAGS_dp_poly_path_config_file
,
&
dp_poly_path_config_
))
{
AERROR
<<
"Failed to load file "
<<
FLAGS_dp_poly_path_config_file
;
return
;
}
if
(
!
common
::
util
::
GetProtoFromFile
(
FLAGS_dp_st_speed_config_file
,
&
dp_st_speed_config_
))
{
AERROR
<<
"Failed to load file "
<<
FLAGS_dp_st_speed_config_file
;
return
;
}
if
(
!
planning_
.
InitFrame
(
1
))
{
AERROR
<<
"planning init frame failed"
;
return
;
}
}
}
void
PlanningTestBase
::
export_sl_points
(
void
PlanningTestBase
::
export_sl_points
(
...
...
modules/planning/integration_tests/planning_test_base.h
浏览文件 @
3c77ff2f
...
@@ -37,6 +37,7 @@ using common::adapter::AdapterManager;
...
@@ -37,6 +37,7 @@ using common::adapter::AdapterManager;
DECLARE_string
(
test_routing_response_file
);
DECLARE_string
(
test_routing_response_file
);
DECLARE_string
(
test_localization_file
);
DECLARE_string
(
test_localization_file
);
DECLARE_string
(
test_chassis_file
);
DECLARE_string
(
test_chassis_file
);
DECLARE_string
(
test_prediction_file
);
class
PlanningTestBase
:
public
::
testing
::
Test
{
class
PlanningTestBase
:
public
::
testing
::
Test
{
public:
public:
...
@@ -56,6 +57,13 @@ class PlanningTestBase : public ::testing::Test {
...
@@ -56,6 +57,13 @@ class PlanningTestBase : public ::testing::Test {
virtual
void
SetDataConfigs
();
virtual
void
SetDataConfigs
();
virtual
void
SetUp
();
virtual
void
SetUp
();
/**
* Execute the planning code.
* @return true if planning is success. The ADCTrajectory will be used to
* store the planing results. Otherwise false.
*/
void
RunPlanning
();
/**
/**
* @brief Print out the points to a file for debug and visualization purpose.
* @brief Print out the points to a file for debug and visualization purpose.
* User can see the file, or feed it
* User can see the file, or feed it
...
@@ -74,6 +82,7 @@ class PlanningTestBase : public ::testing::Test {
...
@@ -74,6 +82,7 @@ class PlanningTestBase : public ::testing::Test {
DpStSpeedConfig
dp_st_speed_config_
;
DpStSpeedConfig
dp_st_speed_config_
;
localization
::
Pose
pose_
;
localization
::
Pose
pose_
;
Planning
planning_
;
Planning
planning_
;
ADCTrajectory
*
adc_trajectory_
=
nullptr
;
};
};
}
// namespace planning
}
// namespace planning
...
...
modules/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
浏览文件 @
3c77ff2f
...
@@ -67,6 +67,7 @@ class DpRoadGraphTest : public PlanningTestBase {
...
@@ -67,6 +67,7 @@ class DpRoadGraphTest : public PlanningTestBase {
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
google
::
InitGoogleLogging
(
"DpRoadGraphTest"
);
google
::
InitGoogleLogging
(
"DpRoadGraphTest"
);
PlanningTestBase
::
SetUp
();
PlanningTestBase
::
SetUp
();
RunPlanning
();
SetInitPoint
();
SetInitPoint
();
SetSpeedDataWithConstVeolocity
(
10.0
);
SetSpeedDataWithConstVeolocity
(
10.0
);
const
auto
*
frame
=
planning_
.
GetFrame
();
const
auto
*
frame
=
planning_
.
GetFrame
();
...
@@ -86,9 +87,9 @@ TEST_F(DpRoadGraphTest, speed_road_graph) {
...
@@ -86,9 +87,9 @@ TEST_F(DpRoadGraphTest, speed_road_graph) {
ASSERT_TRUE
(
reference_line_
!=
nullptr
);
ASSERT_TRUE
(
reference_line_
!=
nullptr
);
bool
result
=
road_graph
.
FindPathTunnel
(
init_point_
,
&
path_data_
);
bool
result
=
road_graph
.
FindPathTunnel
(
init_point_
,
&
path_data_
);
EXPECT_TRUE
(
result
);
EXPECT_TRUE
(
result
);
EXPECT_EQ
(
648
,
path_data_
.
discretized_path
().
num_of_points
());
EXPECT_EQ
(
765
,
path_data_
.
discretized_path
().
num_of_points
());
EXPECT_EQ
(
648
,
path_data_
.
frenet_frame_path
().
number_of_points
());
EXPECT_EQ
(
765
,
path_data_
.
frenet_frame_path
().
number_of_points
());
EXPECT_FLOAT_EQ
(
7
0.450378
,
EXPECT_FLOAT_EQ
(
7
5.900002
,
path_data_
.
frenet_frame_path
().
points
().
back
().
s
());
path_data_
.
frenet_frame_path
().
points
().
back
().
s
());
EXPECT_FLOAT_EQ
(
0.0
,
path_data_
.
frenet_frame_path
().
points
().
back
().
l
());
EXPECT_FLOAT_EQ
(
0.0
,
path_data_
.
frenet_frame_path
().
points
().
back
().
l
());
// export_path_data(path_data_, "/tmp/path.txt");
// export_path_data(path_data_, "/tmp/path.txt");
...
...
modules/planning/planning.cc
浏览文件 @
3c77ff2f
...
@@ -88,7 +88,9 @@ Status Planning::Init() {
...
@@ -88,7 +88,9 @@ Status Planning::Init() {
"failed to load planning config file: "
+
FLAGS_planning_config_file
);
"failed to load planning config file: "
+
FLAGS_planning_config_file
);
}
}
AdapterManager
::
Init
(
FLAGS_adapter_config_path
);
if
(
!
AdapterManager
::
Initialized
())
{
AdapterManager
::
Init
(
FLAGS_adapter_config_path
);
}
if
(
AdapterManager
::
GetLocalization
()
==
nullptr
)
{
if
(
AdapterManager
::
GetLocalization
()
==
nullptr
)
{
std
::
string
error_msg
(
"Localization is not registered"
);
std
::
string
error_msg
(
"Localization is not registered"
);
AERROR
<<
error_msg
;
AERROR
<<
error_msg
;
...
@@ -195,7 +197,8 @@ void Planning::RunOnce() {
...
@@ -195,7 +197,8 @@ void Planning::RunOnce() {
const
double
time_diff_ms
=
(
end_timestamp
-
start_timestamp
)
*
1000
;
const
double
time_diff_ms
=
(
end_timestamp
-
start_timestamp
)
*
1000
;
auto
trajectory_pb
=
frame_
->
MutableADCTrajectory
();
auto
trajectory_pb
=
frame_
->
MutableADCTrajectory
();
trajectory_pb
->
mutable_latency_stats
()
->
set_total_time_ms
(
time_diff_ms
);
trajectory_pb
->
mutable_latency_stats
()
->
set_total_time_ms
(
time_diff_ms
);
ADEBUG
<<
"Planning latency: "
<<
trajectory_pb
->
latency_stats
().
DebugString
();
ADEBUG
<<
"Planning latency: "
<<
trajectory_pb
->
latency_stats
().
DebugString
();
if
(
res_planning
)
{
if
(
res_planning
)
{
AdapterManager
::
FillPlanningHeader
(
"planning"
,
trajectory_pb
);
AdapterManager
::
FillPlanningHeader
(
"planning"
,
trajectory_pb
);
...
@@ -211,10 +214,8 @@ void Planning::RunOnce() {
...
@@ -211,10 +214,8 @@ void Planning::RunOnce() {
void
Planning
::
Stop
()
{}
void
Planning
::
Stop
()
{}
bool
Planning
::
Plan
(
const
bool
is_on_auto_mode
,
bool
Planning
::
Plan
(
const
bool
is_on_auto_mode
,
const
double
current_time_stamp
,
const
double
current_time_stamp
,
const
double
planning_cycle_time
)
{
const
double
planning_cycle_time
)
{
const
auto
&
stitching_trajectory
=
const
auto
&
stitching_trajectory
=
TrajectoryStitcher
::
compute_stitching_trajectory
(
TrajectoryStitcher
::
compute_stitching_trajectory
(
is_on_auto_mode
,
current_time_stamp
,
planning_cycle_time
,
is_on_auto_mode
,
current_time_stamp
,
planning_cycle_time
,
...
@@ -223,8 +224,8 @@ bool Planning::Plan(const bool is_on_auto_mode,
...
@@ -223,8 +224,8 @@ bool Planning::Plan(const bool is_on_auto_mode,
frame_
->
SetPlanningStartPoint
(
stitching_trajectory
.
back
());
frame_
->
SetPlanningStartPoint
(
stitching_trajectory
.
back
());
PublishableTrajectory
publishable_trajectory
;
PublishableTrajectory
publishable_trajectory
;
auto
status
=
planner_
->
Plan
(
stitching_trajectory
.
back
(),
auto
status
=
planner_
->
Plan
(
stitching_trajectory
.
back
(),
frame_
.
get
(),
frame_
.
get
(),
&
publishable_trajectory
);
&
publishable_trajectory
);
if
(
status
!=
Status
::
OK
())
{
if
(
status
!=
Status
::
OK
())
{
AERROR
<<
"planner failed to make a driving plan"
;
AERROR
<<
"planner failed to make a driving plan"
;
...
...
modules/planning/planning.h
浏览文件 @
3c77ff2f
...
@@ -75,17 +75,17 @@ class Planning : public apollo::common::ApolloApp {
...
@@ -75,17 +75,17 @@ class Planning : public apollo::common::ApolloApp {
* @brief Plan the trajectory given current vehicle state
* @brief Plan the trajectory given current vehicle state
* @param is_on_auto_mode whether the current system is on auto-driving mode
* @param is_on_auto_mode whether the current system is on auto-driving mode
*/
*/
bool
Plan
(
const
bool
is_on_auto_mode
,
bool
Plan
(
const
bool
is_on_auto_mode
,
const
double
current_time_stamp
,
const
double
current_time_stamp
,
const
double
planning_cycle_time
);
const
double
planning_cycle_time
);
const
Frame
*
GetFrame
()
const
;
const
Frame
*
GetFrame
()
const
;
const
hdmap
::
PncMap
*
GetPncMap
()
const
;
const
hdmap
::
PncMap
*
GetPncMap
()
const
;
bool
InitFrame
(
const
uint32_t
sequence_num
);
bool
InitFrame
(
const
uint32_t
sequence_num
);
void
RunOnce
();
private:
private:
void
RegisterPlanners
();
void
RegisterPlanners
();
void
RunOnce
();
apollo
::
common
::
util
::
Factory
<
PlanningConfig
::
PlannerType
,
Planner
>
apollo
::
common
::
util
::
Factory
<
PlanningConfig
::
PlannerType
,
Planner
>
planner_factory_
;
planner_factory_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录