Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
e0daa38a
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,发现更多精彩内容 >>
提交
e0daa38a
编写于
9月 12, 2018
作者:
L
Liangliang Zhang
提交者:
Jiangtao Hu
9月 12, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Planning: added planning data class.
上级
18575cd4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
48 deletion
+47
-48
modules/planning/planning_base.cc
modules/planning/planning_base.cc
+5
-5
modules/planning/planning_base.h
modules/planning/planning_base.h
+17
-13
modules/planning/planning_component.cc
modules/planning/planning_component.cc
+10
-4
modules/planning/planning_component.h
modules/planning/planning_component.h
+3
-2
modules/planning/std_planning.cc
modules/planning/std_planning.cc
+11
-17
modules/planning/std_planning.h
modules/planning/std_planning.h
+1
-7
未找到文件。
modules/planning/planning_base.cc
浏览文件 @
e0daa38a
...
...
@@ -36,14 +36,14 @@ PlanningBase::~PlanningBase() {}
void
PlanningBase
::
PublishPlanningPb
(
const
double
timestamp
,
ADCTrajectory
*
const
trajectory_pb
)
{
trajectory_pb
->
mutable_header
()
->
set_timestamp_sec
(
timestamp
);
if
(
p
rediction_obstacles_
!=
nullptr
&&
!
p
rediction_obstacles_
->
has_header
())
{
if
(
p
lanning_data_
.
prediction_obstacles
!=
nullptr
&&
!
p
lanning_data_
.
prediction_obstacles
->
has_header
())
{
trajectory_pb
->
mutable_header
()
->
set_lidar_timestamp
(
p
rediction_obstacles_
->
header
().
lidar_timestamp
());
p
lanning_data_
.
prediction_obstacles
->
header
().
lidar_timestamp
());
trajectory_pb
->
mutable_header
()
->
set_camera_timestamp
(
p
rediction_obstacles_
->
header
().
camera_timestamp
());
p
lanning_data_
.
prediction_obstacles
->
header
().
camera_timestamp
());
trajectory_pb
->
mutable_header
()
->
set_radar_timestamp
(
p
rediction_obstacles_
->
header
().
radar_timestamp
());
p
lanning_data_
.
prediction_obstacles
->
header
().
radar_timestamp
());
}
// TODO(all): integrate reverse gear
...
...
modules/planning/planning_base.h
浏览文件 @
e0daa38a
...
...
@@ -45,6 +45,19 @@
*/
namespace
apollo
{
namespace
planning
{
/**
* @class planning_data
*
* @brief PlanningData contains all necessary data as planning input
*/
struct
PlanningData
{
std
::
shared_ptr
<
prediction
::
PredictionObstacles
>
prediction_obstacles
;
std
::
shared_ptr
<
canbus
::
Chassis
>
chassis
;
std
::
shared_ptr
<
localization
::
LocalizationEstimate
>
localization_estimate
;
std
::
shared_ptr
<
perception
::
TrafficLightDetection
>
traffic_light
;
std
::
shared_ptr
<
routing
::
RoutingResponse
>
routing
;
};
/**
* @class planning
...
...
@@ -60,14 +73,7 @@ class PlanningBase {
virtual
std
::
string
Name
()
const
=
0
;
virtual
void
RunOnce
(
const
std
::
shared_ptr
<
prediction
::
PredictionObstacles
>&
prediction_obstacles
,
const
std
::
shared_ptr
<
canbus
::
Chassis
>&
chassis
,
const
std
::
shared_ptr
<
localization
::
LocalizationEstimate
>&
localization_estimate
,
const
perception
::
TrafficLightDetection
,
const
routing
::
RoutingResponse
&
routing
)
=
0
;
virtual
void
RunOnce
(
const
PlanningData
&
planning_data
)
=
0
;
/**
* @brief Plan the trajectory given current vehicle state
...
...
@@ -78,14 +84,12 @@ class PlanningBase {
ADCTrajectory
*
const
trajectory
)
=
0
;
protected:
void
PublishPlanningPb
(
const
double
timestamp
,
ADCTrajectory
*
const
trajectory_pb
);
void
PublishPlanningPb
(
const
double
timestamp
,
ADCTrajectory
*
const
trajectory_pb
);
void
SetFallbackTrajectory
(
ADCTrajectory
*
const
trajectory_pb
);
PlanningData
planning_data_
;
const
hdmap
::
HDMap
*
hdmap_
=
nullptr
;
const
std
::
shared_ptr
<
prediction
::
PredictionObstacles
>
prediction_obstacles_
;
const
std
::
shared_ptr
<
canbus
::
Chassis
>
chassis_
;
const
std
::
shared_ptr
<
localization
::
LocalizationEstimate
>
localization_estimate_
;
const
std
::
shared_ptr
<
ADCTrajectory
>
last_planning_
;
double
start_time_
=
0.0
;
...
...
modules/planning/planning_component.cc
浏览文件 @
e0daa38a
...
...
@@ -15,8 +15,8 @@
*****************************************************************************/
#include "modules/planning/planning_component.h"
#include "modules/planning/std_planning.h"
#include "modules/common/util/message_util.h"
#include "modules/planning/std_planning.h"
namespace
apollo
{
namespace
planning
{
...
...
@@ -44,6 +44,8 @@ bool PlanningComponent::Init() {
traffic_light_
.
CopyFrom
(
*
traffic_light
);
});
writer_
=
node_
->
CreateWriter
<
ADCTrajectory
>
(
"/apollo/planning"
);
return
true
;
}
...
...
@@ -53,15 +55,19 @@ bool PlanningComponent::Proc(
const
std
::
shared_ptr
<
canbus
::
Chassis
>&
chassis
,
const
std
::
shared_ptr
<
localization
::
LocalizationEstimate
>&
localization_estimate
)
{
routing
::
RoutingResponse
routing_copy
;
planning_data_
.
prediction_obstacles
=
prediction_obstacles
;
planning_data_
.
chassis
=
chassis
;
planning_data_
.
localization_estimate
=
localization_estimate
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
routing_copy
=
routing_
;
planning_data_
.
routing
=
std
::
make_shared
<
routing
::
RoutingResponse
>
(
routing_
);
}
perception
::
TrafficLightDetection
traffic_light_copy
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
traffic_light_copy
=
traffic_light_
;
planning_data_
.
traffic_light
=
std
::
make_shared
<
TrafficLightDetection
>
(
traffic_light_
);
}
ADCTrajectory
adc_trajectory_pb
;
...
...
modules/planning/planning_component.h
浏览文件 @
e0daa38a
...
...
@@ -64,13 +64,14 @@ class PlanningComponent final
perception
::
TrafficLightDetection
traffic_light_
;
routing
::
RoutingResponse
routing_
;
PlanningData
planning_data_
;
std
::
unique_ptr
<
PlanningBase
>
planning_base_
;
};
CYBERTRON_REGISTER_COMPONENT
(
PlanningComponent
)
}
// namespace planning
}
// name
ps
ace apollo
}
// name
sp
ace apollo
#endif // MODULES_PLANNING_PLANNING_COMPONENT_H_
modules/planning/std_planning.cc
浏览文件 @
e0daa38a
...
...
@@ -148,14 +148,7 @@ Status StdPlanning::InitFrame(const uint32_t sequence_num,
return
Status
::
OK
();
}
void
StdPlanning
::
RunOnce
(
const
std
::
shared_ptr
<
prediction
::
PredictionObstacles
>&
prediction_obstacles
,
const
std
::
shared_ptr
<
canbus
::
Chassis
>&
chassis
,
const
std
::
shared_ptr
<
localization
::
LocalizationEstimate
>&
localization_estimate
,
const
perception
::
TrafficLightDetection
,
const
routing
::
RoutingResponse
&
routing
)
{
void
StdPlanning
::
RunOnce
(
const
PlanningData
&
planning_data
)
{
const
double
start_timestamp
=
Clock
::
NowInSeconds
();
ADCTrajectory
not_ready_pb
;
...
...
@@ -163,11 +156,11 @@ void StdPlanning::RunOnce(
->
mutable_main_decision
()
->
mutable_not_ready
();
if
(
localization_estimate
==
nullptr
)
{
if
(
planning_data
.
localization_estimate
==
nullptr
)
{
not_ready
->
set_reason
(
"localization not ready"
);
}
else
if
(
chassis
==
nullptr
)
{
}
else
if
(
planning_data
.
chassis
==
nullptr
)
{
not_ready
->
set_reason
(
"chassis not ready"
);
}
else
if
(
!
routing
.
has_header
()
)
{
}
else
if
(
planning_data
.
routing
==
nullptr
)
{
not_ready
->
set_reason
(
"routing not ready"
);
}
else
if
(
HDMapUtil
::
BaseMapPtr
()
==
nullptr
)
{
not_ready
->
set_reason
(
"map not ready"
);
...
...
@@ -179,13 +172,14 @@ void StdPlanning::RunOnce(
}
// localization
ADEBUG
<<
"Get localization:"
<<
localization_estimate
->
DebugString
();
ADEBUG
<<
"Get localization:"
<<
planning_data
.
localization_estimate
->
DebugString
();
// chassis
ADEBUG
<<
"Get chassis:"
<<
chassis
->
DebugString
();
ADEBUG
<<
"Get chassis:"
<<
planning_data
.
chassis
->
DebugString
();
Status
status
=
VehicleStateProvider
::
Instance
()
->
Update
(
*
localization_estimate
,
*
chassis
);
*
planning_data
.
localization_estimate
,
*
planning_data
.
chassis
);
VehicleState
vehicle_state
=
VehicleStateProvider
::
Instance
()
->
vehicle_state
();
...
...
@@ -213,10 +207,10 @@ void StdPlanning::RunOnce(
return
;
}
if
(
IsDifferentRouting
(
last_routing_
,
routing
))
{
last_routing_
=
routing
;
if
(
IsDifferentRouting
(
last_routing_
,
*
planning_data
.
routing
))
{
last_routing_
=
*
planning_data
.
routing
;
GetPlanningStatus
()
->
Clear
();
reference_line_provider_
->
UpdateRoutingResponse
(
routing
);
reference_line_provider_
->
UpdateRoutingResponse
(
*
planning_data
.
routing
);
}
// Update reference line provider and reset pull over if necessary
...
...
modules/planning/std_planning.h
浏览文件 @
e0daa38a
...
...
@@ -60,13 +60,7 @@ class StdPlanning : public PlanningBase {
* @brief main logic of the planning module, runs periodically triggered by
* timer.
*/
void
RunOnce
(
const
std
::
shared_ptr
<
prediction
::
PredictionObstacles
>&
prediction_obstacles
,
const
std
::
shared_ptr
<
canbus
::
Chassis
>&
chassis
,
const
std
::
shared_ptr
<
localization
::
LocalizationEstimate
>&
localization_estimate
,
const
perception
::
TrafficLightDetection
,
const
routing
::
RoutingResponse
&
routing
)
override
;
void
RunOnce
(
const
PlanningData
&
planning_data
)
override
;
apollo
::
common
::
Status
Plan
(
const
double
current_time_stamp
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录