Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
235c7dff
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,发现更多精彩内容 >>
提交
235c7dff
编写于
8月 02, 2017
作者:
D
Dong Li
提交者:
lianglia-apollo
8月 02, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move ObjectTable out of DataCenter
* prepare for further refactor ObjectTable and DataCenter
上级
f8644731
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
38 addition
and
175 deletion
+38
-175
modules/planning/common/BUILD
modules/planning/common/BUILD
+4
-15
modules/planning/common/data_center.cc
modules/planning/common/data_center.cc
+0
-84
modules/planning/common/data_center.h
modules/planning/common/data_center.h
+2
-26
modules/planning/common/frame.cc
modules/planning/common/frame.cc
+3
-0
modules/planning/common/frame.h
modules/planning/common/frame.h
+8
-0
modules/planning/common/indexed_list.h
modules/planning/common/indexed_list.h
+5
-1
modules/planning/common/object_table.h
modules/planning/common/object_table.h
+0
-40
modules/planning/optimizer/dp_st_speed/BUILD
modules/planning/optimizer/dp_st_speed/BUILD
+1
-0
modules/planning/optimizer/dp_st_speed/dp_st_graph.cc
modules/planning/optimizer/dp_st_speed/dp_st_graph.cc
+5
-5
modules/planning/optimizer/dp_st_speed/dp_st_graph.h
modules/planning/optimizer/dp_st_speed/dp_st_graph.h
+6
-3
modules/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.cc
...s/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.cc
+4
-1
未找到文件。
modules/planning/common/BUILD
浏览文件 @
235c7dff
...
...
@@ -23,14 +23,9 @@ cc_library(
)
cc_library
(
name
=
"
object_tabl
e"
,
name
=
"
indexed_queu
e"
,
hdrs
=
[
"object_table.h"
,
],
deps
=
[
":indexed_list"
,
":obstacle"
,
":planning_gflags"
,
"indexed_queue.h"
,
],
)
...
...
@@ -106,6 +101,7 @@ cc_library(
"frame.h"
,
],
deps
=
[
":indexed_list"
,
"//modules/common:log"
,
"//modules/common/adapters:adapter_manager"
,
"//modules/common/vehicle_state"
,
...
...
@@ -146,20 +142,13 @@ cc_library(
cc_library
(
name
=
"data_center"
,
srcs
=
[
"data_center.cc"
,
],
hdrs
=
[
"data_center.h"
,
],
deps
=
[
":frame"
,
":object_table"
,
":planning_gflags"
,
":indexed_queue"
,
"//modules/common"
,
"//modules/common/adapters:adapter_manager"
,
"//modules/common/status"
,
"//modules/map/hdmap"
,
],
)
...
...
modules/planning/common/data_center.cc
已删除
100644 → 0
浏览文件 @
f8644731
/******************************************************************************
* 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:
**/
#include "modules/planning/common/data_center.h"
#include <fstream>
#include <utility>
#include <vector>
#include "modules/map/proto/map_id.pb.h"
#include "google/protobuf/text_format.h"
#include "modules/common/adapters/adapter_manager.h"
#include "modules/common/log.h"
#include "modules/common/util/util.h"
#include "modules/planning/common/planning_gflags.h"
namespace
apollo
{
namespace
planning
{
using
apollo
::
common
::
Status
;
using
apollo
::
common
::
math
::
Vec2d
;
using
apollo
::
common
::
adapter
::
AdapterManager
;
DataCenter
::
DataCenter
()
{
_object_table
.
reset
(
new
ObjectTable
());
AINFO
<<
"Data Center is ready!"
;
}
Frame
*
DataCenter
::
frame
(
const
uint32_t
sequence_num
)
const
{
std
::
unordered_map
<
uint32_t
,
std
::
unique_ptr
<
Frame
>>::
const_iterator
it
=
_frames
.
find
(
sequence_num
);
if
(
it
!=
_frames
.
end
())
{
return
it
->
second
.
get
();
}
return
nullptr
;
}
void
DataCenter
::
save_frame
()
{
_sequence_queue
.
push_back
(
_frame
->
sequence_num
());
_frames
[
_frame
->
sequence_num
()]
=
std
::
move
(
_frame
);
if
(
_sequence_queue
.
size
()
>
static_cast
<
std
::
size_t
>
(
FLAGS_max_history_result
))
{
_frames
.
erase
(
_sequence_queue
.
front
());
_sequence_queue
.
pop_front
();
}
}
const
Frame
*
DataCenter
::
last_frame
()
const
{
if
(
_sequence_queue
.
empty
())
{
return
nullptr
;
}
uint32_t
sequence_num
=
_sequence_queue
.
back
();
return
_frames
.
find
(
sequence_num
)
->
second
.
get
();
}
ObjectTable
*
DataCenter
::
mutable_object_table
()
const
{
return
_object_table
.
get
();
}
const
ObjectTable
&
DataCenter
::
object_table
()
const
{
return
*
(
_object_table
.
get
());
}
}
// namespace planning
}
// namespace apollo
modules/planning/common/data_center.h
浏览文件 @
235c7dff
...
...
@@ -26,37 +26,13 @@
#include <unordered_map>
#include "modules/common/macro.h"
#include "modules/common/status/status.h"
#include "modules/map/hdmap/hdmap.h"
#include "modules/map/pnc_map/pnc_map.h"
#include "modules/planning/common/frame.h"
#include "modules/planning/common/
object_tabl
e.h"
#include "modules/planning/common/
indexed_queu
e.h"
namespace
apollo
{
namespace
planning
{
class
DataCenter
{
public:
~
DataCenter
()
=
default
;
Frame
*
frame
(
const
uint32_t
sequence_num
)
const
;
public:
void
save_frame
();
const
Frame
*
last_frame
()
const
;
const
ObjectTable
&
object_table
()
const
;
ObjectTable
*
mutable_object_table
()
const
;
private:
std
::
unordered_map
<
uint32_t
,
std
::
unique_ptr
<
Frame
>>
_frames
;
std
::
list
<
uint32_t
>
_sequence_queue
;
std
::
unique_ptr
<
Frame
>
_frame
=
nullptr
;
std
::
unique_ptr
<
ObjectTable
>
_object_table
=
nullptr
;
private:
DECLARE_SINGLETON
(
DataCenter
);
};
using
DataCenter
=
IndexedQueue
<
uint32_t
,
Frame
>
;
}
// namespace planning
}
// namespace apollo
...
...
modules/planning/common/frame.cc
浏览文件 @
235c7dff
...
...
@@ -176,6 +176,9 @@ bool Frame::SmoothReferenceLine() {
return
true
;
}
const
ObstacleTable
&
Frame
::
GetObstacleTable
()
const
{
return
obstacle_table_
;
}
ObstacleTable
*
Frame
::
MutableObstacleTable
()
{
return
&
obstacle_table_
;
}
std
::
string
Frame
::
DebugString
()
const
{
return
"Frame: "
+
std
::
to_string
(
sequence_num_
);
}
...
...
modules/planning/common/frame.h
浏览文件 @
235c7dff
...
...
@@ -30,12 +30,16 @@
#include "modules/map/hdmap/hdmap.h"
#include "modules/map/pnc_map/pnc_map.h"
#include "modules/map/proto/routing.pb.h"
#include "modules/planning/common/indexed_list.h"
#include "modules/planning/common/obstacle.h"
#include "modules/planning/common/planning_data.h"
#include "modules/prediction/proto/prediction_obstacle.pb.h"
namespace
apollo
{
namespace
planning
{
using
ObstacleTable
=
IndexedList
<
uint32_t
,
Obstacle
>
;
class
Frame
{
public:
Frame
(
const
uint32_t
sequence_num
);
...
...
@@ -56,6 +60,9 @@ class Frame {
PlanningData
*
mutable_planning_data
();
std
::
string
DebugString
()
const
;
const
ObstacleTable
&
GetObstacleTable
()
const
;
ObstacleTable
*
MutableObstacleTable
();
void
set_computed_trajectory
(
const
PublishableTrajectory
&
trajectory
);
const
PublishableTrajectory
&
computed_trajectory
()
const
;
...
...
@@ -70,6 +77,7 @@ class Frame {
hdmap
::
RoutingResult
routing_result_
;
prediction
::
PredictionObstacles
prediction_
;
ObstacleTable
obstacle_table_
;
uint32_t
sequence_num_
=
0
;
hdmap
::
Path
hdmap_path_
;
localization
::
Pose
init_pose_
;
...
...
modules/planning/common/indexed_list.h
浏览文件 @
235c7dff
...
...
@@ -31,9 +31,13 @@ namespace planning {
template
<
typename
I
,
typename
T
>
class
IndexedList
{
public:
void
Add
(
const
I
id
,
std
::
unique_ptr
<
T
>
ptr
)
{
bool
Add
(
const
I
id
,
std
::
unique_ptr
<
T
>
ptr
)
{
if
(
Find
(
id
))
{
return
false
;
}
_object_list
.
push_back
(
ptr
.
get
());
_object_dict
[
id
]
=
std
::
move
(
ptr
);
return
true
;
}
T
*
Find
(
const
I
id
)
{
auto
iter
=
_object_dict
.
find
(
id
);
...
...
modules/planning/common/object_table.h
已删除
100644 → 0
浏览文件 @
f8644731
/******************************************************************************
* 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 object_table.h
**/
#ifndef MODULES_PLANNING_COMMON_OBJECT_TABLE_H
#define MODULES_PLANNING_COMMON_OBJECT_TABLE_H
#include <memory>
#include <string>
#include <unordered_map>
#include "modules/planning/common/indexed_list.h"
#include "modules/planning/common/obstacle.h"
#include "modules/planning/common/planning_gflags.h"
namespace
apollo
{
namespace
planning
{
using
ObjectTable
=
IndexedList
<
uint32_t
,
Obstacle
>
;
}
// namespace planning
}
// namespace apollo
#endif // MODULES_PLANNING_COMMON_OBJECT_TABLE_H
modules/planning/optimizer/dp_st_speed/BUILD
浏览文件 @
235c7dff
...
...
@@ -32,6 +32,7 @@ cc_library(
"//modules/common/configs/proto:vehicle_config_proto"
,
"//modules/common/proto:common_proto"
,
"//modules/common/proto:pnc_point_proto"
,
"//modules/common/status"
,
"//modules/planning/common:data_center"
,
"//modules/planning/common:decision_data"
,
"//modules/planning/common/speed:speed_data"
,
...
...
modules/planning/optimizer/dp_st_speed/dp_st_graph.cc
浏览文件 @
235c7dff
...
...
@@ -41,7 +41,7 @@ DpStGraph::DpStGraph(const DpStSpeedConfig& dp_config)
Status
DpStGraph
::
Search
(
const
StGraphData
&
st_graph_data
,
DecisionData
*
const
decision_data
,
SpeedData
*
const
speed_data
)
{
SpeedData
*
const
speed_data
,
ObstacleTable
*
table
)
{
init_point_
=
st_graph_data
.
init_point
();
if
(
st_graph_data
.
path_data_length
()
<
...
...
@@ -69,7 +69,7 @@ Status DpStGraph::Search(const StGraphData& st_graph_data,
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
}
if
(
!
get_object_decision
(
st_graph_data
,
*
speed_data
).
ok
())
{
if
(
!
get_object_decision
(
st_graph_data
,
*
speed_data
,
table
).
ok
())
{
const
std
::
string
msg
=
"Get object decision by speed profile failed."
;
AERROR
<<
msg
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
...
...
@@ -283,7 +283,8 @@ Status DpStGraph::retrieve_speed_profile(SpeedData* const speed_data) const {
}
Status
DpStGraph
::
get_object_decision
(
const
StGraphData
&
st_graph_data
,
const
SpeedData
&
speed_profile
)
const
{
const
SpeedData
&
speed_profile
,
ObstacleTable
*
obstacles
)
const
{
if
(
speed_profile
.
speed_vector
().
size
()
<
2
)
{
const
std
::
string
msg
=
"dp_st_graph failed to get speed profile."
;
AERROR
<<
msg
;
...
...
@@ -299,8 +300,7 @@ Status DpStGraph::get_object_decision(const StGraphData& st_graph_data,
boundary_it
!=
obs_boundaries
.
end
();
++
boundary_it
)
{
CHECK_EQ
(
boundary_it
->
points
().
size
(),
4
);
Obstacle
*
object_ptr
=
DataCenter
::
instance
()
->
mutable_object_table
()
->
Find
(
boundary_it
->
id
());
Obstacle
*
object_ptr
=
obstacles
->
Find
(
boundary_it
->
id
());
if
(
!
object_ptr
)
{
AERROR
<<
"Failed to find object "
<<
boundary_it
->
id
();
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
...
...
modules/planning/optimizer/dp_st_speed/dp_st_graph.h
浏览文件 @
235c7dff
...
...
@@ -29,6 +29,7 @@
#include "modules/common/status/status.h"
#include "modules/planning/common/decision_data.h"
#include "modules/planning/common/frame.h"
#include "modules/planning/common/speed/speed_data.h"
#include "modules/planning/common/speed/st_point.h"
#include "modules/planning/optimizer/dp_st_speed/dp_st_cost.h"
...
...
@@ -43,7 +44,8 @@ class DpStGraph {
apollo
::
common
::
Status
Search
(
const
StGraphData
&
st_graph_data
,
DecisionData
*
const
decision_data
,
SpeedData
*
const
speed_data
);
SpeedData
*
const
speed_data
,
ObstacleTable
*
table
);
private:
apollo
::
common
::
Status
InitCostTable
();
...
...
@@ -53,8 +55,9 @@ class DpStGraph {
apollo
::
common
::
Status
retrieve_speed_profile
(
SpeedData
*
const
speed_data
)
const
;
apollo
::
common
::
Status
get_object_decision
(
const
StGraphData
&
st_graph_data
,
const
SpeedData
&
speed_profile
)
const
;
apollo
::
common
::
Status
get_object_decision
(
const
StGraphData
&
st_graph_data
,
const
SpeedData
&
speed_profile
,
ObstacleTable
*
obstacles
)
const
;
apollo
::
common
::
Status
CalculateTotalCost
(
const
StGraphData
&
st_graph_data
);
void
CalculateCostAt
(
const
StGraphData
&
st_graph_data
,
const
uint32_t
r
,
...
...
modules/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.cc
浏览文件 @
235c7dff
...
...
@@ -101,7 +101,10 @@ Status DpStSpeedOptimizer::Process(const PathData& path_data,
StGraphData
st_graph_data
(
boundaries
,
init_point
,
speed_limit
,
path_length
);
DpStGraph
st_graph
(
dp_st_speed_config_
);
if
(
!
st_graph
.
Search
(
st_graph_data
,
decision_data
,
speed_data
).
ok
())
{
if
(
!
st_graph
.
Search
(
st_graph_data
,
decision_data
,
speed_data
,
frame_
->
MutableObstacleTable
())
.
ok
())
{
const
std
::
string
msg
=
"Failed to search graph with dynamic programming."
;
AERROR
<<
msg
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录