Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
e1d2f4ea
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,发现更多精彩内容 >>
提交
e1d2f4ea
编写于
10月 31, 2017
作者:
Z
Zhang Liangliang
提交者:
Liangliang Zhang
10月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Planning: restructured codes for two types of smoother (qp_spline and spiral).
上级
c459326d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
42 addition
and
80 deletion
+42
-80
modules/planning/common/frame.cc
modules/planning/common/frame.cc
+11
-16
modules/planning/reference_line/qp_spline_reference_line_smoother.cc
...nning/reference_line/qp_spline_reference_line_smoother.cc
+4
-13
modules/planning/reference_line/qp_spline_reference_line_smoother.h
...anning/reference_line/qp_spline_reference_line_smoother.h
+4
-8
modules/planning/reference_line/qp_spline_reference_line_smoother_test.cc
.../reference_line/qp_spline_reference_line_smoother_test.cc
+2
-5
modules/planning/reference_line/reference_line_provider.cc
modules/planning/reference_line/reference_line_provider.cc
+11
-15
modules/planning/reference_line/reference_line_smoother.h
modules/planning/reference_line/reference_line_smoother.h
+1
-13
modules/planning/reference_line/spiral_reference_line_smoother.cc
...planning/reference_line/spiral_reference_line_smoother.cc
+6
-5
modules/planning/reference_line/spiral_reference_line_smoother.h
.../planning/reference_line/spiral_reference_line_smoother.h
+3
-4
modules/planning/tasks/st_graph/st_boundary_mapper_test.cc
modules/planning/tasks/st_graph/st_boundary_mapper_test.cc
+0
-1
未找到文件。
modules/planning/common/frame.cc
浏览文件 @
e1d2f4ea
...
...
@@ -294,30 +294,25 @@ bool Frame::CreateReferenceLineFromRouting(
return
false
;
}
QpSplineReferenceLineSmoother
smoother
;
std
::
unique_ptr
<
ReferenceLineSmoother
>
smoother
;
std
::
vector
<
double
>
init_t_knots
;
Spline2dSolver
spline_solver
(
init_t_knots
,
smoother_config_
.
spline_order
());
smoother
.
Init
(
smoother_config_
,
&
spline_solver
);
SpiralReferenceLineSmoother
spiral_smoother
;
double
max_spiral_smoother_dev
=
0.1
;
spiral_smoother
.
Init
(
max_spiral_smoother_dev
);
if
(
FLAGS_enable_spiral_reference_line
)
{
double
max_deviation
=
0.1
;
smoother
.
reset
(
new
SpiralReferenceLineSmoother
(
max_deviation
));
}
else
{
smoother
.
reset
(
new
QpSplineReferenceLineSmoother
(
smoother_config_
,
&
spline_solver
));
}
for
(
const
auto
&
each_segments
:
route_segments
)
{
hdmap
::
Path
hdmap_path
;
hdmap
::
PncMap
::
CreatePathFromLaneSegments
(
each_segments
,
&
hdmap_path
);
if
(
FLAGS_enable_smooth_reference_line
)
{
ReferenceLine
reference_line
;
if
(
FLAGS_enable_spiral_reference_line
)
{
if
(
!
spiral_smoother
.
Smooth
(
ReferenceLine
(
hdmap_path
),
&
reference_line
))
{
AERROR
<<
"Failed to smooth reference_line with spiral smoother"
;
}
}
else
{
if
(
!
smoother
.
Smooth
(
ReferenceLine
(
hdmap_path
),
&
reference_line
))
{
AERROR
<<
"Failed to smooth reference line"
;
continue
;
}
if
(
!
smoother
->
Smooth
(
ReferenceLine
(
hdmap_path
),
&
reference_line
))
{
AERROR
<<
"Failed to smooth reference line"
;
continue
;
}
reference_lines
->
emplace_back
(
std
::
move
(
reference_line
));
segments
->
emplace_back
(
each_segments
);
...
...
modules/planning/reference_line/qp_spline_reference_line_smoother.cc
浏览文件 @
e1d2f4ea
...
...
@@ -35,20 +35,11 @@
namespace
apollo
{
namespace
planning
{
void
QpSplineReferenceLineSmoother
::
Init
(
const
std
::
string
&
config_file
,
Spline2dSolver
*
const
spline_solver
)
{
if
(
!
common
::
util
::
GetProtoFromFile
(
config_file
,
&
smoother_config_
))
{
AERROR
<<
"failed to load config file "
<<
config_file
;
return
;
}
spline_solver_
=
spline_solver
;
}
void
QpSplineReferenceLineSmoother
::
Init
(
QpSplineReferenceLineSmoother
::
QpSplineReferenceLineSmoother
(
const
QpSplineReferenceLineSmootherConfig
&
config
,
Spline2dSolver
*
const
spline_solver
)
{
smoother_config_
=
config
;
spline_solver_
=
spline_solver
;
Spline2dSolver
*
const
spline_solver
)
:
smoother_config_
(
config
),
spline_solver_
(
spline_solver
)
{
CHECK_NOTNULL
(
spline_solver
)
;
}
void
QpSplineReferenceLineSmoother
::
Clear
()
{
...
...
modules/planning/reference_line/qp_spline_reference_line_smoother.h
浏览文件 @
e1d2f4ea
...
...
@@ -36,17 +36,13 @@
namespace
apollo
{
namespace
planning
{
class
QpSplineReferenceLineSmoother
:
ReferenceLineSmoother
{
class
QpSplineReferenceLineSmoother
:
public
ReferenceLineSmoother
{
public:
QpSplineReferenceLineSmoother
()
=
default
;
QpSplineReferenceLineSmoother
(
const
QpSplineReferenceLineSmootherConfig
&
config
,
Spline2dSolver
*
const
spline_solver
);
virtual
~
QpSplineReferenceLineSmoother
()
=
default
;
void
Init
(
const
std
::
string
&
config_file
,
Spline2dSolver
*
const
spline_solver
)
override
;
void
Init
(
const
QpSplineReferenceLineSmootherConfig
&
refline_smooth_config
,
Spline2dSolver
*
const
spline_solver
)
override
;
bool
Smooth
(
const
ReferenceLine
&
raw_reference_line
,
ReferenceLine
*
const
smoothed_reference_line
)
override
;
...
...
modules/planning/reference_line/qp_spline_reference_line_smoother_test.cc
浏览文件 @
e1d2f4ea
...
...
@@ -42,10 +42,6 @@ class QpSplineReferenceLineSmootherTest : public ::testing::Test {
AERROR
<<
"failed to find lane "
<<
lane_id
<<
" from map "
<<
map_file
;
return
;
}
QpSplineReferenceLineSmootherConfig
config
;
smoother_
.
Init
(
config
,
&
spline_solver_
);
// use the default value in config.
std
::
vector
<
ReferencePoint
>
ref_points
;
const
auto
&
points
=
lane_info_ptr
->
points
();
const
auto
&
headings
=
lane_info_ptr
->
headings
();
...
...
@@ -64,10 +60,11 @@ class QpSplineReferenceLineSmootherTest : public ::testing::Test {
"modules/planning/testdata/garage_map/base_map.txt"
;
hdmap
::
HDMap
hdmap_
;
QpSplineReferenceLineSmoother
smoother_
;
common
::
math
::
Vec2d
vehicle_position_
;
std
::
vector
<
double
>
t_knots_
;
Spline2dSolver
spline_solver_
{
t_knots_
,
5
};
QpSplineReferenceLineSmootherConfig
config_
;
QpSplineReferenceLineSmoother
smoother_
{
config_
,
&
spline_solver_
};
std
::
unique_ptr
<
ReferenceLine
>
reference_line_
;
hdmap
::
LaneInfoConstPtr
lane_info_ptr
=
nullptr
;
};
...
...
modules/planning/reference_line/reference_line_provider.cc
浏览文件 @
e1d2f4ea
...
...
@@ -145,12 +145,14 @@ bool ReferenceLineProvider::CreateReferenceLineFromRouting() {
}
}
QpSplineReferenceLineSmoother
smoother
;
smoother
.
Init
(
smoother_config_
,
spline_solver_
.
get
());
SpiralReferenceLineSmoother
spiral_smoother
;
double
max_spiral_smoother_dev
=
0.1
;
spiral_smoother
.
Init
(
max_spiral_smoother_dev
);
std
::
unique_ptr
<
ReferenceLineSmoother
>
smoother
;
if
(
FLAGS_enable_spiral_reference_line
)
{
double
max_deviation
=
0.1
;
smoother
.
reset
(
new
SpiralReferenceLineSmoother
(
max_deviation
));
}
else
{
smoother
.
reset
(
new
QpSplineReferenceLineSmoother
(
smoother_config_
,
spline_solver_
.
get
()));
}
std
::
vector
<
ReferenceLine
>
reference_lines
;
std
::
vector
<
hdmap
::
RouteSegments
>
segments
;
...
...
@@ -160,15 +162,9 @@ bool ReferenceLineProvider::CreateReferenceLineFromRouting() {
if
(
FLAGS_enable_smooth_reference_line
)
{
ReferenceLine
raw_reference_line
(
hdmap_path
);
ReferenceLine
reference_line
;
if
(
FLAGS_enable_spiral_reference_line
)
{
if
(
!
spiral_smoother
.
Smooth
(
raw_reference_line
,
&
reference_line
))
{
AERROR
<<
"Failed to smooth reference_line with spiral smoother"
;
}
}
else
{
if
(
!
smoother
.
Smooth
(
raw_reference_line
,
&
reference_line
))
{
AERROR
<<
"Failed to smooth reference line"
;
continue
;
}
if
(
!
smoother
->
Smooth
(
raw_reference_line
,
&
reference_line
))
{
AERROR
<<
"Failed to smooth reference line"
;
continue
;
}
bool
is_valid_reference_line
=
true
;
...
...
modules/planning/reference_line/reference_line_smoother.h
浏览文件 @
e1d2f4ea
...
...
@@ -21,16 +21,7 @@
#ifndef MODULES_PLANNING_REFERENCE_LINE_REFERENCE_LINE_SMOOTHER_H_
#define MODULES_PLANNING_REFERENCE_LINE_REFERENCE_LINE_SMOOTHER_H_
#include <memory>
#include <string>
#include <vector>
#include "modules/planning/proto/planning.pb.h"
#include "modules/planning/proto/qp_spline_reference_line_smoother_config.pb.h"
#include "modules/planning/math/smoothing_spline/spline_2d_solver.h"
#include "modules/planning/reference_line/reference_line.h"
#include "modules/planning/reference_line/reference_point.h"
namespace
apollo
{
namespace
planning
{
...
...
@@ -38,12 +29,9 @@ namespace planning {
class
ReferenceLineSmoother
{
public:
ReferenceLineSmoother
()
=
default
;
virtual
~
ReferenceLineSmoother
()
=
default
;
virtual
void
Init
(
const
std
::
string
&
,
Spline2dSolver
*
const
)
{}
virtual
void
Init
(
const
QpSplineReferenceLineSmootherConfig
&
,
Spline2dSolver
*
const
)
{}
virtual
void
Init
(
const
double
max_point_deviation_distance
)
{}
virtual
bool
Smooth
(
const
ReferenceLine
&
,
ReferenceLine
*
const
)
=
0
;
};
...
...
modules/planning/reference_line/spiral_reference_line_smoother.cc
浏览文件 @
e1d2f4ea
...
...
@@ -34,6 +34,12 @@
namespace
apollo
{
namespace
planning
{
SpiralReferenceLineSmoother
::
SpiralReferenceLineSmoother
(
const
double
max_point_deviation
)
:
max_point_deviation_
(
max_point_deviation
)
{
CHECK
(
max_point_deviation
>=
0.0
);
}
bool
SpiralReferenceLineSmoother
::
Smooth
(
const
ReferenceLine
&
raw_reference_line
,
ReferenceLine
*
const
smoothed_reference_line
)
{
...
...
@@ -171,11 +177,6 @@ bool SpiralReferenceLineSmoother::Smooth(
status
==
Ipopt
::
Solved_To_Acceptable_Level
;
}
void
SpiralReferenceLineSmoother
::
Init
(
const
double
max_point_deviation
)
{
CHECK
(
max_point_deviation
>=
0.0
);
max_point_deviation_
=
max_point_deviation
;
}
std
::
vector
<
common
::
PathPoint
>
SpiralReferenceLineSmoother
::
to_path_points
(
const
double
start_x
,
const
double
start_y
,
const
double
start_s
,
const
double
theta0
,
const
double
kappa0
,
const
double
dkappa0
,
...
...
modules/planning/reference_line/spiral_reference_line_smoother.h
浏览文件 @
e1d2f4ea
...
...
@@ -34,13 +34,12 @@
namespace
apollo
{
namespace
planning
{
class
SpiralReferenceLineSmoother
:
ReferenceLineSmoother
{
class
SpiralReferenceLineSmoother
:
public
ReferenceLineSmoother
{
public:
SpiralReferenceLineSmoother
()
=
default
;
explicit
SpiralReferenceLineSmoother
(
const
double
max_point_deviation_distance
);
virtual
~
SpiralReferenceLineSmoother
()
=
default
;
void
Init
(
const
double
max_point_deviation_distance
)
override
;
bool
Smooth
(
const
ReferenceLine
&
raw_reference_line
,
ReferenceLine
*
const
smoothed_reference_line
)
override
;
...
...
modules/planning/tasks/st_graph/st_boundary_mapper_test.cc
浏览文件 @
e1d2f4ea
...
...
@@ -72,7 +72,6 @@ class StBoundaryMapperTest : public ::testing::Test {
const
std
::
string
map_file
=
"modules/planning/testdata/garage_map/base_map.txt"
;
hdmap
::
HDMap
hdmap_
;
QpSplineReferenceLineSmoother
smoother_
;
common
::
math
::
Vec2d
vehicle_position_
;
std
::
unique_ptr
<
ReferenceLine
>
reference_line_
;
hdmap
::
LaneInfoConstPtr
lane_info_ptr
=
nullptr
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录