Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
6758a7c0
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,发现更多精彩内容 >>
提交
6758a7c0
编写于
7月 24, 2017
作者:
J
Jiangtao Hu
提交者:
lianglia-apollo
7月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
integrate reference line smoother into em planner.
上级
b0de8330
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
80 addition
and
2 deletion
+80
-2
modules/planning/planner/em/BUILD
modules/planning/planner/em/BUILD
+4
-0
modules/planning/planner/em/em_planner.cc
modules/planning/planner/em/em_planner.cc
+55
-1
modules/planning/planner/em/em_planner.h
modules/planning/planner/em/em_planner.h
+12
-1
modules/planning/reference_line/reference_line.cc
modules/planning/reference_line/reference_line.cc
+7
-0
modules/planning/reference_line/reference_line.h
modules/planning/reference_line/reference_line.h
+2
-0
未找到文件。
modules/planning/planner/em/BUILD
浏览文件 @
6758a7c0
...
...
@@ -18,6 +18,7 @@ cc_library(
"//modules/common/util"
,
"//modules/common/util:factory"
,
"//modules/common/vehicle_state"
,
"//modules/map/hdmap"
,
"//modules/planning/common:planning_common"
,
"//modules/planning/math/curve1d:quartic_polynomial_curve1d"
,
"//modules/planning/optimizer"
,
...
...
@@ -28,6 +29,9 @@ cc_library(
"//modules/planning/optimizer/qp_spline_path"
,
"//modules/planning/planner"
,
"//modules/planning/proto:planning_proto"
,
"//modules/planning/proxy:routing_proxy"
,
"//modules/planning/reference_line"
,
"//modules/planning/reference_line:reference_line_smoother"
,
"@eigen//:eigen"
,
],
)
...
...
modules/planning/planner/em/em_planner.cc
浏览文件 @
6758a7c0
...
...
@@ -22,6 +22,8 @@
#include "modules/common/log.h"
#include "modules/common/util/string_tokenizer.h"
#include "modules/map/hdmap/hdmap.h"
#include "modules/map/hdmap/hdmap_common.h"
#include "modules/planning/common/data_center.h"
#include "modules/planning/common/frame.h"
#include "modules/planning/common/planning_gflags.h"
...
...
@@ -62,6 +64,10 @@ Status EMPlanner::Init(const PlanningConfig& config) {
optimizers_
.
emplace_back
(
optimizer_factory_
.
CreateObject
(
config
.
em_planner_config
().
optimizer
(
i
)));
}
routing_proxy_
.
Init
();
smoother_
.
SetConfig
(
smoother_config_
);
// use the default value in config.
// FIXME(all): switch to real routing when it is ready
GenerateReferenceLineFromRouting
(
routing_proxy_
);
return
Status
::
OK
();
}
...
...
@@ -77,7 +83,10 @@ Status EMPlanner::MakePlan(const TrajectoryPoint& start_point,
ADEBUG
<<
"start point:"
<<
start_point
.
DebugString
();
frame
->
mutable_planning_data
()
->
set_init_planning_point
(
start_point
);
// frame->mutable_planning_data()->set_reference_line(reference_line);
if
(
reference_line_
)
{
ADEBUG
<<
"reference line:"
<<
reference_line_
->
DebugString
();
}
frame
->
mutable_planning_data
()
->
set_reference_line
(
reference_line_
);
// frame->mutable_planning_data()->set_decision_data(decision_data);
for
(
auto
&
optimizer
:
optimizers_
)
{
optimizer
->
Optimize
(
frame
->
mutable_planning_data
());
...
...
@@ -135,5 +144,50 @@ std::vector<SpeedPoint> EMPlanner::GenerateInitSpeedProfile(
return
std
::
move
(
speed_profile
);
}
Status
EMPlanner
::
GenerateReferenceLineFromRouting
(
const
RoutingProxy
&
routing_proxy
)
{
DataCenter
*
data_center
=
DataCenter
::
instance
();
const
auto
&
routing_result
=
routing_proxy
.
routing
();
const
auto
&
map
=
data_center
->
map
();
std
::
vector
<
ReferencePoint
>
ref_points
;
common
::
math
::
Vec2d
vehicle_position
;
hdmap
::
LaneInfoConstPtr
lane_info_ptr
=
nullptr
;
for
(
const
auto
&
lane
:
routing_result
.
route
())
{
hdmap
::
Id
lane_id
;
lane_id
.
set_id
(
lane
.
id
());
lane_info_ptr
=
map
.
get_lane_by_id
(
lane_id
);
if
(
!
lane_info_ptr
)
{
std
::
string
msg
(
"failed to find lane "
+
lane
.
id
()
+
" from map "
);
AERROR
<<
msg
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
}
const
auto
&
points
=
lane_info_ptr
->
points
();
const
auto
&
headings
=
lane_info_ptr
->
headings
();
for
(
size_t
i
=
0
;
i
<
points
.
size
();
++
i
)
{
ref_points
.
emplace_back
(
points
[
i
],
headings
[
i
],
0.0
,
0.0
,
-
2.0
,
2.0
);
}
// FIXME(all): need vehicle position to smooth?
vehicle_position
=
points
[
0
];
}
if
(
ref_points
.
empty
())
{
std
::
string
msg
(
"Found no reference points from map"
);
AERROR
<<
msg
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
}
std
::
unique_ptr
<
ReferenceLine
>
reference_line
(
new
ReferenceLine
(
ref_points
));
std
::
vector
<
ReferencePoint
>
smoothed_ref_points
;
if
(
!
smoother_
.
smooth
(
*
reference_line
,
vehicle_position
,
&
smoothed_ref_points
))
{
std
::
string
msg
(
"Fail to smooth a reference line from map"
);
AERROR
<<
msg
;
return
Status
(
ErrorCode
::
PLANNING_ERROR
,
msg
);
}
reference_line_
.
reset
(
new
ReferenceLine
(
smoothed_ref_points
));
return
Status
::
OK
();
}
}
// namespace planning
}
// namespace apollo
modules/planning/planner/em/em_planner.h
浏览文件 @
6758a7c0
...
...
@@ -28,7 +28,10 @@
#include "modules/planning/planner/planner.h"
#include "modules/planning/proto/planning.pb.h"
#include "modules/planning/proto/planning_config.pb.h"
#include "modules/planning/proxy/routing_proxy.h"
#include "modules/planning/reference_line/reference_line.h"
#include "modules/planning/reference_line/reference_line_smoother.h"
#include "modules/planning/reference_line/reference_point.h"
/**
* @namespace apollo::planning
* @brief apollo::planning
...
...
@@ -71,10 +74,18 @@ class EMPlanner : public Planner {
std
::
vector
<
SpeedPoint
>
GenerateInitSpeedProfile
(
const
double
init_v
,
const
double
init_a
);
apollo
::
common
::
Status
GenerateReferenceLineFromRouting
(
const
RoutingProxy
&
routing_proxy
);
private:
apollo
::
common
::
util
::
Factory
<
OptimizerType
,
Optimizer
>
optimizer_factory_
;
std
::
vector
<
std
::
unique_ptr
<
Optimizer
>>
optimizers_
;
// FIXME(all): replace RoutingProxy with RoutingAdapter when
// routing is ready.
RoutingProxy
routing_proxy_
;
ReferenceLineSmootherConfig
smoother_config_
;
ReferenceLineSmoother
smoother_
;
std
::
unique_ptr
<
ReferenceLine
>
reference_line_
;
};
}
// namespace planning
...
...
modules/planning/reference_line/reference_line.cc
浏览文件 @
6758a7c0
...
...
@@ -20,6 +20,7 @@
#include "modules/planning/reference_line/reference_line.h"
#include <sstream>
#include <string>
#include <utility>
#include <vector>
...
...
@@ -225,5 +226,11 @@ bool ReferenceLine::is_on_road(const common::SLPoint& sl_point) const {
return
true
;
}
std
::
string
ReferenceLine
::
DebugString
()
const
{
std
::
ostringstream
ss
;
ss
<<
"point num:"
<<
reference_points_
.
size
();
return
ss
.
str
();
}
}
// namespace planning
}
// namespace apollo
modules/planning/reference_line/reference_line.h
浏览文件 @
6758a7c0
...
...
@@ -57,6 +57,8 @@ class ReferenceLine {
double
get_lane_width
(
const
double
s
)
const
;
bool
is_on_road
(
const
common
::
SLPoint
&
sl_point
)
const
;
std
::
string
DebugString
()
const
;
private:
static
ReferencePoint
interpolate
(
const
ReferencePoint
&
p0
,
const
double
s0
,
const
ReferencePoint
&
p1
,
const
double
s1
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录