Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
bbfec7e1
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,发现更多精彩内容 >>
提交
bbfec7e1
编写于
8月 03, 2017
作者:
D
Dong Li
提交者:
Calvin Miao
8月 04, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added path_decision, which is the storage place for obstacle path properties
and decisions
上级
233a9270
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
258 addition
and
229 deletion
+258
-229
modules/planning/common/BUILD
modules/planning/common/BUILD
+34
-31
modules/planning/common/frame.cc
modules/planning/common/frame.cc
+5
-12
modules/planning/common/frame.h
modules/planning/common/frame.h
+5
-6
modules/planning/common/path_decision.cc
modules/planning/common/path_decision.cc
+58
-0
modules/planning/common/path_decision.h
modules/planning/common/path_decision.h
+21
-18
modules/planning/common/path_obstacle.h
modules/planning/common/path_obstacle.h
+3
-2
modules/planning/common/planning_data.cc
modules/planning/common/planning_data.cc
+0
-13
modules/planning/common/planning_data.h
modules/planning/common/planning_data.h
+0
-8
modules/planning/optimizer/BUILD
modules/planning/optimizer/BUILD
+2
-2
modules/planning/optimizer/dp_poly_path/BUILD
modules/planning/optimizer/dp_poly_path/BUILD
+1
-1
modules/planning/optimizer/dp_poly_path/dp_poly_path_optimizer.cc
...planning/optimizer/dp_poly_path/dp_poly_path_optimizer.cc
+14
-4
modules/planning/optimizer/dp_poly_path/dp_poly_path_optimizer.h
.../planning/optimizer/dp_poly_path/dp_poly_path_optimizer.h
+1
-1
modules/planning/optimizer/dp_poly_path/dp_road_graph.cc
modules/planning/optimizer/dp_poly_path/dp_road_graph.cc
+41
-41
modules/planning/optimizer/dp_poly_path/dp_road_graph.h
modules/planning/optimizer/dp_poly_path/dp_road_graph.h
+6
-11
modules/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
...les/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
+1
-3
modules/planning/optimizer/dp_poly_path/trajectory_cost.h
modules/planning/optimizer/dp_poly_path/trajectory_cost.h
+1
-1
modules/planning/optimizer/dp_st_speed/BUILD
modules/planning/optimizer/dp_st_speed/BUILD
+1
-1
modules/planning/optimizer/dp_st_speed/dp_st_graph.cc
modules/planning/optimizer/dp_st_speed/dp_st_graph.cc
+1
-1
modules/planning/optimizer/dp_st_speed/dp_st_graph.h
modules/planning/optimizer/dp_st_speed/dp_st_graph.h
+2
-2
modules/planning/optimizer/dp_st_speed/dp_st_graph_test.cc
modules/planning/optimizer/dp_st_speed/dp_st_graph_test.cc
+1
-1
modules/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.cc
...s/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.cc
+3
-3
modules/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.h
...es/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.h
+1
-1
modules/planning/optimizer/path_optimizer.cc
modules/planning/optimizer/path_optimizer.cc
+1
-2
modules/planning/optimizer/path_optimizer.h
modules/planning/optimizer/path_optimizer.h
+1
-1
modules/planning/optimizer/qp_spline_path/BUILD
modules/planning/optimizer/qp_spline_path/BUILD
+1
-1
modules/planning/optimizer/qp_spline_path/qp_spline_path_generator.h
...nning/optimizer/qp_spline_path/qp_spline_path_generator.h
+1
-1
modules/planning/optimizer/qp_spline_path/qp_spline_path_optimizer.cc
...ning/optimizer/qp_spline_path/qp_spline_path_optimizer.cc
+1
-1
modules/planning/optimizer/qp_spline_path/qp_spline_path_optimizer.h
...nning/optimizer/qp_spline_path/qp_spline_path_optimizer.h
+1
-1
modules/planning/optimizer/qp_spline_st_speed/qp_spline_st_speed_optimizer.cc
...imizer/qp_spline_st_speed/qp_spline_st_speed_optimizer.cc
+2
-2
modules/planning/optimizer/qp_spline_st_speed/qp_spline_st_speed_optimizer.h
...timizer/qp_spline_st_speed/qp_spline_st_speed_optimizer.h
+1
-1
modules/planning/optimizer/speed_optimizer.cc
modules/planning/optimizer/speed_optimizer.cc
+1
-2
modules/planning/optimizer/speed_optimizer.h
modules/planning/optimizer/speed_optimizer.h
+1
-1
modules/planning/optimizer/st_graph/BUILD
modules/planning/optimizer/st_graph/BUILD
+1
-1
modules/planning/optimizer/st_graph/st_boundary_mapper.cc
modules/planning/optimizer/st_graph/st_boundary_mapper.cc
+35
-42
modules/planning/optimizer/st_graph/st_boundary_mapper.h
modules/planning/optimizer/st_graph/st_boundary_mapper.h
+6
-6
modules/planning/optimizer/st_graph/st_graph_boundary.h
modules/planning/optimizer/st_graph/st_graph_boundary.h
+1
-0
modules/planning/planner/em/em_planner.cc
modules/planning/planner/em/em_planner.cc
+2
-4
未找到文件。
modules/planning/common/BUILD
浏览文件 @
bbfec7e1
...
...
@@ -2,19 +2,6 @@ load("//tools:cpplint.bzl", "cpplint")
package
(
default_visibility
=
[
"//visibility:public"
])
cc_library
(
name
=
"decision_data"
,
srcs
=
[
"decision_data.cc"
,
],
hdrs
=
[
"decision_data.h"
,
],
deps
=
[
"//modules/planning/common:obstacle"
,
],
)
cc_library
(
name
=
"indexed_list"
,
hdrs
=
[
...
...
@@ -61,6 +48,38 @@ cc_library(
],
)
cc_library
(
name
=
"planning_util"
,
srcs
=
[
"planning_util.cc"
,
],
hdrs
=
[
"planning_util.h"
,
],
deps
=
[
"//modules/common/math"
,
"//modules/common/proto:pnc_point_proto"
,
"//modules/planning/math:hermite_spline"
,
"//modules/planning/proto:planning_proto"
,
],
)
cc_library
(
name
=
"path_decision"
,
srcs
=
[
"path_decision.cc"
,
],
hdrs
=
[
"path_decision.h"
,
],
deps
=
[
":indexed_list"
,
":obstacle"
,
":path_obstacle"
,
"//modules/planning/reference_line"
,
],
)
cc_library
(
name
=
"planning_gflags"
,
srcs
=
[
...
...
@@ -83,7 +102,6 @@ cc_library(
"planning_data.h"
,
],
deps
=
[
":decision_data"
,
"//modules/common:log"
,
"//modules/common/proto:pnc_point_proto"
,
"//modules/map/proto:map_proto"
,
...
...
@@ -108,12 +126,13 @@ cc_library(
":indexed_list"
,
":indexed_queue"
,
":obstacle"
,
":path_decision"
,
":path_obstacle"
,
":planning_data"
,
"//modules/common:log"
,
"//modules/common/adapters:adapter_manager"
,
"//modules/common/vehicle_state"
,
"//modules/map/pnc_map"
,
"//modules/planning/common:planning_data"
,
"//modules/planning/common/trajectory:discretized_trajectory"
,
"//modules/planning/common/trajectory:publishable_trajectory"
,
"//modules/planning/proto:planning_proto"
,
...
...
@@ -163,20 +182,4 @@ cc_library(
],
)
cc_library
(
name
=
"planning_util"
,
srcs
=
[
"planning_util.cc"
,
],
hdrs
=
[
"planning_util.h"
,
],
deps
=
[
"//modules/common/math"
,
"//modules/common/proto:pnc_point_proto"
,
"//modules/planning/math:hermite_spline"
,
"//modules/planning/proto:planning_proto"
,
],
)
cpplint
()
modules/planning/common/frame.cc
浏览文件 @
bbfec7e1
...
...
@@ -72,26 +72,16 @@ void Frame::CreatePredictionObstacles(
std
::
list
<
std
::
unique_ptr
<
Obstacle
>
>
obstacles
;
Obstacle
::
CreateObstacles
(
prediction
,
&
obstacles
);
for
(
auto
&
ptr
:
obstacles
)
{
mutable_planning_data
()
->
mutable_decision_data
()
->
AddObstacle
(
ptr
.
get
());
obstacles_
.
Add
(
ptr
->
Id
(),
std
::
move
(
ptr
));
}
}
bool
Frame
::
AddDecision
(
const
std
::
string
&
tag
,
const
std
::
string
&
object_id
,
const
ObjectDecisionType
&
decision
)
{
auto
*
path_obstacle
=
path_obstacles_
.
Find
(
object_id
);
if
(
!
path_obstacle
)
{
AERROR
<<
"failed to find obstacle"
;
return
false
;
}
path_obstacle
->
AddDecision
(
tag
,
decision
);
return
true
;
}
const
ADCTrajectory
&
Frame
::
GetADCTrajectory
()
const
{
return
trajectory_pb_
;
}
ADCTrajectory
*
Frame
::
MutableADCTrajectory
()
{
return
&
trajectory_pb_
;
}
PathDecision
*
Frame
::
path_decision
()
{
return
path_decision_
.
get
();
}
bool
Frame
::
Init
()
{
if
(
!
pnc_map_
)
{
AERROR
<<
"map is null, call SetMap() first"
;
...
...
@@ -116,6 +106,9 @@ bool Frame::Init() {
CreatePredictionObstacles
(
prediction_
);
}
path_decision_
=
common
::
util
::
make_unique
<
PathDecision
>
(
obstacles_
.
Items
(),
reference_line_
);
if
(
FLAGS_enable_traffic_decision
)
{
MakeTrafficDecision
(
routing_result_
,
reference_line_
);
}
...
...
modules/planning/common/frame.h
浏览文件 @
bbfec7e1
...
...
@@ -27,12 +27,13 @@
#include "modules/common/proto/geometry.pb.h"
#include "modules/localization/proto/pose.pb.h"
#include "modules/map/hdmap/hdmap.h"
#include "modules/map/pnc_map/pnc_map.h"
#include "modules/planning/common/indexed_list.h"
#include "modules/planning/common/indexed_queue.h"
#include "modules/planning/common/obstacle.h"
#include "modules/planning/common/path_
obstacle
.h"
#include "modules/planning/common/path_
decision
.h"
#include "modules/planning/common/planning_data.h"
#include "modules/planning/proto/planning.pb.h"
#include "modules/prediction/proto/prediction_obstacle.pb.h"
...
...
@@ -42,7 +43,6 @@ namespace apollo {
namespace
planning
{
using
Obstacles
=
IndexedList
<
std
::
string
,
Obstacle
>
;
using
PathObstacles
=
IndexedList
<
std
::
string
,
PathObstacle
>
;
class
Frame
{
public:
...
...
@@ -55,9 +55,6 @@ class Frame {
const
common
::
TrajectoryPoint
&
PlanningStartPoint
()
const
;
bool
Init
();
bool
AddDecision
(
const
std
::
string
&
tag
,
const
std
::
string
&
object_id
,
const
ObjectDecisionType
&
decision
);
static
const
hdmap
::
PncMap
*
PncMap
();
static
void
SetMap
(
hdmap
::
PncMap
*
pnc_map
);
...
...
@@ -78,6 +75,8 @@ class Frame {
void
set_computed_trajectory
(
const
PublishableTrajectory
&
trajectory
);
const
PublishableTrajectory
&
computed_trajectory
()
const
;
PathDecision
*
path_decision
();
void
RecordInputDebug
();
private:
...
...
@@ -131,7 +130,7 @@ class Frame {
routing
::
RoutingResponse
routing_result_
;
prediction
::
PredictionObstacles
prediction_
;
Obstacles
obstacles_
;
PathObstacles
path_obstacles
_
;
std
::
unique_ptr
<
PathDecision
>
path_decision
_
;
uint32_t
sequence_num_
=
0
;
localization
::
Pose
init_pose_
;
PublishableTrajectory
_computed_trajectory
;
...
...
modules/planning/common/
decision_data
.cc
→
modules/planning/common/
path_decision
.cc
浏览文件 @
bbfec7e1
...
...
@@ -15,45 +15,43 @@
*****************************************************************************/
/**
* @file
decision_data.cc
* @file
**/
#include "modules/planning/common/decision_data.h"
#include "modules/planning/common/path_decision.h"
#include "modules/common/util/util.h"
namespace
apollo
{
namespace
planning
{
const
DecisionResult
&
DecisionData
::
Decision
()
const
{
return
decision_
;
}
DecisionResult
*
DecisionData
::
MutableDecision
()
{
return
&
decision_
;
}
const
std
::
vector
<
Obstacle
*>
&
DecisionData
::
Obstacles
()
const
{
return
obstacles_
;
}
const
std
::
vector
<
Obstacle
*>
&
DecisionData
::
StaticObstacles
()
const
{
return
static_obstacles_
;
}
const
std
::
vector
<
Obstacle
*>
&
DecisionData
::
DynamicObstacles
()
const
{
return
dynamic_obstacles_
;
PathDecision
::
PathDecision
(
const
std
::
vector
<
const
Obstacle
*>
&
obstacles
,
const
ReferenceLine
&
reference_line
)
:
reference_line_
(
reference_line
)
{
Init
(
obstacles
);
}
std
::
vector
<
Obstacle
*>
*
DecisionData
::
MutableStaticObstacles
()
{
return
&
static_obstacles_
;
void
PathDecision
::
Init
(
const
std
::
vector
<
const
Obstacle
*>
&
obstacles
)
{
for
(
const
auto
obstacle
:
obstacles
)
{
path_obstacles_
.
Add
(
obstacle
->
Id
(),
common
::
util
::
make_unique
<
PathObstacle
>
(
obstacle
,
&
reference_line_
));
}
}
std
::
vector
<
Obstacle
*>
*
DecisionData
::
MutableDynamicObstacles
()
{
return
&
dynamic
_obstacles_
;
const
PathObstacles
&
PathDecision
::
path_obstacles
()
const
{
return
path
_obstacles_
;
}
void
DecisionData
::
AddObstacle
(
Obstacle
*
obstacle
)
{
obstacles_
.
push_back
(
obstacle
);
if
(
obstacle
->
IsStatic
())
{
static_obstacles_
.
push_back
(
obstacle
);
}
else
{
dynamic_obstacles_
.
push_back
(
obstacle
);
bool
PathDecision
::
AddDecision
(
const
std
::
string
&
tag
,
const
std
::
string
&
object_id
,
const
ObjectDecisionType
&
decision
)
{
auto
*
path_obstacle
=
path_obstacles_
.
Find
(
object_id
);
if
(
!
path_obstacle
)
{
AERROR
<<
"failed to find obstacle"
;
return
false
;
}
path_obstacle
->
AddDecision
(
tag
,
decision
);
return
true
;
}
}
// namespace planning
...
...
modules/planning/common/
decision_data
.h
→
modules/planning/common/
path_decision
.h
浏览文件 @
bbfec7e1
...
...
@@ -15,42 +15,45 @@
*****************************************************************************/
/**
* @file
decision_data.h
* @file
**/
#ifndef MODULES_PLANNING_COMMON_
DECISION_DATA
_H_
#define MODULES_PLANNING_COMMON_
DECISION_DATA
_H_
#ifndef MODULES_PLANNING_COMMON_
PATH_DECISION
_H_
#define MODULES_PLANNING_COMMON_
PATH_DECISION
_H_
#include <list>
#include <vector>
#include "modules/planning/proto/decision.pb.h"
#include "modules/planning/common/indexed_list.h"
#include "modules/planning/common/obstacle.h"
#include "modules/planning/common/path_obstacle.h"
namespace
apollo
{
namespace
planning
{
class
DecisionData
{
using
PathObstacles
=
IndexedList
<
std
::
string
,
PathObstacle
>
;
class
PathDecision
{
public:
DecisionData
()
=
default
;
PathDecision
(
const
std
::
vector
<
const
Obstacle
*>
&
obstacles
,
const
ReferenceLine
&
reference_line
);
const
DecisionResult
&
Decision
()
const
;
DecisionResult
*
MutableDecision
();
const
PathObstacles
&
path_obstacles
()
const
;
const
std
::
vector
<
Obstacle
*>
&
Obstacles
()
const
;
const
std
::
vector
<
Obstacle
*>
&
StaticObstacles
()
const
;
const
std
::
vector
<
Obstacle
*>
&
DynamicObstacles
()
const
;
std
::
vector
<
Obstacle
*>
*
MutableStaticObstacles
();
std
::
vector
<
Obstacle
*>
*
MutableDynamicObstacles
();
void
AddObstacle
(
Obstacle
*
obstacle
);
bool
AddDecision
(
const
std
::
string
&
tag
,
const
std
::
string
&
object_id
,
const
ObjectDecisionType
&
decision
);
private:
void
Init
(
const
std
::
vector
<
const
Obstacle
*>
&
obstacles
);
private:
DecisionResult
decision_
;
std
::
vector
<
Obstacle
*>
obstacles_
;
std
::
vector
<
Obstacle
*>
static_obstacles_
;
std
::
vector
<
Obstacle
*>
dynamic_obstacles_
;
const
ReferenceLine
&
reference_line_
;
PathObstacles
path_obstacles_
;
};
}
// namespace planning
}
// namespace apollo
#endif // MODULES_PLANNING_COMMON_
DECISION_DATA
_H_
#endif // MODULES_PLANNING_COMMON_
PATH_DECISION
_H_
modules/planning/common/path_obstacle.h
浏览文件 @
bbfec7e1
...
...
@@ -37,6 +37,9 @@
namespace
apollo
{
namespace
planning
{
// a commonly used type to store Object Id and Object Decisions
using
DecisionList
=
std
::
vector
<
std
::
pair
<
std
::
string
,
ObjectDecisionType
>>
;
/**
* @class PathObstacle
* @brief This is the class that associates an Obstacle with its path
...
...
@@ -46,8 +49,6 @@ namespace planning {
*/
class
PathObstacle
{
public:
PathObstacle
()
=
default
;
PathObstacle
(
const
planning
::
Obstacle
*
obstacle
,
const
ReferenceLine
*
reference_line
);
...
...
modules/planning/common/planning_data.cc
浏览文件 @
bbfec7e1
...
...
@@ -29,19 +29,6 @@
namespace
apollo
{
namespace
planning
{
const
DecisionData
&
PlanningData
::
decision_data
()
const
{
return
*
decision_data_
.
get
();
}
DecisionData
*
PlanningData
::
mutable_decision_data
()
const
{
return
decision_data_
.
get
();
}
void
PlanningData
::
set_decision_data
(
std
::
shared_ptr
<
DecisionData
>&
decision_data
)
{
decision_data_
=
decision_data
;
}
const
PathData
&
PlanningData
::
path_data
()
const
{
return
path_data_
;
}
const
SpeedData
&
PlanningData
::
speed_data
()
const
{
return
speed_data_
;
}
...
...
modules/planning/common/planning_data.h
浏览文件 @
bbfec7e1
...
...
@@ -27,7 +27,6 @@
#include "modules/common/proto/pnc_point.pb.h"
#include "modules/planning/common/decision_data.h"
#include "modules/planning/common/path/path_data.h"
#include "modules/planning/common/planning_data.h"
#include "modules/planning/common/speed/speed_data.h"
...
...
@@ -40,12 +39,6 @@ class PlanningData {
public:
PlanningData
()
=
default
;
void
set_decision_data
(
std
::
shared_ptr
<
DecisionData
>&
decision_data
);
const
DecisionData
&
decision_data
()
const
;
DecisionData
*
mutable_decision_data
()
const
;
const
PathData
&
path_data
()
const
;
const
SpeedData
&
speed_data
()
const
;
...
...
@@ -61,7 +54,6 @@ class PlanningData {
std
::
string
DebugString
()
const
;
protected:
std
::
shared_ptr
<
DecisionData
>
decision_data_
=
nullptr
;
PathData
path_data_
;
SpeedData
speed_data_
;
double
timestamp_
=
0.0
;
...
...
modules/planning/optimizer/BUILD
浏览文件 @
bbfec7e1
...
...
@@ -29,7 +29,7 @@ cc_library(
deps
=
[
":optimizer"
,
"//modules/common/status"
,
"//modules/planning/common:
decision_data
"
,
"//modules/planning/common:
path_decision
"
,
"//modules/planning/common:planning_data"
,
"//modules/planning/common/path:path_data"
,
"//modules/planning/common/speed:speed_data"
,
...
...
@@ -48,7 +48,7 @@ cc_library(
deps
=
[
":optimizer"
,
"//modules/common/status"
,
"//modules/planning/common:
decision_data
"
,
"//modules/planning/common:
path_decision
"
,
"//modules/planning/common:planning_data"
,
"//modules/planning/common/path:path_data"
,
"//modules/planning/common/speed:speed_data"
,
...
...
modules/planning/optimizer/dp_poly_path/BUILD
浏览文件 @
bbfec7e1
...
...
@@ -17,7 +17,7 @@ cc_library(
"//modules/common/math"
,
"//modules/common/status"
,
"//modules/map/proto:map_proto"
,
"//modules/planning/common:
decision_data
"
,
"//modules/planning/common:
path_decision
"
,
"//modules/planning/common:frame"
,
"//modules/planning/common:obstacle"
,
"//modules/planning/common:planning_gflags"
,
...
...
modules/planning/optimizer/dp_poly_path/dp_poly_path_optimizer.cc
浏览文件 @
bbfec7e1
...
...
@@ -48,24 +48,34 @@ bool DpPolyPathOptimizer::Init() {
Status
DpPolyPathOptimizer
::
Process
(
const
SpeedData
&
speed_data
,
const
ReferenceLine
&
reference_line
,
const
common
::
TrajectoryPoint
&
init_point
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
PathData
*
const
path_data
)
{
if
(
!
is_init_
)
{
AERROR
<<
"Please call Init() before Process()."
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"Not inited."
);
}
CHECK_NOTNULL
(
decision_data
);
CHECK_NOTNULL
(
path_decision
);
CHECK_NOTNULL
(
path_data
);
DPRoadGraph
dp_road_graph
(
config_
,
init_point
,
speed_data
);
if
(
!
dp_road_graph
.
FindPathTunnel
(
reference_line
,
path_data
))
{
AERROR
<<
"Failed to find tunnel in road graph"
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"dp_road_graph path generation"
);
}
if
(
!
dp_road_graph
.
ComputeObjectdecision
(
*
path_data
,
speed_data
,
reference_line
,
decision_data
))
{
const
auto
&
obstacles
=
frame_
->
GetObstacles
().
Items
();
DecisionList
decision_list
;
if
(
!
dp_road_graph
.
ComputeObjectDecision
(
*
path_data
,
speed_data
,
reference_line
,
obstacles
,
&
decision_list
))
{
AERROR
<<
"Failed to make decision based on tunnel"
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"dp_road_graph decision "
);
}
for
(
const
auto
&
decision
:
decision_list
)
{
if
(
!
path_decision
->
AddDecision
(
"dp_poly_path"
,
decision
.
first
,
decision
.
second
))
{
AERROR
<<
"Failed to add decision for object: "
<<
decision
.
first
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"obstacles and PathDecision does not match"
);
}
}
return
Status
::
OK
();
}
...
...
modules/planning/optimizer/dp_poly_path/dp_poly_path_optimizer.h
浏览文件 @
bbfec7e1
...
...
@@ -40,7 +40,7 @@ class DpPolyPathOptimizer : public PathOptimizer {
apollo
::
common
::
Status
Process
(
const
SpeedData
&
speed_data
,
const
ReferenceLine
&
reference_line
,
const
common
::
TrajectoryPoint
&
init_point
,
DecisionData
*
const
decision_data
,
PathData
*
const
path_data
)
override
;
PathDecision
*
const
path_decision
,
PathData
*
const
path_data
)
override
;
private:
DpPolyPathConfig
config_
;
...
...
modules/planning/optimizer/dp_poly_path/dp_road_graph.cc
浏览文件 @
bbfec7e1
...
...
@@ -164,7 +164,7 @@ bool DPRoadGraph::Init(const ReferenceLine &reference_line) {
}
bool
DPRoadGraph
::
Generate
(
const
ReferenceLine
&
reference_line
,
std
::
vector
<
DPRoadGraphNode
>
*
min_cost_path
)
{
std
::
vector
<
DPRoadGraphNode
>
*
min_cost_path
)
{
CHECK
(
min_cost_path
!=
nullptr
);
std
::
vector
<
std
::
vector
<
common
::
SLPoint
>>
path_waypoints
;
...
...
@@ -173,7 +173,7 @@ bool DPRoadGraph::Generate(const ReferenceLine &reference_line,
return
false
;
}
path_waypoints
.
insert
(
path_waypoints
.
begin
(),
std
::
vector
<
common
::
SLPoint
>
{
init_sl_point_
});
std
::
vector
<
common
::
SLPoint
>
{
init_sl_point_
});
const
auto
&
vehicle_config
=
common
::
VehicleConfigHelper
::
instance
()
->
GetConfig
();
...
...
@@ -188,18 +188,18 @@ bool DPRoadGraph::Generate(const ReferenceLine &reference_line,
const
auto
&
prev_dp_nodes
=
graph_nodes
[
level
-
1
];
const
auto
&
level_points
=
path_waypoints
[
level
];
for
(
std
::
size_t
i
=
0
;
i
<
level_points
.
size
();
++
i
)
{
const
auto
&
cur_point
=
level_points
[
i
];
const
auto
&
cur_point
=
level_points
[
i
];
graph_nodes
[
level
].
push_back
(
DPRoadGraphNode
(
cur_point
,
nullptr
));
auto
&
cur_node
=
graph_nodes
[
level
].
back
();
auto
&
cur_node
=
graph_nodes
[
level
].
back
();
for
(
std
::
size_t
j
=
0
;
j
<
prev_dp_nodes
.
size
();
++
j
)
{
const
auto
&
prev_dp_node
=
prev_dp_nodes
[
j
];
const
auto
&
prev_sl_point
=
prev_dp_node
.
sl_point
;
const
auto
&
prev_dp_node
=
prev_dp_nodes
[
j
];
const
auto
&
prev_sl_point
=
prev_dp_node
.
sl_point
;
QuinticPolynomialCurve1d
curve
(
prev_sl_point
.
l
(),
0.0
,
0.0
,
cur_point
.
l
(),
0.0
,
0.0
,
cur_point
.
s
()
-
prev_sl_point
.
s
());
const
double
cost
=
trajectory_cost
.
calculate
(
curve
,
prev_sl_point
.
s
(),
cur_point
.
s
())
+
prev_dp_node
.
min_cost
;
const
double
cost
=
trajectory_cost
.
calculate
(
curve
,
prev_sl_point
.
s
(),
cur_point
.
s
())
+
prev_dp_node
.
min_cost
;
cur_node
.
UpdateCost
(
&
prev_dp_node
,
curve
,
cost
);
}
}
...
...
@@ -223,14 +223,12 @@ bool DPRoadGraph::Generate(const ReferenceLine &reference_line,
return
true
;
}
bool
DPRoadGraph
::
ComputeObject
d
ecision
(
const
PathData
&
path_data
,
bool
DPRoadGraph
::
ComputeObject
D
ecision
(
const
PathData
&
path_data
,
const
SpeedData
&
heuristic_speed_data
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
)
{
CHECK_NOTNULL
(
decision_data
);
// Compute static obstacle decision
auto
ptr_static_obstacles
=
decision_data
->
MutableStaticObstacles
();
const
ConstObstacleList
&
obstacles
,
DecisionList
*
const
decisions
)
{
CHECK_NOTNULL
(
decisions
);
std
::
vector
<
common
::
SLPoint
>
ego_sl_points
;
std
::
vector
<
common
::
math
::
Box2d
>
ego_bounding_box
;
...
...
@@ -243,8 +241,8 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
for
(
const
common
::
PathPoint
&
path_point
:
path_data
.
discretized_path
().
points
())
{
ego_bounding_box
.
emplace_back
(
common
::
math
::
Vec2d
{
path_point
.
x
(),
path_point
.
y
()},
path_point
.
theta
(),
ego_length
,
ego_width
);
common
::
math
::
Vec2d
{
path_point
.
x
(),
path_point
.
y
()},
path_point
.
theta
(),
ego_length
,
ego_width
);
common
::
SLPoint
ego_sl
;
if
(
!
reference_line
.
get_point_in_frenet_frame
(
{
path_point
.
x
(),
path_point
.
y
()},
&
ego_sl
))
{
...
...
@@ -255,12 +253,14 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
}
}
for
(
std
::
size_t
i
=
0
;
i
<
ptr_static_obstacles
->
size
();
++
i
)
{
for
(
const
auto
obstacle
:
obstacles
)
{
if
(
!
obstacle
->
IsStatic
())
{
continue
;
}
bool
ignore
=
true
;
const
auto
&
static_obstacle_box
=
(
*
ptr_static_obstacles
)[
i
]
->
PerceptionBoundingBox
();
const
auto
&
static_obstacle_box
=
obstacle
->
PerceptionBoundingBox
();
common
::
SLPoint
obs_sl
;
if
(
!
reference_line
.
get_point_in_frenet_frame
(
{
static_obstacle_box
.
center_x
(),
static_obstacle_box
.
center_y
()},
&
obs_sl
))
{
...
...
@@ -280,7 +280,7 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
object_stop_ptr
->
set_distance_s
(
FLAGS_dp_path_decision_buffer
);
object_stop_ptr
->
set_reason_code
(
StopReasonCode
::
STOP_REASON_OBSTACLE
);
(
*
ptr_static_obstacles
)[
i
]
->
MutableDecisions
()
->
push_back
(
object_stop
);
decisions
->
push_back
(
std
::
make_pair
(
obstacle
->
Id
(),
object_stop
)
);
ignore
=
false
;
break
;
}
else
{
...
...
@@ -291,7 +291,7 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
ObjectNudge
*
object_nudge_ptr
=
object_nudge
.
mutable_nudge
();
object_nudge_ptr
->
set_distance_l
(
FLAGS_dp_path_decision_buffer
);
object_nudge_ptr
->
set_type
(
ObjectNudge
::
RIGHT_NUDGE
);
(
*
ptr_static_obstacles
)[
i
]
->
MutableDecisions
()
->
push_back
(
object_nudge
);
decisions
->
push_back
(
std
::
make_pair
(
obstacle
->
Id
(),
object_nudge
)
);
ignore
=
false
;
break
;
}
else
if
(
diff_l
<
0
&&
...
...
@@ -301,7 +301,7 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
ObjectNudge
*
object_nudge_ptr
=
object_nudge
.
mutable_nudge
();
object_nudge_ptr
->
set_distance_l
(
FLAGS_dp_path_decision_buffer
);
object_nudge_ptr
->
set_type
(
ObjectNudge
::
LEFT_NUDGE
);
(
*
ptr_static_obstacles
)[
i
]
->
MutableDecisions
()
->
push_back
(
object_nudge
);
decisions
->
push_back
(
std
::
make_pair
(
obstacle
->
Id
(),
object_nudge
)
);
ignore
=
false
;
break
;
}
...
...
@@ -311,33 +311,34 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
if
(
ignore
)
{
// IGNORE
ObjectDecisionType
object_ignore
;
ObjectIgnore
*
object_ignore_ptr
=
object_ignore
.
mutable_ignore
();
CHECK_NOTNULL
(
object_ignore_ptr
);
(
*
ptr_static_obstacles
)[
i
]
->
MutableDecisions
()
->
push_back
(
object_ignore
);
object_ignore
.
mutable_ignore
();
decisions
->
push_back
(
std
::
make_pair
(
obstacle
->
Id
(),
object_ignore
));
}
}
// Compute dynamic obstacle decision
auto
ptr_dynamic_obstacles
=
decision_data
->
MutableDynamicObstacles
();
const
double
total_time
=
std
::
min
(
heuristic_speed_data
.
total_time
(),
FLAGS_prediction_total_time
);
std
::
size_t
evaluate_times
=
static_cast
<
std
::
size_t
>
(
std
::
floor
(
total_time
/
config_
.
eval_time_interval
()));
for
(
std
::
size_t
i
=
0
;
i
<
ptr_dynamic_obstacles
->
size
();
++
i
)
{
auto
ptr_dynamic_obstacle
=
(
*
ptr_dynamic_obstacles
)[
i
];
for
(
const
auto
obstacle
:
obstacles
)
{
if
(
obstacle
->
IsStatic
())
{
continue
;
}
// list of Box2d for ego car given heuristic speed profile
std
::
vector
<
common
::
math
::
Box2d
>
ego_by_time
;
if
(
!
ComputeBoundingBoxesForEgoVehicle
(
path_data
.
frenet_frame_path
(),
reference_line
,
heuristic_speed_data
,
evaluate_times
,
&
ego_by_time
))
{
if
(
!
ComputeBoundingBoxesForEgoVehicle
(
path_data
.
frenet_frame_path
(),
reference_line
,
heuristic_speed_data
,
evaluate_times
,
&
ego_by_time
))
{
AERROR
<<
"fill_ego_by_time error"
;
}
std
::
vector
<
common
::
math
::
Box2d
>
obstacle_by_time
;
for
(
std
::
size_t
time
=
0
;
time
<=
evaluate_times
;
++
time
)
{
auto
traj_point
=
ptr_dynamic_
obstacle
->
GetPointAtTime
(
time
*
config_
.
eval_time_interval
());
obstacle_by_time
.
push_back
(
ptr_dynamic_
obstacle
->
GetBoundingBox
(
traj_point
));
obstacle
->
GetPointAtTime
(
time
*
config_
.
eval_time_interval
());
obstacle_by_time
.
push_back
(
obstacle
->
GetBoundingBox
(
traj_point
));
}
// if two lists of boxes collide
...
...
@@ -354,9 +355,9 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
FLAGS_dynamic_decision_follow_range
)
{
// Follow
ObjectDecisionType
object_follow
;
auto
ptr_object_follow
=
object_follow
.
mutable_follow
();
ptr_object_follow
->
set_distance_s
(
FLAGS_dp_path_decision_buffer
);
(
*
ptr_dynamic_obstacles
)[
i
]
->
MutableDecisions
()
->
push_back
(
object_follow
);
ObjectFollow
*
object_follow_ptr
=
object_follow
.
mutable_follow
();
object_follow_ptr
->
set_distance_s
(
FLAGS_dp_path_decision_buffer
);
decisions
->
push_back
(
std
::
make_pair
(
obstacle
->
Id
(),
object_follow
)
);
break
;
}
}
...
...
@@ -366,11 +367,9 @@ bool DPRoadGraph::ComputeObjectdecision(const PathData &path_data,
bool
DPRoadGraph
::
ComputeBoundingBoxesForEgoVehicle
(
const
FrenetFramePath
&
frenet_frame_path
,
const
ReferenceLine
&
reference_line
,
const
SpeedData
&
heuristic_speed_data
,
const
ReferenceLine
&
reference_line
,
const
SpeedData
&
heuristic_speed_data
,
const
std
::
size_t
evaluate_times
,
std
::
vector
<
common
::
math
::
Box2d
>
*
ego_boxes
)
{
CHECK
(
ego_boxes
!=
nullptr
);
const
auto
&
vehicle_config
=
...
...
@@ -407,7 +406,8 @@ bool DPRoadGraph::ComputeBoundingBoxesForEgoVehicle(
double
theta
=
::
apollo
::
common
::
math
::
NormalizeAngle
(
delta_theta
+
reference_point
.
heading
());
ego_boxes
->
emplace_back
(
ego_position_cartesian
,
theta
,
ego_length
,
ego_width
);
ego_boxes
->
emplace_back
(
ego_position_cartesian
,
theta
,
ego_length
,
ego_width
);
}
return
true
;
}
...
...
modules/planning/optimizer/dp_poly_path/dp_road_graph.h
浏览文件 @
bbfec7e1
...
...
@@ -26,8 +26,8 @@
#include "modules/common/proto/pnc_point.pb.h"
#include "modules/common/status/status.h"
#include "modules/planning/common/decision_data.h"
#include "modules/planning/common/path/path_data.h"
#include "modules/planning/common/path_decision.h"
#include "modules/planning/common/speed/speed_data.h"
#include "modules/planning/common/trajectory/discretized_trajectory.h"
#include "modules/planning/math/curve1d/quintic_polynomial_curve1d.h"
...
...
@@ -49,10 +49,11 @@ class DPRoadGraph {
bool
FindPathTunnel
(
const
ReferenceLine
&
reference_line
,
PathData
*
const
path_data
);
bool
ComputeObject
d
ecision
(
const
PathData
&
path_data
,
bool
ComputeObject
D
ecision
(
const
PathData
&
path_data
,
const
SpeedData
&
heuristic_speed_data
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
);
const
ConstObstacleList
&
obstacles
,
DecisionList
*
const
decisions
);
private:
/**
...
...
@@ -90,16 +91,10 @@ class DPRoadGraph {
bool
Generate
(
const
ReferenceLine
&
reference_line
,
std
::
vector
<
DPRoadGraphNode
>
*
min_cost_path
);
bool
ComputeObjectDecisions
(
const
PathData
&
path_data
,
const
SpeedData
&
heuristic_speed_data
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
);
bool
ComputeBoundingBoxesForEgoVehicle
(
const
FrenetFramePath
&
frenet_frame_path
,
const
ReferenceLine
&
reference_line
,
const
SpeedData
&
heuristic_speed_data
,
const
std
::
size_t
evaluate_times
,
const
SpeedData
&
heuristic_speed_data
,
const
std
::
size_t
evaluate_times
,
std
::
vector
<
common
::
math
::
Box2d
>
*
ego_by_time
);
bool
SamplePathWaypoints
(
...
...
@@ -117,4 +112,4 @@ class DPRoadGraph {
}
// namespace planning
}
// namespace apollo
#endif
//
MODULES_PLANNING_OPTIMIZER_DP_POLY_PATH_DP_ROAD_GRAPH_H_
#endif
//
MODULES_PLANNING_OPTIMIZER_DP_POLY_PATH_DP_ROAD_GRAPH_H_
modules/planning/optimizer/dp_poly_path/dp_road_graph_test.cc
浏览文件 @
bbfec7e1
...
...
@@ -76,7 +76,6 @@ class DpRoadGraphTest : public PlanningTestBase {
protected:
const
ReferenceLine
*
reference_line_
=
nullptr
;
DecisionData
decision_data_
;
common
::
TrajectoryPoint
init_point_
;
SpeedData
speed_data_
;
// input
PathData
path_data_
;
// output
...
...
@@ -89,8 +88,7 @@ TEST_F(DpRoadGraphTest, speed_road_graph) {
EXPECT_TRUE
(
result
);
EXPECT_EQ
(
648
,
path_data_
.
discretized_path
().
num_of_points
());
EXPECT_EQ
(
648
,
path_data_
.
frenet_frame_path
().
number_of_points
());
EXPECT_FLOAT_EQ
(
72.00795
,
path_data_
.
frenet_frame_path
().
points
().
back
().
s
());
EXPECT_FLOAT_EQ
(
72.00795
,
path_data_
.
frenet_frame_path
().
points
().
back
().
s
());
EXPECT_FLOAT_EQ
(
0.0
,
path_data_
.
frenet_frame_path
().
points
().
back
().
l
());
// export_path_data(path_data_, "/tmp/path.txt");
}
...
...
modules/planning/optimizer/dp_poly_path/trajectory_cost.h
浏览文件 @
bbfec7e1
...
...
@@ -27,8 +27,8 @@
#include "modules/planning/proto/dp_poly_path_config.pb.h"
#include "modules/common/math/box2d.h"
#include "modules/planning/common/decision_data.h"
#include "modules/planning/common/obstacle.h"
#include "modules/planning/common/path_decision.h"
#include "modules/planning/common/speed/speed_data.h"
#include "modules/planning/math/curve1d/quintic_polynomial_curve1d.h"
#include "modules/planning/reference_line/reference_line.h"
...
...
modules/planning/optimizer/dp_st_speed/BUILD
浏览文件 @
bbfec7e1
...
...
@@ -33,7 +33,7 @@ cc_library(
"//modules/common/proto:common_proto"
,
"//modules/common/proto:pnc_point_proto"
,
"//modules/common/status"
,
"//modules/planning/common:
decision_data
"
,
"//modules/planning/common:
path_decision
"
,
"//modules/planning/common/speed:speed_data"
,
"//modules/planning/optimizer/st_graph:st_graph_data"
,
"//modules/planning/proto:planning_proto"
,
...
...
modules/planning/optimizer/dp_st_speed/dp_st_graph.cc
浏览文件 @
bbfec7e1
...
...
@@ -39,7 +39,7 @@ DpStGraph::DpStGraph(const DpStSpeedConfig& dp_config)
:
dp_st_speed_config_
(
dp_config
),
dp_st_cost_
(
dp_config
)
{}
Status
DpStGraph
::
Search
(
const
StGraphData
&
st_graph_data
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
,
Obstacles
*
table
)
{
init_point_
=
st_graph_data
.
init_point
();
...
...
modules/planning/optimizer/dp_st_speed/dp_st_graph.h
浏览文件 @
bbfec7e1
...
...
@@ -28,7 +28,7 @@
#include "modules/planning/proto/planning_config.pb.h"
#include "modules/common/status/status.h"
#include "modules/planning/common/
decision_data
.h"
#include "modules/planning/common/
path_decision
.h"
#include "modules/planning/common/frame.h"
#include "modules/planning/common/speed/speed_data.h"
#include "modules/planning/common/speed/st_point.h"
...
...
@@ -43,7 +43,7 @@ class DpStGraph {
explicit
DpStGraph
(
const
DpStSpeedConfig
&
dp_config
);
apollo
::
common
::
Status
Search
(
const
StGraphData
&
st_graph_data
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
,
Obstacles
*
table
);
...
...
modules/planning/optimizer/dp_st_speed/dp_st_graph_test.cc
浏览文件 @
bbfec7e1
...
...
@@ -27,6 +27,7 @@
#include "modules/common/adapters/adapter_manager.h"
#include "modules/common/log.h"
#include "modules/common/util/file.h"
#include "modules/planning/common/path_decision.h"
#include "modules/planning/common/planning_gflags.h"
#include "modules/planning/integration_tests/planning_test_base.h"
#include "modules/planning/optimizer/dp_st_speed/dp_st_graph.h"
...
...
@@ -75,7 +76,6 @@ class DpStSpeedTest : public PlanningTestBase {
protected:
const
ReferenceLine
*
reference_line_
=
nullptr
;
DecisionData
decision_data_
;
common
::
TrajectoryPoint
init_point_
;
SpeedData
speed_data_
;
// output
PathData
path_data_
;
// input
...
...
modules/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.cc
浏览文件 @
bbfec7e1
...
...
@@ -60,7 +60,7 @@ bool DpStSpeedOptimizer::Init() {
Status
DpStSpeedOptimizer
::
Process
(
const
PathData
&
path_data
,
const
common
::
TrajectoryPoint
&
init_point
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
)
{
if
(
!
is_init_
)
{
AERROR
<<
"Please call Init() before process DpStSpeedOptimizer."
;
...
...
@@ -75,7 +75,7 @@ Status DpStSpeedOptimizer::Process(const PathData& path_data,
const
double
path_length
=
path_data
.
discretized_path
().
length
();
// step 1 get boundaries
std
::
vector
<
StGraphBoundary
>
boundaries
;
if
(
!
boundary_mapper
.
GetGraphBoundary
(
*
decision_data
,
&
boundaries
).
ok
())
{
if
(
!
boundary_mapper
.
GetGraphBoundary
(
*
path_decision
,
&
boundaries
).
ok
())
{
const
std
::
string
msg
=
"Mapping obstacle for dp st speed optimizer failed."
;
AERROR
<<
msg
;
...
...
@@ -95,7 +95,7 @@ Status DpStSpeedOptimizer::Process(const PathData& path_data,
DpStGraph
st_graph
(
dp_st_speed_config_
);
if
(
!
st_graph
.
Search
(
st_graph_data
,
decision_data
,
speed_data
,
.
Search
(
st_graph_data
,
path_decision
,
speed_data
,
frame_
->
MutableObstacles
())
.
ok
())
{
const
std
::
string
msg
=
"Failed to search graph with dynamic programming."
;
...
...
modules/planning/optimizer/dp_st_speed/dp_st_speed_optimizer.h
浏览文件 @
bbfec7e1
...
...
@@ -42,7 +42,7 @@ class DpStSpeedOptimizer : public SpeedOptimizer {
apollo
::
common
::
Status
Process
(
const
PathData
&
path_data
,
const
common
::
TrajectoryPoint
&
init_point
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
)
override
;
DpStSpeedConfig
dp_st_speed_config_
;
StBoundaryConfig
st_boundary_config_
;
...
...
modules/planning/optimizer/path_optimizer.cc
浏览文件 @
bbfec7e1
...
...
@@ -29,8 +29,7 @@ apollo::common::Status PathOptimizer::Optimize(Frame* frame) {
frame_
=
frame
;
auto
*
planning_data
=
frame
->
mutable_planning_data
();
return
Process
(
planning_data
->
speed_data
(),
frame
->
reference_line
(),
frame
->
PlanningStartPoint
(),
planning_data
->
mutable_decision_data
(),
frame
->
PlanningStartPoint
(),
frame
->
path_decision
(),
planning_data
->
mutable_path_data
());
}
...
...
modules/planning/optimizer/path_optimizer.h
浏览文件 @
bbfec7e1
...
...
@@ -44,7 +44,7 @@ class PathOptimizer : public Optimizer {
virtual
apollo
::
common
::
Status
Process
(
const
SpeedData
&
speed_data
,
const
ReferenceLine
&
reference_line
,
const
common
::
TrajectoryPoint
&
init_point
,
DecisionData
*
const
decision_data
,
PathData
*
const
path_data
)
=
0
;
PathDecision
*
const
path_decision
,
PathData
*
const
path_data
)
=
0
;
};
}
// namespace planning
...
...
modules/planning/optimizer/qp_spline_path/BUILD
浏览文件 @
bbfec7e1
...
...
@@ -22,7 +22,7 @@ cc_library(
"//modules/common/proto:pnc_point_proto"
,
"//modules/common/util"
,
"//modules/map/proto:map_proto"
,
"//modules/planning/common:
decision_data
"
,
"//modules/planning/common:
path_decision
"
,
"//modules/planning/common:obstacle"
,
"//modules/planning/common:planning_data"
,
"//modules/planning/common:planning_gflags"
,
...
...
modules/planning/optimizer/qp_spline_path/qp_spline_path_generator.h
浏览文件 @
bbfec7e1
...
...
@@ -28,8 +28,8 @@
#include "modules/common/proto/pnc_point.pb.h"
#include "modules/planning/proto/qp_spline_path_config.pb.h"
#include "modules/planning/common/decision_data.h"
#include "modules/planning/common/path/path_data.h"
#include "modules/planning/common/path_decision.h"
#include "modules/planning/common/speed/speed_data.h"
#include "modules/planning/math/smoothing_spline/spline_1d_generator.h"
#include "modules/planning/optimizer/qp_spline_path/qp_frenet_frame.h"
...
...
modules/planning/optimizer/qp_spline_path/qp_spline_path_optimizer.cc
浏览文件 @
bbfec7e1
...
...
@@ -47,7 +47,7 @@ bool QpSplinePathOptimizer::Init() {
Status
QpSplinePathOptimizer
::
Process
(
const
SpeedData
&
speed_data
,
const
ReferenceLine
&
reference_line
,
const
common
::
TrajectoryPoint
&
init_point
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
PathData
*
const
path_data
)
{
if
(
!
is_init_
)
{
AERROR
<<
"Please call Init() before Process."
;
...
...
modules/planning/optimizer/qp_spline_path/qp_spline_path_optimizer.h
浏览文件 @
bbfec7e1
...
...
@@ -40,7 +40,7 @@ class QpSplinePathOptimizer : public PathOptimizer {
apollo
::
common
::
Status
Process
(
const
SpeedData
&
speed_data
,
const
ReferenceLine
&
reference_line
,
const
common
::
TrajectoryPoint
&
init_point
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
PathData
*
const
path_data
)
override
;
private:
...
...
modules/planning/optimizer/qp_spline_st_speed/qp_spline_st_speed_optimizer.cc
浏览文件 @
bbfec7e1
...
...
@@ -87,7 +87,7 @@ void QpSplineStSpeedOptimizer::RecordSTGraphDebug(
Status
QpSplineStSpeedOptimizer
::
Process
(
const
PathData
&
path_data
,
const
TrajectoryPoint
&
init_point
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
)
{
if
(
!
is_init_
)
{
AERROR
<<
"Please call Init() before Process."
;
...
...
@@ -100,7 +100,7 @@ Status QpSplineStSpeedOptimizer::Process(const PathData& path_data,
// step 1 get boundaries
std
::
vector
<
StGraphBoundary
>
boundaries
;
if
(
!
boundary_mapper
.
GetGraphBoundary
(
*
decision_data
,
&
boundaries
).
ok
())
{
if
(
!
boundary_mapper
.
GetGraphBoundary
(
*
path_decision
,
&
boundaries
).
ok
())
{
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"Mapping obstacle for dp st speed optimizer failed!"
);
}
...
...
modules/planning/optimizer/qp_spline_st_speed/qp_spline_st_speed_optimizer.h
浏览文件 @
bbfec7e1
...
...
@@ -43,7 +43,7 @@ class QpSplineStSpeedOptimizer : public SpeedOptimizer {
common
::
Status
Process
(
const
PathData
&
path_data
,
const
apollo
::
common
::
TrajectoryPoint
&
init_point
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
,
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
)
override
;
void
RecordSTGraphDebug
(
const
std
::
vector
<
StGraphBoundary
>&
boundaries
,
...
...
modules/planning/optimizer/speed_optimizer.cc
浏览文件 @
bbfec7e1
...
...
@@ -31,8 +31,7 @@ apollo::common::Status SpeedOptimizer::Optimize(Frame* frame) {
frame_
=
frame
;
auto
*
planning_data
=
frame
->
mutable_planning_data
();
return
Process
(
planning_data
->
path_data
(),
frame
->
PlanningStartPoint
(),
frame
->
reference_line
(),
planning_data
->
mutable_decision_data
(),
frame
->
reference_line
(),
frame
->
path_decision
(),
planning_data
->
mutable_speed_data
());
}
...
...
modules/planning/optimizer/speed_optimizer.h
浏览文件 @
bbfec7e1
...
...
@@ -39,7 +39,7 @@ class SpeedOptimizer : public Optimizer {
protected:
virtual
apollo
::
common
::
Status
Process
(
const
PathData
&
path_data
,
const
common
::
TrajectoryPoint
&
init_point
,
const
ReferenceLine
&
reference_line
,
DecisionData
*
const
decision_data
,
const
ReferenceLine
&
reference_line
,
PathDecision
*
const
path_decision
,
SpeedData
*
const
speed_data
)
=
0
;
};
...
...
modules/planning/optimizer/st_graph/BUILD
浏览文件 @
bbfec7e1
...
...
@@ -63,7 +63,7 @@ cc_library(
"//modules/common/status"
,
"//modules/map/pnc_map"
,
"//modules/map/proto:map_proto"
,
"//modules/planning/common:
decision_data
"
,
"//modules/planning/common:
path_decision
"
,
"//modules/planning/common:frame"
,
"//modules/planning/common:obstacle"
,
"//modules/planning/common:planning_gflags"
,
...
...
modules/planning/optimizer/st_graph/st_boundary_mapper.cc
浏览文件 @
bbfec7e1
...
...
@@ -66,8 +66,9 @@ StBoundaryMapper::StBoundaryMapper(
planning_time_
(
planning_time
)
{}
Status
StBoundaryMapper
::
GetGraphBoundary
(
const
DecisionData
&
decision_data
,
const
PathDecision
&
path_decision
,
std
::
vector
<
StGraphBoundary
>*
const
st_graph_boundaries
)
const
{
const
auto
&
path_obstacles
=
path_decision
.
path_obstacles
();
if
(
st_graph_boundaries
==
nullptr
)
{
const
std
::
string
msg
=
"st_graph_boundaries is NULL."
;
AERROR
<<
msg
;
...
...
@@ -91,42 +92,33 @@ Status StBoundaryMapper::GetGraphBoundary(
st_graph_boundaries
->
clear
();
Status
ret
=
Status
::
OK
();
// TODO: enable mapping for static obstacles.
/*
const auto& static_obs_vec = decision_data.StaticObstacles();
for (const auto* obs : static_obs_vec) {
ret = MapStopDecision(*obs, path_data_, planning_distance_,
planning_time_, st_graph_boundaries);
if (!ret.ok()) {
AERROR << "Fail to map static obstacle with id[" << obs->Id() << "].";
return Status(ErrorCode::PLANNING_ERROR, "Fail to map static obstacle");
}
}
*/
const
auto
&
dynamic_obs_vec
=
decision_data
.
DynamicObstacles
();
for
(
const
auto
*
obs
:
dynamic_obs_vec
)
{
if
(
obs
==
nullptr
)
{
continue
;
}
for
(
auto
&
obj_decision
:
obs
->
Decisions
())
{
if
(
obj_decision
.
has_follow
())
{
ret
=
MapObstacleWithoutPredictionTrajectory
(
*
obs
,
obj_decision
,
st_graph_boundaries
);
if
(
!
ret
.
ok
())
{
AERROR
<<
"Fail to map follow dynamic obstacle with id "
<<
obs
->
Id
()
<<
"."
;
for
(
const
auto
path_obstacle
:
path_obstacles
.
Items
())
{
const
auto
&
obstacle
=
*
path_obstacle
->
Obstacle
();
for
(
const
auto
&
decision
:
path_obstacle
->
Decisions
())
{
StGraphBoundary
boundary
;
if
(
decision
.
has_follow
())
{
const
auto
ret
=
MapFollowDecision
(
obstacle
,
decision
,
&
boundary
);
if
(
ret
.
ok
())
{
AERROR
<<
"Fail to map obstacle "
<<
path_obstacle
->
Id
()
<<
" with follow decision: "
<<
decision
.
DebugString
();
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"Fail to map follow d
ynamic obstacle
"
);
"Fail to map follow d
ecision
"
);
}
}
else
if
(
obj_decision
.
has_overtake
()
||
obj_decision
.
has_yield
())
{
ret
=
MapObstacleWithPredictionTrajectory
(
*
obs
,
obj_decision
,
st_graph_boundaries
);
}
else
if
(
decision
.
has_stop
())
{
// TODO implement this function
}
else
if
(
decision
.
has_overtake
()
||
decision
.
has_yield
())
{
const
auto
ret
=
MapObstacleWithPredictionTrajectory
(
obstacle
,
decision
,
st_graph_boundaries
);
if
(
!
ret
.
ok
())
{
AERROR
<<
"Fail to map dynamic obstacle with id "
<<
obs
->
Id
()
<<
"."
;
// Return OK by intention.
return
Status
::
OK
();
AERROR
<<
"Fail to map obstacle "
<<
path_obstacle
->
Id
()
<<
" with decision: "
<<
decision
.
DebugString
();
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"Fail to map overtake/yield decision"
);
}
}
else
{
AERROR
<<
"could not map unkown decision type "
<<
decision
.
DebugString
();
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
"unkown decision: "
);
}
}
}
...
...
@@ -134,7 +126,7 @@ Status StBoundaryMapper::GetGraphBoundary(
}
Status
StBoundaryMapper
::
MapObstacleWithPredictionTrajectory
(
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
obj_decision
,
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
&
obj_decision
,
std
::
vector
<
StGraphBoundary
>*
const
boundary
)
const
{
std
::
vector
<
STPoint
>
lower_points
;
std
::
vector
<
STPoint
>
upper_points
;
...
...
@@ -264,12 +256,13 @@ Status StBoundaryMapper::MapObstacleWithPredictionTrajectory(
:
Status
::
OK
();
}
Status
StBoundaryMapper
::
Map
ObstacleWithoutPredictionTrajectory
(
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
obj_decision
,
std
::
vector
<
StGraphBoundary
>
*
const
boundary
)
const
{
Status
StBoundaryMapper
::
Map
FollowDecision
(
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
&
obj_decision
,
StGraphBoundary
*
const
boundary
)
const
{
if
(
!
obj_decision
.
has_follow
())
{
std
::
string
msg
=
common
::
util
::
StrCat
(
"Map obstacle without prediction trajectory is ONLY supported when the "
"Map obstacle without prediction trajectory is ONLY supported when "
"the "
"object decision is follow. The current object decision is:
\n
"
,
obj_decision
.
DebugString
());
AERROR
<<
msg
;
...
...
@@ -330,7 +323,7 @@ Status StBoundaryMapper::MapObstacleWithoutPredictionTrajectory(
AINFO
<<
msg
;
return
Status
(
ErrorCode
::
PLANNING_SKIP
,
msg
);
}
boundary
->
emplace_back
(
boundary_points
);
*
boundary
=
StGraphBoundary
(
boundary_points
);
const
double
characteristic_length
=
std
::
fmax
(
scalar_speed
*
speed_coeff
*
...
...
@@ -339,9 +332,9 @@ Status StBoundaryMapper::MapObstacleWithoutPredictionTrajectory(
vehicle_param_
.
front_edge_to_center
()
+
st_boundary_config_
.
follow_buffer
();
boundary
->
back
().
SetCharacteristicLength
(
characteristic_length
*
st_boundary_config_
.
follow_coeff
());
boundary
->
back
().
SetBoundaryType
(
StGraphBoundary
::
BoundaryType
::
FOLLOW
);
boundary
->
SetCharacteristicLength
(
characteristic_length
*
st_boundary_config_
.
follow_coeff
());
boundary
->
SetBoundaryType
(
StGraphBoundary
::
BoundaryType
::
FOLLOW
);
return
Status
::
OK
();
}
...
...
modules/planning/optimizer/st_graph/st_boundary_mapper.h
浏览文件 @
bbfec7e1
...
...
@@ -27,8 +27,8 @@
#include "modules/common/status/status.h"
#include "modules/planning/proto/st_boundary_config.pb.h"
#include "modules/planning/common/decision_data.h"
#include "modules/planning/common/path/path_data.h"
#include "modules/planning/common/path_decision.h"
#include "modules/planning/common/speed_limit.h"
#include "modules/planning/optimizer/st_graph/st_graph_boundary.h"
#include "modules/planning/reference_line/reference_line.h"
...
...
@@ -45,7 +45,7 @@ class StBoundaryMapper {
const
double
planning_distance
,
const
double
planning_time
);
apollo
::
common
::
Status
GetGraphBoundary
(
const
DecisionData
&
decision_data
,
const
PathDecision
&
path_decision
,
std
::
vector
<
StGraphBoundary
>*
const
boundary
)
const
;
virtual
apollo
::
common
::
Status
GetSpeedLimits
(
...
...
@@ -59,12 +59,12 @@ class StBoundaryMapper {
double
GetArea
(
const
std
::
vector
<
STPoint
>&
boundary_points
)
const
;
apollo
::
common
::
Status
MapObstacleWithPredictionTrajectory
(
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
obj_decision
,
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
&
obj_decision
,
std
::
vector
<
StGraphBoundary
>*
const
boundary
)
const
;
apollo
::
common
::
Status
Map
ObstacleWithoutPredictionTrajectory
(
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
obj_decision
,
std
::
vector
<
StGraphBoundary
>
*
const
boundary
)
const
;
apollo
::
common
::
Status
Map
FollowDecision
(
const
Obstacle
&
obstacle
,
const
ObjectDecisionType
&
obj_decision
,
StGraphBoundary
*
const
boundary
)
const
;
private:
StBoundaryConfig
st_boundary_config_
;
...
...
modules/planning/optimizer/st_graph/st_graph_boundary.h
浏览文件 @
bbfec7e1
...
...
@@ -34,6 +34,7 @@ namespace planning {
class
StGraphBoundary
:
public
common
::
math
::
Polygon2d
{
public:
StGraphBoundary
()
=
default
;
// if you need to add boundary type, make sure you modify
// GetUnblockSRange accordingly.
enum
class
BoundaryType
{
...
...
modules/planning/planner/em/em_planner.cc
浏览文件 @
bbfec7e1
...
...
@@ -126,11 +126,9 @@ Status EMPlanner::Plan(const TrajectoryPoint& planning_start_point,
ADEBUG
<<
"planning start point:"
<<
planning_start_point
.
DebugString
();
auto
*
planning_data
=
frame
->
mutable_planning_data
();
std
::
shared_ptr
<
DecisionData
>
decision_data
(
new
DecisionData
());
planning_data
->
set_decision_data
(
decision_data
);
auto
ptr_debug
=
frame
->
MutableADCTrajectory
()
->
mutable_debug
();
auto
ptr_latency_stats
=
frame
->
MutableADCTrajectory
()
->
mutable_latency_stats
();
auto
ptr_latency_stats
=
frame
->
MutableADCTrajectory
()
->
mutable_latency_stats
();
for
(
auto
&
optimizer
:
optimizers_
)
{
const
double
start_timestamp
=
apollo
::
common
::
time
::
ToSecond
(
Clock
::
Now
());
optimizer
->
Optimize
(
frame
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录