Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
c6f0c000
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,发现更多精彩内容 >>
提交
c6f0c000
编写于
8月 18, 2017
作者:
A
Aaron Xiao
提交者:
Calvin Miao
8月 18, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prediction: Simplify PredictionMap interface to accept map_id string only.
上级
9aa0bce2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
61 deletion
+27
-61
modules/prediction/common/prediction_map.cc
modules/prediction/common/prediction_map.cc
+19
-26
modules/prediction/common/prediction_map.h
modules/prediction/common/prediction_map.h
+2
-27
modules/prediction/common/prediction_map_test.cc
modules/prediction/common/prediction_map_test.cc
+1
-2
modules/prediction/common/road_graph.cc
modules/prediction/common/road_graph.cc
+2
-3
modules/prediction/container/obstacles/obstacle.cc
modules/prediction/container/obstacles/obstacle.cc
+2
-2
modules/prediction/predictor/vehicle/lane_sequence_predictor.cc
...s/prediction/predictor/vehicle/lane_sequence_predictor.cc
+1
-1
未找到文件。
modules/prediction/common/prediction_map.cc
浏览文件 @
c6f0c000
...
...
@@ -80,13 +80,10 @@ double PredictionMap::LaneTotalWidth(
return
left
+
right
;
}
std
::
shared_ptr
<
const
LaneInfo
>
PredictionMap
::
LaneById
(
const
Id
&
id
)
{
return
HDMapUtil
::
instance
()
->
BaseMapRef
().
get_lane_by_id
(
id
);
}
std
::
shared_ptr
<
const
LaneInfo
>
PredictionMap
::
LaneById
(
const
std
::
string
&
str_id
)
{
return
LaneById
(
apollo
::
hdmap
::
MakeMapId
(
str_id
));
return
HDMapUtil
::
instance
()
->
BaseMapRef
().
get_lane_by_id
(
apollo
::
hdmap
::
MakeMapId
(
str_id
));
}
void
PredictionMap
::
GetProjection
(
const
Eigen
::
Vector2d
&
position
,
...
...
@@ -162,16 +159,14 @@ void PredictionMap::OnLane(
double
PredictionMap
::
PathHeading
(
std
::
shared_ptr
<
const
LaneInfo
>
lane_info
,
const
apollo
::
common
::
PointENU
&
point
)
{
apollo
::
common
::
math
::
Vec2d
vec_point
;
vec_point
.
set_x
(
point
.
x
());
vec_point
.
set_y
(
point
.
y
());
apollo
::
common
::
math
::
Vec2d
vec_point
=
{
point
.
x
(),
point
.
y
()};
double
s
=
-
1.0
;
double
l
=
0.0
;
lane_info
->
get_projection
(
vec_point
,
&
s
,
&
l
);
return
HeadingOnLane
(
lane_info
,
s
);
}
int
PredictionMap
::
SmoothPointFromLane
(
const
apollo
::
hdmap
::
Id
&
id
,
int
PredictionMap
::
SmoothPointFromLane
(
const
std
::
string
&
id
,
const
double
s
,
const
double
l
,
Eigen
::
Vector2d
*
point
,
double
*
heading
)
{
...
...
@@ -203,10 +198,11 @@ void PredictionMap::NearbyLanesByCurrentLanes(
continue
;
}
for
(
auto
&
lane_id
:
lane_ptr
->
lane
().
left_neighbor_forward_lane_id
())
{
if
(
lane_ids
.
find
(
lane_id
.
id
())
!=
lane_ids
.
end
())
{
const
std
::
string
&
id
=
lane_id
.
id
();
if
(
lane_ids
.
find
(
id
)
!=
lane_ids
.
end
())
{
continue
;
}
std
::
shared_ptr
<
const
LaneInfo
>
nearby_lane
=
LaneById
(
lane_
id
);
std
::
shared_ptr
<
const
LaneInfo
>
nearby_lane
=
LaneById
(
id
);
double
s
=
-
1.0
;
double
l
=
0.0
;
GetProjection
(
point
,
nearby_lane
,
&
s
,
&
l
);
...
...
@@ -214,14 +210,15 @@ void PredictionMap::NearbyLanesByCurrentLanes(
::
apollo
::
common
::
math
::
DoubleCompare
(
std
::
fabs
(
l
),
radius
)
>
0
)
{
continue
;
}
lane_ids
.
insert
(
lane_id
.
id
()
);
lane_ids
.
insert
(
id
);
nearby_lanes
->
push_back
(
nearby_lane
);
}
for
(
auto
&
lane_id
:
lane_ptr
->
lane
().
right_neighbor_forward_lane_id
())
{
if
(
lane_ids
.
find
(
lane_id
.
id
())
!=
lane_ids
.
end
())
{
const
std
::
string
&
id
=
lane_id
.
id
();
if
(
lane_ids
.
find
(
id
)
!=
lane_ids
.
end
())
{
continue
;
}
std
::
shared_ptr
<
const
LaneInfo
>
nearby_lane
=
LaneById
(
lane_
id
);
std
::
shared_ptr
<
const
LaneInfo
>
nearby_lane
=
LaneById
(
id
);
double
s
=
-
1.0
;
double
l
=
0.0
;
GetProjection
(
point
,
nearby_lane
,
&
s
,
&
l
);
...
...
@@ -229,7 +226,7 @@ void PredictionMap::NearbyLanesByCurrentLanes(
::
apollo
::
common
::
math
::
DoubleCompare
(
std
::
fabs
(
l
),
radius
)
>
0
)
{
continue
;
}
lane_ids
.
insert
(
lane_id
.
id
()
);
lane_ids
.
insert
(
id
);
nearby_lanes
->
push_back
(
nearby_lane
);
}
}
...
...
@@ -246,7 +243,7 @@ bool PredictionMap::IsLeftNeighborLane(
return
false
;
}
for
(
auto
&
left_lane_id
:
curr_lane
->
lane
().
left_neighbor_forward_lane_id
())
{
if
(
id_string
(
left_lane
)
==
left_lane_id
.
id
())
{
if
(
left_lane
->
id
().
id
(
)
==
left_lane_id
.
id
())
{
return
true
;
}
}
...
...
@@ -278,7 +275,7 @@ bool PredictionMap::IsRightNeighborLane(
}
for
(
auto
&
right_lane_id
:
curr_lane
->
lane
().
right_neighbor_forward_lane_id
())
{
if
(
id_string
(
right_lane
)
==
right_lane_id
.
id
())
{
if
(
right_lane
->
id
().
id
(
)
==
right_lane_id
.
id
())
{
return
true
;
}
}
...
...
@@ -309,7 +306,7 @@ bool PredictionMap::IsSuccessorLane(
return
false
;
}
for
(
auto
&
successor_lane_id
:
curr_lane
->
lane
().
successor_id
())
{
if
(
id_string
(
succ_lane
)
==
successor_lane_id
.
id
())
{
if
(
succ_lane
->
id
().
id
(
)
==
successor_lane_id
.
id
())
{
return
true
;
}
}
...
...
@@ -340,7 +337,7 @@ bool PredictionMap::IsPredecessorLane(
return
false
;
}
for
(
auto
&
predecessor_lane_id
:
curr_lane
->
lane
().
predecessor_id
())
{
if
(
id_string
(
pred_lane
)
==
predecessor_lane_id
.
id
())
{
if
(
pred_lane
->
id
().
id
(
)
==
predecessor_lane_id
.
id
())
{
return
true
;
}
}
...
...
@@ -367,7 +364,7 @@ bool PredictionMap::IsIdenticalLane(
if
(
curr_lane
==
nullptr
||
other_lane
==
nullptr
)
{
return
true
;
}
return
id_string
(
other_lane
)
==
id_string
(
curr_lane
);
return
other_lane
->
id
().
id
()
==
curr_lane
->
id
().
id
(
);
}
bool
PredictionMap
::
IsIdenticalLane
(
...
...
@@ -384,17 +381,13 @@ bool PredictionMap::IsIdenticalLane(
return
false
;
}
int
PredictionMap
::
LaneTurnType
(
const
Id
&
id
)
{
std
::
shared_ptr
<
const
LaneInfo
>
lane
=
LaneById
(
id
);
int
PredictionMap
::
LaneTurnType
(
const
std
::
string
&
lane_
id
)
{
std
::
shared_ptr
<
const
LaneInfo
>
lane
=
LaneById
(
lane_
id
);
if
(
lane
!=
nullptr
)
{
return
static_cast
<
int
>
(
lane
->
lane
().
turn
());
}
return
1
;
}
int
PredictionMap
::
LaneTurnType
(
const
std
::
string
&
lane_id
)
{
return
LaneTurnType
(
apollo
::
hdmap
::
MakeMapId
(
lane_id
));
}
}
// namespace prediction
}
// namespace apollo
modules/prediction/common/prediction_map.h
浏览文件 @
c6f0c000
...
...
@@ -63,21 +63,13 @@ class PredictionMap {
std
::
shared_ptr
<
const
apollo
::
hdmap
::
LaneInfo
>
lane_info
,
const
double
s
);
/**
* @brief Get a shared pointer to a lane by lane ID.
* @param id The ID of the target lane ID.
* @return A shared pointer to the lane with the input lane ID.
*/
std
::
shared_ptr
<
const
apollo
::
hdmap
::
LaneInfo
>
LaneById
(
const
apollo
::
hdmap
::
Id
&
id
);
/**
* @brief Get a shared pointer to a lane by lane ID.
* @param id The ID of the target lane ID in the form of string.
* @return A shared pointer to the lane with the input lane ID.
*/
std
::
shared_ptr
<
const
apollo
::
hdmap
::
LaneInfo
>
LaneById
(
const
std
::
string
&
str_
id
);
const
std
::
string
&
id
);
/**
* @brief Get the frenet coordinates (s, l) on a lane by a position.
...
...
@@ -139,7 +131,7 @@ class PredictionMap {
* @return If the process is successful. 0: success, -1: failure.
*/
int
SmoothPointFromLane
(
const
apollo
::
hdmap
::
Id
&
id
,
const
double
s
,
const
std
::
string
&
id
,
const
double
s
,
const
double
l
,
Eigen
::
Vector2d
*
point
,
double
*
heading
);
...
...
@@ -259,13 +251,6 @@ class PredictionMap {
std
::
shared_ptr
<
const
apollo
::
hdmap
::
LaneInfo
>
other_lane
,
const
std
::
vector
<
std
::
shared_ptr
<
const
apollo
::
hdmap
::
LaneInfo
>>&
lanes
);
/**
* @brief Get lane turn type.
* @param id The lane ID.
* @return Integer corresponding to the lane turn type.
*/
int
LaneTurnType
(
const
apollo
::
hdmap
::
Id
&
id
);
/**
* @brief Get lane turn type.
* @param lane_id The lane ID.
...
...
@@ -273,16 +258,6 @@ class PredictionMap {
*/
int
LaneTurnType
(
const
std
::
string
&
lane_id
);
/**
* @brief Get the ID in the form of string.
* @param info Map information.
* @return String of ID.
*/
template
<
class
MapInfo
>
static
std
::
string
id_string
(
std
::
shared_ptr
<
const
MapInfo
>
info
)
{
return
info
->
id
().
id
();
}
private:
DECLARE_SINGLETON
(
PredictionMap
);
};
...
...
modules/prediction/common/prediction_map_test.cc
浏览文件 @
c6f0c000
...
...
@@ -159,8 +159,7 @@ TEST_F(PredictionMapTest, get_path_heading) {
}
TEST_F
(
PredictionMapTest
,
get_smooth_point_from_lane
)
{
Id
id
;
id
.
set_id
(
"l20"
);
const
std
::
string
id
=
"l20"
;
double
s
=
10.0
;
double
l
=
0.0
;
double
heading
=
M_PI
;
...
...
modules/prediction/common/road_graph.cc
浏览文件 @
c6f0c000
...
...
@@ -71,7 +71,7 @@ void RoadGraph::ComputeLaneSequence(
LaneSegment
lane_segment
;
lane_segment
.
set_lane_id
(
lane_info_ptr
->
id
().
id
());
lane_segment
.
set_start_s
(
start_s
);
lane_segment
.
set_lane_turn_type
(
map
->
LaneTurnType
(
lane_info_ptr
->
id
()));
lane_segment
.
set_lane_turn_type
(
map
->
LaneTurnType
(
lane_info_ptr
->
id
()
.
id
()
));
if
(
accumulated_s
+
lane_info_ptr
->
total_length
()
-
start_s
>=
length_
)
{
lane_segment
.
set_end_s
(
length_
-
accumulated_s
+
start_s
);
}
else
{
...
...
@@ -90,8 +90,7 @@ void RoadGraph::ComputeLaneSequence(
const
double
successor_accumulated_s
=
accumulated_s
+
lane_info_ptr
->
total_length
()
-
start_s
;
for
(
const
auto
&
successor_lane_id
:
lane_info_ptr
->
lane
().
successor_id
())
{
std
::
shared_ptr
<
const
LaneInfo
>
successor_lane
=
map
->
LaneById
(
successor_lane_id
);
auto
successor_lane
=
map
->
LaneById
(
successor_lane_id
.
id
());
ComputeLaneSequence
(
successor_accumulated_s
,
0.0
,
successor_lane
,
lane_segments
,
lane_graph_ptr
);
}
...
...
modules/prediction/container/obstacles/obstacle.cc
浏览文件 @
c6f0c000
...
...
@@ -772,7 +772,7 @@ void Obstacle::SetCurrentLanes(Feature* feature) {
}
double
min_heading_diff
=
std
::
numeric_limits
<
double
>::
infinity
();
for
(
std
::
shared_ptr
<
const
LaneInfo
>
current_lane
:
current_lanes
)
{
int
turn_type
=
map
->
LaneTurnType
(
current_lane
->
id
());
int
turn_type
=
map
->
LaneTurnType
(
current_lane
->
id
()
.
id
()
);
std
::
string
lane_id
=
current_lane
->
id
().
id
();
double
s
=
0.0
;
double
l
=
0.0
;
...
...
@@ -843,7 +843,7 @@ void Obstacle::SetNearbyLanes(Feature* feature) {
if
(
s
<
0.0
||
s
>=
nearby_lane
->
total_length
())
{
continue
;
}
int
turn_type
=
map
->
LaneTurnType
(
nearby_lane
->
id
());
int
turn_type
=
map
->
LaneTurnType
(
nearby_lane
->
id
()
.
id
()
);
double
heading
=
feature
->
theta
();
if
(
FLAGS_enable_kf_tracking
)
{
heading
=
feature
->
t_velocity_heading
();
...
...
modules/prediction/predictor/vehicle/lane_sequence_predictor.cc
浏览文件 @
c6f0c000
...
...
@@ -180,7 +180,7 @@ void LaneSequencePredictor::DrawLaneSequenceTrajectoryPoints(
for
(
size_t
i
=
0
;
i
<
static_cast
<
size_t
>
(
total_time
/
freq
);
++
i
)
{
Eigen
::
Vector2d
point
;
double
theta
=
M_PI
;
if
(
map
->
SmoothPointFromLane
(
apollo
::
hdmap
::
MakeMapId
(
lane_id
)
,
if
(
map
->
SmoothPointFromLane
(
lane_id
,
lane_s
,
lane_l
,
&
point
,
&
theta
)
!=
0
)
{
AERROR
<<
"Unable to get smooth point from lane ["
<<
lane_id
<<
"] with s ["
<<
lane_s
<<
"] and l ["
<<
lane_l
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录