Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
5c5226d0
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,发现更多精彩内容 >>
提交
5c5226d0
编写于
4月 06, 2018
作者:
D
Dong Li
提交者:
Liangliang Zhang
4月 06, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: fix navigation mode planning trajectory stitching problem
上级
748dde41
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
523 addition
and
486 deletion
+523
-486
modules/common/math/quaternion.h
modules/common/math/quaternion.h
+2
-2
modules/common/math/quaternion_test.cc
modules/common/math/quaternion_test.cc
+1
-1
modules/map/hdmap/hdmap.cc
modules/map/hdmap/hdmap.cc
+2
-2
modules/planning/common/trajectory/discretized_trajectory.cc
modules/planning/common/trajectory/discretized_trajectory.cc
+5
-0
modules/planning/common/trajectory/discretized_trajectory.h
modules/planning/common/trajectory/discretized_trajectory.h
+3
-0
modules/planning/common/trajectory/trajectory_stitcher.cc
modules/planning/common/trajectory/trajectory_stitcher.cc
+39
-2
modules/planning/common/trajectory/trajectory_stitcher.h
modules/planning/common/trajectory/trajectory_stitcher.h
+3
-0
modules/planning/planning.cc
modules/planning/planning.cc
+7
-20
modules/planning/tasks/traffic_decider/traffic_decider.cc
modules/planning/tasks/traffic_decider/traffic_decider.cc
+1
-1
modules/planning/testdata/navigation_mode_test/result_cruise_0.pb.txt
...ning/testdata/navigation_mode_test/result_cruise_0.pb.txt
+457
-457
scripts/filter_planning.sh
scripts/filter_planning.sh
+3
-1
未找到文件。
modules/common/math/quaternion.h
浏览文件 @
5c5226d0
...
...
@@ -71,7 +71,7 @@ inline double QuaternionToHeading(const double qw, const double qx,
* @return Heading encoded by given quaternion
*/
template
<
typename
T
>
inline
double
QuaternionToHeading
(
const
Eigen
::
Quaternion
<
T
>
&
q
)
{
inline
T
QuaternionToHeading
(
const
Eigen
::
Quaternion
<
T
>
&
q
)
{
return
QuaternionToHeading
(
q
.
w
(),
q
.
x
(),
q
.
y
(),
q
.
z
());
}
...
...
@@ -86,7 +86,7 @@ inline double QuaternionToHeading(const Eigen::Quaternion<T> &q) {
* @return Quaternion encoding rotation by given heading
*/
template
<
typename
T
>
inline
Eigen
::
Quaternion
<
T
>
HeadingToQuaternion
(
const
double
heading
)
{
inline
Eigen
::
Quaternion
<
T
>
HeadingToQuaternion
(
T
heading
)
{
// Note that heading is zero at East and yaw is zero at North.
EulerAnglesZXY
<
T
>
euler_angles
(
heading
-
M_PI_2
);
return
euler_angles
.
ToQuaternion
();
...
...
modules/common/math/quaternion_test.cc
浏览文件 @
5c5226d0
...
...
@@ -36,7 +36,7 @@ TEST(QuaternionTest, QuaternionToHeading) {
QuaternionToHeading
(
v
,
0.0
,
0.0
,
v
));
// Pointing to west.
Eigen
::
Quaternionf
q
(
1.0
,
0.0
,
0.0
,
0.0
);
EXPECT_
DOUBLE
_EQ
(
M_PI_2
,
QuaternionToHeading
(
q
));
// Pointing to north.
EXPECT_
FLOAT
_EQ
(
M_PI_2
,
QuaternionToHeading
(
q
));
// Pointing to north.
const
double
headings
[]
=
{
-
3.3
,
-
2.2
,
-
1.1
,
1.2
,
2.3
,
3.4
,
4.5
,
5.6
,
6.7
};
for
(
double
heading
:
headings
)
{
...
...
modules/map/hdmap/hdmap.cc
浏览文件 @
5c5226d0
...
...
@@ -26,8 +26,8 @@ int HDMap::LoadMapFromFile(const std::string& map_filename) {
}
int
HDMap
::
LoadMapFromProto
(
const
Map
&
map_proto
)
{
A
INFO
<<
"Loading HDMap with header: "
<<
map_proto
.
header
().
ShortDebugString
();
A
DEBUG
<<
"Loading HDMap with header: "
<<
map_proto
.
header
().
ShortDebugString
();
return
impl_
.
LoadMapFromProto
(
map_proto
);
}
...
...
modules/planning/common/trajectory/discretized_trajectory.cc
浏览文件 @
5c5226d0
...
...
@@ -162,6 +162,11 @@ const std::vector<TrajectoryPoint>& DiscretizedTrajectory::trajectory_points()
return
trajectory_points_
;
}
void
DiscretizedTrajectory
::
SetTrajectoryPoints
(
const
std
::
vector
<
common
::
TrajectoryPoint
>&
trajectory_points
)
{
trajectory_points_
=
trajectory_points
;
}
void
DiscretizedTrajectory
::
Clear
()
{
trajectory_points_
.
clear
();
}
}
// namespace planning
...
...
modules/planning/common/trajectory/discretized_trajectory.h
浏览文件 @
5c5226d0
...
...
@@ -43,6 +43,9 @@ class DiscretizedTrajectory : public Trajectory {
explicit
DiscretizedTrajectory
(
const
std
::
vector
<
common
::
TrajectoryPoint
>&
trajectory_points
);
void
SetTrajectoryPoints
(
const
std
::
vector
<
common
::
TrajectoryPoint
>&
trajectory_points
);
virtual
~
DiscretizedTrajectory
()
=
default
;
common
::
TrajectoryPoint
Evaluate
(
const
double
relative_time
)
const
override
;
...
...
modules/planning/common/trajectory/trajectory_stitcher.cc
浏览文件 @
5c5226d0
...
...
@@ -25,6 +25,7 @@
#include "modules/common/configs/config_gflags.h"
#include "modules/common/log.h"
#include "modules/common/math/quaternion.h"
#include "modules/common/util/util.h"
#include "modules/planning/common/planning_gflags.h"
...
...
@@ -52,6 +53,44 @@ TrajectoryStitcher::ComputeReinitStitchingTrajectory(
return
std
::
vector
<
TrajectoryPoint
>
(
1
,
init_point
);
}
void
TrajectoryStitcher
::
TransformLastPublishedTrajectory
(
const
double
current_time
,
PublishableTrajectory
*
prev_trajectory
)
{
if
(
!
prev_trajectory
)
{
return
;
}
std
::
size_t
prev_trajectory_size
=
prev_trajectory
->
NumOfPoints
();
if
(
prev_trajectory_size
<=
1
)
{
return
;
}
const
double
time_diff
=
current_time
-
prev_trajectory
->
header_time
();
auto
matched_point
=
prev_trajectory
->
EvaluateUsingLinearApproximation
(
time_diff
);
if
(
!
matched_point
.
has_path_point
())
{
return
;
}
const
double
cos_theta
=
std
::
cos
(
-
matched_point
.
path_point
().
theta
());
const
double
sin_theta
=
std
::
sin
(
-
matched_point
.
path_point
().
theta
());
std
::
vector
<
TrajectoryPoint
>
transformed_points
;
for
(
const
auto
&
old_point
:
prev_trajectory
->
trajectory_points
())
{
TrajectoryPoint
point
=
old_point
;
Eigen
::
Vector3d
before_rotate
(
old_point
.
path_point
().
x
()
-
matched_point
.
path_point
().
x
(),
old_point
.
path_point
().
y
()
-
matched_point
.
path_point
().
y
(),
old_point
.
path_point
().
z
()
-
matched_point
.
path_point
().
z
());
const
double
after_rotate_x
=
before_rotate
.
x
()
*
cos_theta
-
before_rotate
.
y
()
*
sin_theta
;
const
double
after_rotate_y
=
before_rotate
.
x
()
*
sin_theta
+
before_rotate
.
y
()
*
cos_theta
;
point
.
mutable_path_point
()
->
set_x
(
after_rotate_x
);
point
.
mutable_path_point
()
->
set_y
(
after_rotate_y
);
point
.
mutable_path_point
()
->
set_z
(
before_rotate
.
z
());
point
.
mutable_path_point
()
->
set_theta
(
common
::
math
::
WrapAngle
(
old_point
.
path_point
().
theta
()
-
matched_point
.
path_point
().
theta
()));
transformed_points
.
emplace_back
(
point
);
}
prev_trajectory
->
SetTrajectoryPoints
(
transformed_points
);
}
// only used in navigation mode
std
::
vector
<
TrajectoryPoint
>
TrajectoryStitcher
::
CalculateInitPoint
(
const
VehicleState
&
vehicle_state
,
const
ReferenceLine
&
reference_line
,
...
...
@@ -134,8 +173,6 @@ std::vector<TrajectoryPoint> TrajectoryStitcher::ComputeStitchingTrajectory(
Vec2d
(
vehicle_state
.
x
(),
vehicle_state
.
y
()));
auto
nearest_point
=
prev_trajectory
->
TrajectoryPointAt
(
nearest_point_index
);
DCHECK
(
nearest_point
.
has_path_point
());
DCHECK
(
matched_point
.
has_path_point
());
const
double
lat_diff
=
std
::
hypot
(
nearest_point
.
path_point
().
x
()
-
vehicle_state
.
x
(),
nearest_point
.
path_point
().
y
()
-
vehicle_state
.
y
());
...
...
modules/planning/common/trajectory/trajectory_stitcher.h
浏览文件 @
5c5226d0
...
...
@@ -45,6 +45,9 @@ class TrajectoryStitcher {
const
common
::
VehicleState
&
vehicle_state
,
const
ReferenceLine
&
reference_line
,
bool
*
is_replan
);
static
void
TransformLastPublishedTrajectory
(
const
double
planning_cycle_time
,
PublishableTrajectory
*
prev_trajectory
);
static
std
::
vector
<
common
::
TrajectoryPoint
>
ComputeStitchingTrajectory
(
const
common
::
VehicleState
&
vehicle_state
,
const
double
current_timestamp
,
const
double
planning_cycle_time
,
...
...
modules/planning/planning.cc
浏览文件 @
5c5226d0
...
...
@@ -276,28 +276,15 @@ void Planning::RunOnce() {
}
const
double
planning_cycle_time
=
1.0
/
FLAGS_planning_loop_rate
;
bool
is_replan
=
false
;
std
::
vector
<
TrajectoryPoint
>
stitching_trajectory
;
if
(
FLAGS_use_navigation_mode
)
{
std
::
list
<
ReferenceLine
>
reference_lines
;
std
::
list
<
hdmap
::
RouteSegments
>
segments
;
if
(
!
reference_line_provider_
->
GetReferenceLines
(
&
reference_lines
,
&
segments
)
||
reference_lines
.
empty
())
{
std
::
string
msg
(
"Reference line is not ready"
);
AERROR
<<
msg
;
not_ready
->
set_reason
(
msg
);
status
.
Save
(
not_ready_pb
.
mutable_header
()
->
mutable_status
());
PublishPlanningPb
(
&
not_ready_pb
,
start_timestamp
);
return
;
}
stitching_trajectory
=
TrajectoryStitcher
::
CalculateInitPoint
(
vehicle_state
,
reference_lines
.
front
(),
&
is_replan
);
}
else
{
stitching_trajectory
=
TrajectoryStitcher
::
ComputeStitchingTrajectory
(
vehicle_state
,
start_timestamp
,
planning_cycle_time
,
last_publishable_trajectory_
.
get
(),
&
is_replan
);
TrajectoryStitcher
::
TransformLastPublishedTrajectory
(
planning_cycle_time
,
last_publishable_trajectory_
.
get
());
}
bool
is_replan
=
false
;
std
::
vector
<
TrajectoryPoint
>
stitching_trajectory
;
stitching_trajectory
=
TrajectoryStitcher
::
ComputeStitchingTrajectory
(
vehicle_state
,
start_timestamp
,
planning_cycle_time
,
last_publishable_trajectory_
.
get
(),
&
is_replan
);
const
uint32_t
frame_num
=
AdapterManager
::
GetPlanning
()
->
GetSeqNum
()
+
1
;
status
=
InitFrame
(
frame_num
,
stitching_trajectory
.
back
(),
start_timestamp
,
...
...
modules/planning/tasks/traffic_decider/traffic_decider.cc
浏览文件 @
5c5226d0
...
...
@@ -151,7 +151,7 @@ Status TrafficDecider::Execute(Frame *frame,
for
(
const
auto
&
rule_config
:
rule_configs_
.
config
())
{
if
(
!
rule_config
.
enabled
())
{
A
INFO
<<
"Rule "
<<
rule_config
.
rule_id
()
<<
" not enabled"
;
A
DEBUG
<<
"Rule "
<<
rule_config
.
rule_id
()
<<
" not enabled"
;
continue
;
}
auto
rule
=
s_rule_factory
.
CreateObject
(
rule_config
.
rule_id
(),
rule_config
);
...
...
modules/planning/testdata/navigation_mode_test/result_cruise_0.pb.txt
浏览文件 @
5c5226d0
此差异已折叠。
点击以展开。
scripts/filter_planning.sh
浏览文件 @
5c5226d0
...
...
@@ -41,7 +41,9 @@ perfect_control_topic="$perception_topic \
planning_deps
=
"
$perfect_control_topic
\
or topic == '/apollo/canbus/chassis'
\
or topic == '/apollo/localization/pose'"
or topic == '/apollo/localization/pose'
\
or topic == '/apollo/navigation'
\
or topic == '/apollo/relative_map'"
planning_topic
=
"topic == '/apollo/planning'"
prediction_topic
=
"topic == '/apollo/prediction'"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录