Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
cf013d9d
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,发现更多精彩内容 >>
提交
cf013d9d
编写于
2月 21, 2019
作者:
K
kechxu
提交者:
Kecheng Xu
2月 21, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: caution level for cruise change lane
上级
5f151a6c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
120 addition
and
74 deletion
+120
-74
modules/prediction/container/adc_trajectory/adc_trajectory_container.cc
...tion/container/adc_trajectory/adc_trajectory_container.cc
+5
-0
modules/prediction/container/adc_trajectory/adc_trajectory_container.h
...ction/container/adc_trajectory/adc_trajectory_container.h
+6
-0
modules/prediction/scenario/prioritization/obstacles_prioritizer.cc
...ediction/scenario/prioritization/obstacles_prioritizer.cc
+107
-69
modules/prediction/scenario/prioritization/obstacles_prioritizer.h
...rediction/scenario/prioritization/obstacles_prioritizer.h
+2
-5
未找到文件。
modules/prediction/container/adc_trajectory/adc_trajectory_container.cc
浏览文件 @
cf013d9d
...
...
@@ -195,6 +195,11 @@ const ADCTrajectory& ADCTrajectoryContainer::adc_trajectory() const {
return
adc_trajectory_
;
}
bool
ADCTrajectoryContainer
::
IsLaneIdInReferenceLine
(
const
std
::
string
&
lane_id
)
const
{
return
adc_lane_ids_
.
find
(
lane_id
)
!=
adc_lane_ids_
.
end
();
}
void
ADCTrajectoryContainer
::
SetLaneSequence
()
{
for
(
const
auto
&
lane
:
adc_trajectory_
.
lane_id
())
{
if
(
!
lane
.
id
().
empty
())
{
...
...
modules/prediction/container/adc_trajectory/adc_trajectory_container.h
浏览文件 @
cf013d9d
...
...
@@ -94,6 +94,12 @@ class ADCTrajectoryContainer : public Container {
*/
const
planning
::
ADCTrajectory
&
adc_trajectory
()
const
;
/**
* @brief Determine if a lane ID is in the reference line
* @return The lane ID to be investigated
*/
bool
IsLaneIdInReferenceLine
(
const
std
::
string
&
lane_id
)
const
;
private:
void
SetJunctionPolygon
();
...
...
modules/prediction/scenario/prioritization/obstacles_prioritizer.cc
浏览文件 @
cf013d9d
...
...
@@ -18,10 +18,12 @@
#include <algorithm>
#include <limits>
#include <string>
#include "modules/prediction/common/prediction_gflags.h"
#include "modules/prediction/common/prediction_map.h"
#include "modules/prediction/container/container_manager.h"
#include "modules/prediction/container/adc_trajectory/adc_trajectory_container.h"
#include "modules/prediction/container/obstacles/obstacle_clusters.h"
#include "modules/prediction/container/pose/pose_container.h"
...
...
@@ -33,6 +35,51 @@ using common::adapter::AdapterConfig;
using
common
::
math
::
Box2d
;
using
common
::
math
::
Vec2d
;
namespace
{
bool
IsLaneSequenceInReferenceLine
(
const
LaneSequence
&
lane_sequence
,
const
ADCTrajectoryContainer
*
ego_trajectory_container
)
{
for
(
const
auto
&
lane_segment
:
lane_sequence
.
lane_segment
())
{
std
::
string
lane_id
=
lane_segment
.
lane_id
();
if
(
ego_trajectory_container
->
IsLaneIdInReferenceLine
(
lane_id
))
{
return
true
;
}
}
return
false
;
}
int
NearestFrontObstacleIdOnLaneSequence
(
const
LaneSequence
&
lane_sequence
)
{
int
nearest_front_obstacle_id
=
-
std
::
numeric_limits
<
int
>::
infinity
();
double
smallest_relative_s
=
std
::
numeric_limits
<
double
>::
infinity
();
for
(
const
auto
&
nearby_obs
:
lane_sequence
.
nearby_obstacle
())
{
if
(
nearby_obs
.
s
()
<
0.0
)
{
continue
;
}
if
(
nearby_obs
.
s
()
<
smallest_relative_s
)
{
smallest_relative_s
=
nearby_obs
.
s
();
nearest_front_obstacle_id
=
nearby_obs
.
id
();
}
}
return
nearest_front_obstacle_id
;
}
int
NearestBackwardObstacleIdOnLaneSequence
(
const
LaneSequence
&
lane_sequence
)
{
int
nearest_backward_obstacle_id
=
-
std
::
numeric_limits
<
int
>::
infinity
();
double
smallest_relative_s
=
std
::
numeric_limits
<
double
>::
infinity
();
for
(
const
auto
&
nearby_obs
:
lane_sequence
.
nearby_obstacle
())
{
if
(
nearby_obs
.
s
()
>
0.0
)
{
continue
;
}
if
(
-
nearby_obs
.
s
()
<
smallest_relative_s
)
{
smallest_relative_s
=
-
nearby_obs
.
s
();
nearest_backward_obstacle_id
=
nearby_obs
.
id
();
}
}
return
nearest_backward_obstacle_id
;
}
}
// namespace
void
ObstaclesPrioritizer
::
PrioritizeObstacles
(
const
EnvironmentFeatures
&
environment_features
,
const
std
::
shared_ptr
<
ScenarioFeatures
>
scenario_features
)
{
...
...
@@ -124,70 +171,45 @@ void ObstaclesPrioritizer::AssignIgnoreLevel(
}
}
void
ObstaclesPrioritizer
::
AssignIgnoreLevelForCruiseScenario
(
const
EnvironmentFeatures
&
environment_features
,
const
std
::
shared_ptr
<
CruiseScenarioFeatures
>
cruise_scenario_features
,
ObstaclesContainer
*
ptr_obstacle_contrainer
)
{
const
auto
&
obstacle_ids
=
ptr_obstacle_contrainer
->
curr_frame_predictable_obstacle_ids
();
for
(
const
int
&
obstacle_id
:
obstacle_ids
)
{
Obstacle
*
obstacle_ptr
=
ptr_obstacle_contrainer
->
GetObstacle
(
obstacle_id
);
if
(
obstacle_ptr
->
history_size
()
==
0
)
{
AERROR
<<
"Obstacle ["
<<
obstacle_ptr
->
id
()
<<
"] has no feature."
;
void
ObstaclesPrioritizer
::
AssignCautionLevelCruiseKeepLane
()
{
ObstaclesContainer
*
obstacles_container
=
ContainerManager
::
Instance
()
->
GetContainer
<
ObstaclesContainer
>
(
AdapterConfig
::
PERCEPTION_OBSTACLES
);
Obstacle
*
ego_vehicle
=
obstacles_container
->
GetObstacle
(
FLAGS_ego_vehicle_id
);
if
(
ego_vehicle
==
nullptr
)
{
AERROR
<<
"Ego vehicle not found"
;
return
;
}
if
(
ego_vehicle
->
history_size
()
==
0
)
{
AERROR
<<
"Ego vehicle has no history"
;
return
;
}
const
Feature
&
ego_latest_feature
=
ego_vehicle
->
latest_feature
();
for
(
const
LaneSequence
&
lane_sequence
:
ego_latest_feature
.
lane
().
lane_graph
().
lane_sequence
())
{
int
nearest_front_obstacle_id
=
NearestFrontObstacleIdOnLaneSequence
(
lane_sequence
);
if
(
nearest_front_obstacle_id
<
0
)
{
continue
;
}
Feature
*
latest_feature_ptr
=
obstacle_ptr
->
mutable_latest_feature
();
if
(
obstacle_ptr
->
IsOnLane
())
{
bool
has_lane_of_interest
=
false
;
for
(
const
auto
&
curr_lane
:
latest_feature_ptr
->
lane
().
current_lane_feature
())
{
const
auto
&
curr_lane_id
=
curr_lane
.
lane_id
();
if
(
cruise_scenario_features
->
IsLaneOfInterest
(
curr_lane_id
))
{
has_lane_of_interest
=
true
;
break
;
}
}
if
(
!
has_lane_of_interest
)
{
for
(
const
auto
&
nearby_lane
:
latest_feature_ptr
->
lane
().
nearby_lane_feature
())
{
const
auto
&
nearby_lane_id
=
nearby_lane
.
lane_id
();
if
(
cruise_scenario_features
->
IsLaneOfInterest
(
nearby_lane_id
))
{
has_lane_of_interest
=
true
;
break
;
}
}
}
if
(
!
has_lane_of_interest
)
{
latest_feature_ptr
->
mutable_priority
()
->
set_priority
(
ObstaclePriority
::
IGNORE
);
}
}
else
{
// Obstacle has neither lane nor neighbor lanes
// Filter obstacle by its relative position to ego vehicle
double
ego_x
=
environment_features
.
get_ego_position
().
x
();
double
ego_y
=
environment_features
.
get_ego_position
().
y
();
double
ego_heading
=
environment_features
.
get_ego_heading
();
double
ego_speed
=
environment_features
.
get_ego_speed
();
double
obstacle_x
=
latest_feature_ptr
->
position
().
x
();
double
obstacle_y
=
latest_feature_ptr
->
position
().
y
();
Vec2d
ego_to_obstacle_vec
(
obstacle_x
-
ego_x
,
obstacle_y
-
ego_y
);
Vec2d
ego_vec
=
Vec2d
::
CreateUnitVec2d
(
ego_heading
);
double
l
=
ego_vec
.
CrossProd
(
ego_to_obstacle_vec
);
double
s
=
ego_to_obstacle_vec
.
InnerProd
(
ego_vec
);
if
(
std
::
abs
(
l
)
>
10.0
||
s
>
std
::
max
(
20.0
,
ego_speed
*
5.0
)
||
s
<
0.0
)
{
latest_feature_ptr
->
mutable_priority
()
->
set_priority
(
ObstaclePriority
::
IGNORE
);
}
Obstacle
*
obstacle_ptr
=
obstacles_container
->
GetObstacle
(
nearest_front_obstacle_id
);
if
(
obstacle_ptr
==
nullptr
)
{
AERROR
<<
"Obstacle ["
<<
nearest_front_obstacle_id
<<
"] Not found"
;
continue
;
}
obstacle_ptr
->
SetCaution
();
}
}
void
ObstaclesPrioritizer
::
AssignCautionLevelCruise
Keep
Lane
()
{
void
ObstaclesPrioritizer
::
AssignCautionLevelCruise
Change
Lane
()
{
ObstaclesContainer
*
obstacles_container
=
ContainerManager
::
Instance
()
->
GetContainer
<
ObstaclesContainer
>
(
AdapterConfig
::
PERCEPTION_OBSTACLES
);
ADCTrajectoryContainer
*
ego_trajectory_container
=
ContainerManager
::
Instance
()
->
GetContainer
<
ADCTrajectoryContainer
>
(
AdapterConfig
::
PLANNING_TRAJECTORY
);
Obstacle
*
ego_vehicle
=
obstacles_container
->
GetObstacle
(
FLAGS_ego_vehicle_id
);
if
(
ego_vehicle
==
nullptr
)
{
...
...
@@ -201,24 +223,40 @@ void ObstaclesPrioritizer::AssignCautionLevelCruiseKeepLane() {
const
Feature
&
ego_latest_feature
=
ego_vehicle
->
latest_feature
();
for
(
const
LaneSequence
&
lane_sequence
:
ego_latest_feature
.
lane
().
lane_graph
().
lane_sequence
())
{
i
nt
nearest_front_obstacle_id
=
-
10
;
double
smallest_relative_s
=
std
::
numeric_limits
<
double
>::
infinity
();
for
(
const
auto
&
nearby_obs
:
lane_sequence
.
nearby_obstacle
())
{
if
(
near
by_obs
.
s
()
<
0.
0
)
{
i
f
(
lane_sequence
.
vehicle_on_lane
())
{
int
nearest_front_obstacle_id
=
NearestFrontObstacleIdOnLaneSequence
(
lane_sequence
);
if
(
near
est_front_obstacle_id
<
0
)
{
continue
;
}
if
(
nearby_obs
.
s
()
<
smallest_relative_s
)
{
smallest_relative_s
=
nearby_obs
.
s
();
nearest_front_obstacle_id
=
nearby_obs
.
id
();
Obstacle
*
obstacle_ptr
=
obstacles_container
->
GetObstacle
(
nearest_front_obstacle_id
);
if
(
obstacle_ptr
==
nullptr
)
{
AERROR
<<
"Obstacle ["
<<
nearest_front_obstacle_id
<<
"] Not found"
;
continue
;
}
obstacle_ptr
->
SetCaution
();
}
else
if
(
IsLaneSequenceInReferenceLine
(
lane_sequence
,
ego_trajectory_container
))
{
int
nearest_front_obstacle_id
=
NearestFrontObstacleIdOnLaneSequence
(
lane_sequence
);
int
nearest_backward_obstacle_id
=
NearestBackwardObstacleIdOnLaneSequence
(
lane_sequence
);
if
(
nearest_front_obstacle_id
>=
0
)
{
Obstacle
*
front_obstacle_ptr
=
obstacles_container
->
GetObstacle
(
nearest_front_obstacle_id
);
if
(
front_obstacle_ptr
!=
nullptr
)
{
front_obstacle_ptr
->
SetCaution
();
}
}
if
(
nearest_backward_obstacle_id
>=
0
)
{
Obstacle
*
backward_obstacle_ptr
=
obstacles_container
->
GetObstacle
(
nearest_backward_obstacle_id
);
if
(
backward_obstacle_ptr
!=
nullptr
)
{
backward_obstacle_ptr
->
SetCaution
();
}
}
}
Obstacle
*
obstacle_ptr
=
obstacles_container
->
GetObstacle
(
nearest_front_obstacle_id
);
if
(
obstacle_ptr
==
nullptr
)
{
AERROR
<<
"Obstacle ["
<<
nearest_front_obstacle_id
<<
"] Not found"
;
continue
;
}
obstacle_ptr
->
SetCaution
();
}
}
...
...
modules/prediction/scenario/prioritization/obstacles_prioritizer.h
浏览文件 @
cf013d9d
...
...
@@ -36,12 +36,9 @@ class ObstaclesPrioritizer {
const
EnvironmentFeatures
&
environment_features
,
const
std
::
shared_ptr
<
ScenarioFeatures
>
scenario_features
);
static
void
AssignIgnoreLevelForCruiseScenario
(
const
EnvironmentFeatures
&
environment_features
,
const
std
::
shared_ptr
<
CruiseScenarioFeatures
>
scenario_features
,
ObstaclesContainer
*
ptr_obstacle_contrainer
);
static
void
AssignCautionLevelCruiseKeepLane
();
static
void
AssignCautionLevelCruiseChangeLane
();
};
}
// namespace prediction
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录