Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
0bf299b4
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,发现更多精彩内容 >>
提交
0bf299b4
编写于
1月 21, 2019
作者:
多味笋丝
提交者:
Liangliang Zhang
1月 21, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add road type for hdmap
上级
34aa9f3a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
99 addition
and
28 deletion
+99
-28
modules/map/hdmap/adapter/xml_parser/common_define.h
modules/map/hdmap/adapter/xml_parser/common_define.h
+3
-0
modules/map/hdmap/adapter/xml_parser/roads_xml_parser.cc
modules/map/hdmap/adapter/xml_parser/roads_xml_parser.cc
+75
-28
modules/map/hdmap/adapter/xml_parser/roads_xml_parser.h
modules/map/hdmap/adapter/xml_parser/roads_xml_parser.h
+11
-0
modules/map/hdmap/hdmap_common.h
modules/map/hdmap/hdmap_common.h
+2
-0
modules/map/proto/map_road.proto
modules/map/proto/map_road.proto
+8
-0
未找到文件。
modules/map/hdmap/adapter/xml_parser/common_define.h
浏览文件 @
0bf299b4
...
...
@@ -60,6 +60,7 @@ using PbSignalType = apollo::hdmap::Signal_Type;
using
PbSubSignalType
=
apollo
::
hdmap
::
Subsignal_Type
;
using
PbStopSignType
=
apollo
::
hdmap
::
StopSign_StopType
;
using
PbBoundaryEdgeType
=
apollo
::
hdmap
::
BoundaryEdge_Type
;
using
PbRoadType
=
apollo
::
hdmap
::
Road_Type
;
struct
StopLineInternal
{
std
::
string
id
;
...
...
@@ -125,6 +126,8 @@ struct RoadInternal {
bool
in_junction
;
std
::
string
junction_id
;
std
::
string
type
;
std
::
vector
<
RoadSectionInternal
>
sections
;
std
::
vector
<
TrafficLightInternal
>
traffic_lights
;
...
...
modules/map/hdmap/adapter/xml_parser/roads_xml_parser.cc
浏览文件 @
0bf299b4
...
...
@@ -47,46 +47,32 @@ Status RoadsXmlParser::Parse(const tinyxml2::XMLElement& xml_node,
std
::
string
err_msg
=
"Error parsing road attributes"
;
return
Status
(
apollo
::
common
::
ErrorCode
::
HDMAP_DATA_ERROR
,
err_msg
);
}
RoadInternal
road_internal
;
road_internal
.
id
=
id
;
road_internal
.
road
.
mutable_id
()
->
set_id
(
id
);
if
(
IsRoadBelongToJunction
(
junction_id
))
{
road_internal
.
road
.
mutable_junction_id
()
->
set_id
(
junction_id
);
}
std
::
string
type
;
checker
=
UtilXmlParser
::
QueryStringAttribute
(
*
road_node
,
"type"
,
&
type
);
if
(
checker
!=
tinyxml2
::
XML_SUCCESS
)
{
// forward compatibility with old data
type
=
"CITYROAD"
;
}
PbRoadType
pb_road_type
;
RETURN_IF_ERROR
(
to_pb_road_type
(
type
,
&
pb_road_type
));
road_internal
.
road
.
set_type
(
pb_road_type
);
// lanes
RETURN_IF_ERROR
(
LanesXmlParser
::
Parse
(
*
road_node
,
road_internal
.
id
,
&
road_internal
.
sections
));
// objects
auto
sub_node
=
road_node
->
FirstChildElement
(
"objects"
);
if
(
sub_node
!=
nullptr
)
{
// stop line
ObjectsXmlParser
::
ParseStopLines
(
*
sub_node
,
&
road_internal
.
stop_lines
);
// crosswalks
ObjectsXmlParser
::
ParseCrosswalks
(
*
sub_node
,
&
road_internal
.
crosswalks
);
// clearareas
ObjectsXmlParser
::
ParseClearAreas
(
*
sub_node
,
&
road_internal
.
clear_areas
);
// speed_bumps
ObjectsXmlParser
::
ParseSpeedBumps
(
*
sub_node
,
&
road_internal
.
speed_bumps
);
// parking_spaces
ObjectsXmlParser
::
ParseParkingSpaces
(
*
sub_node
,
&
road_internal
.
parking_spaces
);
// pnc_junctions
ObjectsXmlParser
::
ParsePNCJunctions
(
*
sub_node
,
&
road_internal
.
pnc_junctions
);
}
Parse_road_objects
(
*
road_node
,
&
road_internal
);
// signals
sub_node
=
road_node
->
FirstChildElement
(
"signals"
);
if
(
sub_node
!=
nullptr
)
{
// traffic lights
SignalsXmlParser
::
ParseTrafficLights
(
*
sub_node
,
&
road_internal
.
traffic_lights
);
// stop signs
SignalsXmlParser
::
ParseStopSigns
(
*
sub_node
,
&
road_internal
.
stop_signs
);
// yield signs
SignalsXmlParser
::
ParseYieldSigns
(
*
sub_node
,
&
road_internal
.
yield_signs
);
}
Parse_road_signals
(
*
road_node
,
&
road_internal
);
roads
->
push_back
(
road_internal
);
road_node
=
road_node
->
NextSiblingElement
(
"road"
);
...
...
@@ -95,6 +81,67 @@ Status RoadsXmlParser::Parse(const tinyxml2::XMLElement& xml_node,
return
Status
::
OK
();
}
void
RoadsXmlParser
::
Parse_road_objects
(
const
tinyxml2
::
XMLElement
&
xml_node
,
RoadInternal
*
road_info
)
{
CHECK_NOTNULL
(
road_info
);
// objects
auto
sub_node
=
xml_node
.
FirstChildElement
(
"objects"
);
if
(
sub_node
!=
nullptr
)
{
// stop line
ObjectsXmlParser
::
ParseStopLines
(
*
sub_node
,
&
road_info
->
stop_lines
);
// crosswalks
ObjectsXmlParser
::
ParseCrosswalks
(
*
sub_node
,
&
road_info
->
crosswalks
);
// clearareas
ObjectsXmlParser
::
ParseClearAreas
(
*
sub_node
,
&
road_info
->
clear_areas
);
// speed_bumps
ObjectsXmlParser
::
ParseSpeedBumps
(
*
sub_node
,
&
road_info
->
speed_bumps
);
// parking_spaces
ObjectsXmlParser
::
ParseParkingSpaces
(
*
sub_node
,
&
road_info
->
parking_spaces
);
// pnc_junctions
ObjectsXmlParser
::
ParsePNCJunctions
(
*
sub_node
,
&
road_info
->
pnc_junctions
);
}
}
void
RoadsXmlParser
::
Parse_road_signals
(
const
tinyxml2
::
XMLElement
&
xml_node
,
RoadInternal
*
road_info
)
{
CHECK_NOTNULL
(
road_info
);
// signals
auto
sub_node
=
xml_node
.
FirstChildElement
(
"signals"
);
if
(
sub_node
!=
nullptr
)
{
// traffic lights
SignalsXmlParser
::
ParseTrafficLights
(
*
sub_node
,
&
road_info
->
traffic_lights
);
// stop signs
SignalsXmlParser
::
ParseStopSigns
(
*
sub_node
,
&
road_info
->
stop_signs
);
// yield signs
SignalsXmlParser
::
ParseYieldSigns
(
*
sub_node
,
&
road_info
->
yield_signs
);
}
}
Status
RoadsXmlParser
::
to_pb_road_type
(
const
std
::
string
&
type
,
PbRoadType
*
pb_road_type
)
{
CHECK_NOTNULL
(
pb_road_type
);
std
::
string
upper_type
=
UtilXmlParser
::
ToUpper
(
type
);
if
(
upper_type
==
"UNKNOWN"
)
{
*
pb_road_type
=
apollo
::
hdmap
::
Road
::
UNKNOWN
;
}
else
if
(
upper_type
==
"HIGHWAY"
)
{
*
pb_road_type
=
apollo
::
hdmap
::
Road
::
HIGHWAY
;
}
else
if
(
upper_type
==
"CITYROAD"
)
{
*
pb_road_type
=
apollo
::
hdmap
::
Road
::
CITY_ROAD
;
}
else
if
(
upper_type
==
"PARK"
)
{
*
pb_road_type
=
apollo
::
hdmap
::
Road
::
PARK
;
}
else
{
std
::
string
err_msg
=
"Error or unsupport road type"
;
return
Status
(
apollo
::
common
::
ErrorCode
::
HDMAP_DATA_ERROR
,
err_msg
);
}
return
Status
::
OK
();
}
}
// namespace adapter
}
// namespace hdmap
}
// namespace apollo
modules/map/hdmap/adapter/xml_parser/roads_xml_parser.h
浏览文件 @
0bf299b4
...
...
@@ -15,6 +15,7 @@ limitations under the License.
#pragma once
#include <vector>
#include <string>
#include "tinyxml2/tinyxml2.h"
...
...
@@ -29,6 +30,16 @@ class RoadsXmlParser {
public:
static
Status
Parse
(
const
tinyxml2
::
XMLElement
&
xml_node
,
std
::
vector
<
RoadInternal
>*
roads
);
private:
static
void
Parse_road_objects
(
const
tinyxml2
::
XMLElement
&
xml_node
,
RoadInternal
*
road_info
);
static
void
Parse_road_signals
(
const
tinyxml2
::
XMLElement
&
xml_node
,
RoadInternal
*
road_info
);
static
Status
to_pb_road_type
(
const
std
::
string
&
type
,
PbRoadType
*
pb_road_type
);
};
}
// namespace adapter
...
...
modules/map/hdmap/hdmap_common.h
浏览文件 @
0bf299b4
...
...
@@ -458,6 +458,8 @@ class RoadInfo {
const
std
::
vector
<
RoadBoundary
>
&
GetBoundaries
()
const
;
apollo
::
hdmap
::
Road_Type
type
()
const
{
return
road_
.
type
();
}
private:
Road
road_
;
std
::
vector
<
RoadSection
>
sections_
;
...
...
modules/map/proto/map_road.proto
浏览文件 @
0bf299b4
...
...
@@ -53,4 +53,12 @@ message Road {
// if lane road not in the junction, junction id is null.
optional
Id
junction_id
=
3
;
enum
Type
{
UNKNOWN
=
0
;
HIGHWAY
=
1
;
CITY_ROAD
=
2
;
PARK
=
3
;
};
optional
Type
type
=
4
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录