Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
8a0eea26
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,发现更多精彩内容 >>
提交
8a0eea26
编写于
12月 24, 2017
作者:
D
Dong Li
提交者:
Jiangtao Hu
12月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
planning: modify existing obstacle instead of creating virtual guard obstacle
上级
e99ca4cb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
52 addition
and
42 deletion
+52
-42
modules/planning/common/frame.cc
modules/planning/common/frame.cc
+1
-3
modules/planning/common/frame.h
modules/planning/common/frame.h
+2
-1
modules/planning/common/obstacle.cc
modules/planning/common/obstacle.cc
+8
-1
modules/planning/common/obstacle.h
modules/planning/common/obstacle.h
+2
-2
modules/planning/tasks/traffic_decider/change_lane.cc
modules/planning/tasks/traffic_decider/change_lane.cc
+32
-27
modules/planning/tasks/traffic_decider/change_lane.h
modules/planning/tasks/traffic_decider/change_lane.h
+7
-8
未找到文件。
modules/planning/common/frame.cc
浏览文件 @
8a0eea26
...
...
@@ -376,9 +376,7 @@ void Frame::AlignPredictionTime(const double planning_start_time,
}
}
const
Obstacle
*
Frame
::
Find
(
const
std
::
string
&
id
)
{
return
obstacles_
.
Find
(
id
);
}
Obstacle
*
Frame
::
Find
(
const
std
::
string
&
id
)
{
return
obstacles_
.
Find
(
id
);
}
void
Frame
::
AddObstacle
(
const
Obstacle
&
obstacle
)
{
obstacles_
.
Add
(
obstacle
.
Id
(),
obstacle
);
...
...
modules/planning/common/frame.h
浏览文件 @
8a0eea26
...
...
@@ -68,7 +68,8 @@ class Frame {
std
::
list
<
ReferenceLineInfo
>
&
reference_line_info
();
void
AddObstacle
(
const
Obstacle
&
obstacle
);
const
Obstacle
*
Find
(
const
std
::
string
&
id
);
Obstacle
*
Find
(
const
std
::
string
&
id
);
const
ReferenceLineInfo
*
FindDriveReferenceLineInfo
();
const
ReferenceLineInfo
*
DriveReferenceLineInfo
()
const
;
...
...
modules/planning/common/obstacle.cc
浏览文件 @
8a0eea26
...
...
@@ -74,7 +74,6 @@ Obstacle::Obstacle(const std::string& id,
double
cumulative_s
=
0.0
;
if
(
trajectory_points
.
size
()
>
0
)
{
trajectory_points
[
0
].
mutable_path_point
()
->
set_s
(
0.0
);
has_trajectory_
=
true
;
}
for
(
int
i
=
1
;
i
<
trajectory_points
.
size
();
++
i
)
{
const
auto
&
prev
=
trajectory_points
[
i
-
1
];
...
...
@@ -98,6 +97,14 @@ bool Obstacle::IsStatic() const { return is_static_; }
bool
Obstacle
::
IsVirtual
()
const
{
return
is_virtual_
;
}
bool
Obstacle
::
HasTrajectory
()
const
{
return
trajectory_
.
trajectory_point_size
()
>
0
;
}
common
::
TrajectoryPoint
*
Obstacle
::
AddTrajectoryPoint
()
{
return
trajectory_
.
add_trajectory_point
();
}
bool
Obstacle
::
IsStaticObstacle
(
const
PerceptionObstacle
&
perception_obstacle
)
{
if
(
perception_obstacle
.
type
()
==
PerceptionObstacle
::
UNKNOWN_UNMOVABLE
)
{
return
true
;
...
...
modules/planning/common/obstacle.h
浏览文件 @
8a0eea26
...
...
@@ -73,7 +73,8 @@ class Obstacle {
const
common
::
math
::
Polygon2d
&
PerceptionPolygon
()
const
;
const
prediction
::
Trajectory
&
Trajectory
()
const
;
bool
HasTrajectory
()
const
{
return
has_trajectory_
;
}
common
::
TrajectoryPoint
*
AddTrajectoryPoint
();
bool
HasTrajectory
()
const
;
const
perception
::
PerceptionObstacle
&
Perception
()
const
;
...
...
@@ -103,7 +104,6 @@ class Obstacle {
std
::
int32_t
perception_id_
=
0
;
bool
is_static_
=
false
;
bool
is_virtual_
=
false
;
bool
has_trajectory_
=
false
;
double
speed_
=
0.0
;
prediction
::
Trajectory
trajectory_
;
perception
::
PerceptionObstacle
perception_obstacle_
;
...
...
modules/planning/tasks/traffic_decider/change_lane.cc
浏览文件 @
8a0eea26
...
...
@@ -20,6 +20,8 @@
#include "modules/planning/tasks/traffic_decider/change_lane.h"
#include <algorithm>
#include "modules/planning/common/planning_gflags.h"
namespace
apollo
{
...
...
@@ -29,6 +31,11 @@ using apollo::common::SLPoint;
using
apollo
::
common
::
math
::
Box2d
;
using
apollo
::
common
::
math
::
Vec2d
;
namespace
{
constexpr
double
kMinGuardVehicleSpeed
=
1.0
;
constexpr
double
kGuardDistance
=
100.0
;
}
ChangeLane
::
ChangeLane
(
const
RuleConfig
&
config
)
:
TrafficRule
(
config
)
{}
const
Obstacle
*
ChangeLane
::
FindGuardObstacle
(
...
...
@@ -50,6 +57,9 @@ const Obstacle* ChangeLane::FindGuardObstacle(
}
const
auto
&
last_point
=
*
(
obstacle
->
Trajectory
().
trajectory_point
().
rbegin
());
if
(
last_point
.
v
()
<
kMinGuardVehicleSpeed
)
{
continue
;
}
if
(
!
reference_line
.
IsOnRoad
(
last_point
.
path_point
()))
{
continue
;
}
...
...
@@ -69,46 +79,41 @@ const Obstacle* ChangeLane::FindGuardObstacle(
return
first_guard_vehicle
;
}
const
Obstacle
*
ChangeLane
::
CreateGuardObstacle
(
Frame
*
frame
,
ReferenceLineInfo
*
reference_line_info
,
const
Obstacle
*
obstacle
)
{
bool
ChangeLane
::
CreateGuardObstacle
(
const
ReferenceLineInfo
*
reference_line_info
,
Obstacle
*
obstacle
)
{
if
(
!
obstacle
||
!
obstacle
->
HasTrajectory
())
{
return
nullptr
;
return
false
;
}
const
auto
&
last_point
=
*
(
obstacle
->
Trajectory
().
trajectory_point
().
rbegin
());
std
::
string
id
=
obstacle
->
Id
()
+
"_guard"
;
auto
perception
=
obstacle
->
Perception
();
perception
.
set_id
(
-
(
std
::
hash
<
std
::
string
>
{}(
id
)
>>
1
));
prediction
::
Trajectory
trajectory
=
obstacle
->
Trajectory
();
constexpr
double
kPredictionTimeDelta
=
0.1
;
// seconds
const
double
kGuardTime
=
5.0
+
last_point
.
relative_time
();
// seconds
// trajectory.add_trajectory_point()->CopyFrom(last_point);
const
double
kStepDistance
=
obstacle
->
PerceptionBoundingBox
().
length
();
double
extend_v
=
std
::
max
(
last_point
.
v
(),
kMinGuardVehicleSpeed
);
const
double
time_delta
=
kStepDistance
/
extend_v
;
const
auto
&
reference_line
=
reference_line_info
->
reference_line
();
const
double
end_s
=
std
::
min
(
reference_line
.
Length
(),
reference_line_info
->
AdcSlBoundary
().
end_s
()
+
kGuardDistance
);
SLPoint
sl_point
;
if
(
!
reference_line
.
XYToSL
(
last_point
.
path_point
(),
&
sl_point
))
{
return
nullptr
;
return
false
;
}
const
double
delta_s
=
kPredictionTimeDelta
*
last_point
.
v
();
double
s
=
sl_point
.
s
()
+
delta_s
;
for
(
double
t
=
last_point
.
relative_time
()
+
kPredictionTimeDelta
;
t
<
kGuardTime
&&
s
<
reference_line
.
Length
();
s
+=
delta_s
,
t
+=
kPredictionTimeDelta
)
{
double
s
=
last_point
.
path_point
().
s
()
+
kStepDistance
;
double
ref_s
=
sl_point
.
s
()
+
kStepDistance
;
for
(
double
t
=
last_point
.
relative_time
()
+
time_delta
;
ref_s
<
end_s
;
ref_s
+=
kStepDistance
,
s
+=
kStepDistance
,
t
+=
time_delta
)
{
auto
ref_point
=
reference_line
.
GetNearestReferencepoint
(
s
);
auto
*
tp
=
trajectory
.
add_trajectory_p
oint
();
auto
*
tp
=
obstacle
->
AddTrajectoryP
oint
();
tp
->
set_a
(
0.0
);
tp
->
set_v
(
last_point
.
v
()
);
tp
->
set_v
(
extend_v
);
tp
->
set_relative_time
(
t
);
tp
->
mutable_path_point
()
->
set_x
(
ref_point
.
x
());
tp
->
mutable_path_point
()
->
set_y
(
ref_point
.
y
());
tp
->
mutable_path_point
()
->
set_theta
(
ref_point
.
heading
());
tp
->
mutable_path_point
()
->
set_s
(
s
-
sl_point
.
s
()
);
tp
->
mutable_path_point
()
->
set_s
(
s
);
tp
->
mutable_path_point
()
->
set_kappa
(
ref_point
.
kappa
());
}
frame
->
AddObstacle
(
Obstacle
(
id
,
perception
,
trajectory
));
auto
*
stored_obstacle
=
frame
->
Find
(
id
);
reference_line_info
->
AddObstacle
(
stored_obstacle
);
return
stored_obstacle
;
return
true
;
}
bool
ChangeLane
::
ApplyRule
(
Frame
*
frame
,
...
...
@@ -121,9 +126,9 @@ bool ChangeLane::ApplyRule(Frame* frame,
if
(
!
obstacle
)
{
return
true
;
}
else
{
auto
*
guard_obstacle
=
CreateGuardObstacle
(
frame
,
reference_line_info
,
obstacle
);
if
(
guard_obstacle
)
{
auto
*
guard_obstacle
=
frame
->
Find
(
obstacle
->
Id
());
if
(
guard_obstacle
&&
CreateGuardObstacle
(
reference_line_info
,
guard_obstacle
)
)
{
AINFO
<<
"Created guard obstacle: "
<<
guard_obstacle
->
Id
();
}
}
...
...
modules/planning/tasks/traffic_decider/change_lane.h
浏览文件 @
8a0eea26
...
...
@@ -45,15 +45,14 @@ class ChangeLane : public TrafficRule {
**/
const
Obstacle
*
FindGuardObstacle
(
ReferenceLineInfo
*
reference_line_info
);
/**
* @brief This function will
create virutal dynamic vehicles to guard lane
*
change action. Due to the ST path may drive on the forward lane first, then
*
slowly move to the target lane when making lane change, we need to make sure
*t
he vehicle is aware that it actually occupies the target lane, even when it
*is not on the target lane yet.
* @brief This function will
extend the prediction of the guard obstacle to
*
guard lane change action. Due to the ST path may drive on the forward lane
*
first, then slowly move to the target lane when making lane change, we need
*t
o make sure the vehicle is aware that it actually occupies the target lane,
*
even when it
is not on the target lane yet.
**/
const
Obstacle
*
CreateGuardObstacle
(
Frame
*
frame
,
ReferenceLineInfo
*
reference_line_info
,
const
Obstacle
*
obstacle
);
bool
CreateGuardObstacle
(
const
ReferenceLineInfo
*
reference_line_info
,
Obstacle
*
obstacle
);
};
}
// namespace planning
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录