Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
thirdparty_map
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
oscar
thirdparty_map
Commits
6fcf5e5d
Commit
6fcf5e5d
authored
Mar 23, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交更新
parent
c40ded97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
77 deletions
+71
-77
MapInterface.hpp
include/MapInterface.hpp
+64
-70
main.cpp
main.cpp
+7
-7
No files found.
include/MapInterface.hpp
View file @
6fcf5e5d
...
...
@@ -3,87 +3,80 @@
#include <string>
#include <vector>
#include <map>
namespace
jf
{
enum
class
LaneType
{
NotInvestigated
=
0
,
// 未调查
NormalLane
=
1
,
// 普通车道
EnterLane
=
2
,
// 入口车道
ExitLane
=
3
,
// 出口车道
ConnectLane
=
4
,
// 连接车道
EmergencyLane
=
5
,
// 应急车道
StopLane
=
6
,
// 停车道
EmergencyStopLane
=
7
,
// 紧急停车道
AcceleratingLane
=
8
,
// 加速车道
DeceleratingLane
=
9
,
// 减速车道
HazardLane
=
10
,
// 避险车道
JunctionLane
=
11
,
// 路口车道
TollStationLane
=
12
,
// 收费站车道
CheckpointLane
=
13
,
// 检查站车道
UTurnLane
=
14
,
// 掉头车道
BusLane
=
15
,
// 公交车道
TidalLane
=
16
,
// 潮汐(可变) 车道
LocomotiveLane
=
17
,
// 机车车道
LocomotiveParkingArea
=
18
,
// 机车停车区
HOVHighLoadLane
=
19
,
// HOV 高承载车道
NonMotorizedLane
=
30
,
// 非机动车道
Sidewalk
=
40
,
// 人行道
Ohters
=
99
,
// 其它车道
};
enum
class
LaneType
{
NotInvestigated
=
0
,
// 未调查
NormalLane
=
1
,
// 普通车道
EnterLane
=
2
,
// 入口车道
ExitLane
=
3
,
// 出口车道
ConnectLane
=
4
,
// 连接车道
EmergencyLane
=
5
,
// 应急车道
StopLane
=
6
,
// 停车道
EmergencyStopLane
=
7
,
// 紧急停车道
AcceleratingLane
=
8
,
// 加速车道
DeceleratingLane
=
9
,
// 减速车道
HazardLane
=
10
,
// 避险车道
JunctionLane
=
11
,
// 路口车道
TollStationLane
=
12
,
// 收费站车道
CheckpointLane
=
13
,
// 检查站车道
UTurnLane
=
14
,
// 掉头车道
BusLane
=
15
,
// 公交车道
TidalLane
=
16
,
// 潮汐(可变) 车道
LocomotiveLane
=
17
,
// 机车车道
LocomotiveParkingArea
=
18
,
// 机车停车区
HOVHighLoadLane
=
19
,
// HOV 高承载车道
NonMotorizedLane
=
30
,
// 非机动车道
Sidewalk
=
40
,
// 人行道
Ohters
=
99
,
// 其它车道
};
enum
class
EdgeCrossType
{
NotInvestigated
=
0
,
// 未调查
Unable
=
1
,
// 无法跨越
BidirecAble
=
2
,
// 双方向跨越
LeftAble
=
3
,
// 向左跨越
RightAble
=
4
,
// 向右跨越
};
enum
class
EdgeCrossType
{
NotInvestigated
=
0
,
// 未调查
Unable
=
1
,
// 无法跨越
BidirecAble
=
2
,
// 双方向跨越
LeftAble
=
3
,
// 向左跨越
RightAble
=
4
,
// 向右跨越
};
/**
* @brief 84坐标系中的点
*
*/
struct
Point
{
Point
()
:
dLon
(
0
),
dLat
(
0
),
dAlt
(
0
)
{};
Point
(
double
inlon
,
double
inlat
,
double
alt
);
Point
(
const
Point
&
o
);
Point
(
const
std
::
vector
<
double
>&
d
);
Point
(
const
std
::
map
<
std
::
string
,
double
>&
m
);
/**
* @brief 经度
*
*/
double
dLon
;
/**
* @brief 维度
*
*/
double
dLat
;
/**
* @brief
高度
* @brief
84坐标系中的点
*
*/
double
dAlt
;
struct
Point
{
Point
()
:
dLon
(
0
),
dLat
(
0
),
dAlt
(
0
)
{};
Point
(
double
inlon
,
double
inlat
,
double
alt
)
:
dLon
(
inlon
),
dLat
(
inlat
),
dAlt
(
alt
)
{}
Point
&
operator
=
(
const
Point
&
o
);
bool
operator
==
(
const
Point
&
o
)
const
{
return
dLon
==
o
.
dLon
&&
dLat
==
o
.
dLat
&&
dAlt
==
o
.
dAlt
;
}
bool
operator
!=
(
const
Point
&
o
)
const
{
return
!
(
*
this
==
o
);
}
std
::
string
to_string
()
const
{
return
std
::
to_string
(
dLon
)
+
", "
+
std
::
to_string
(
dLat
)
+
", "
+
std
::
to_string
(
dAlt
);
}
};
/**
* @brief 经度
*
*/
double
dLon
;
/**
* @brief 维度
*
*/
double
dLat
;
/**
* @brief 高度
*
*/
double
dAlt
;
};
class
MapInterface
{
public
:
MapInterface
(
const
std
::
string
&
strPrjPath
,
const
std
::
string
strCfgPath
);
~
MapInterface
();
class
MapInterface
{
public
:
MapInterface
(
const
std
::
string
&
strPrjPath
,
const
std
::
string
strCfgPath
);
~
MapInterface
();
public
:
bool
GetMapData
(
const
Point
&
ptInLoc
,
double
dCarAngle
,
int
&
nOutLaneCnt
,
int
&
nOutLaneNum
,
LaneType
&
nOutLaneType
,
EdgeCrossType
&
nOutLeftEdgeCrossType
,
EdgeCrossType
&
nOutRightEdgeCrossType
,
int
&
nOutSpeedLimit
,
double
&
dOutLaneAngle
,
Point
&
ptOutFoot
);
bool
GetMapData
(
const
Point
&
ptInLoc
,
double
dCarAngle
,
long
&
lOutRaodId
,
std
::
vector
<
long
>
&
vctlOutPreRoadId
,
std
::
vector
<
long
>
&
vctlOutNxtRoadId
,
int
&
nLaneCnt
,
int
&
nOutLaneNum
,
LaneType
&
nOutLaneType
,
EdgeCrossType
&
nOutLeftEdgeCrossType
,
EdgeCrossType
&
nOutRightEdgeCrossType
,
int
&
nOutSpeedLimit
,
double
&
dOutLaneAngle
,
Point
&
ptOutFoot
);
public
:
bool
GetMapData
(
const
Point
&
ptInLoc
,
double
dCarAngle
,
int
&
nOutLaneCnt
,
int
&
nOutLaneNum
,
LaneType
&
nOutLaneType
,
EdgeCrossType
&
nOutLeftEdgeCrossType
,
EdgeCrossType
&
nOutRightEdgeCrossType
,
int
&
nOutSpeedLimit
,
double
&
dOutLaneAngle
,
Point
&
ptOutFoot
);
bool
GetMapData
(
const
Point
&
ptInLoc
,
double
dCarAngle
,
long
&
lOutRaodId
,
std
::
vector
<
long
>&
vctlOutPreRoadId
,
std
::
vector
<
long
>&
vctlOutNxtRoadId
,
int
&
nLaneCnt
,
int
&
nOutLaneNum
,
LaneType
&
nOutLaneType
,
EdgeCrossType
&
nOutLeftEdgeCrossType
,
EdgeCrossType
&
nOutRightEdgeCrossType
,
int
&
nOutSpeedLimit
,
double
&
dOutLaneAngle
,
Point
&
ptOutFoot
);
};
};
}
// namespace jf
#endif
\ No newline at end of file
main.cpp
View file @
6fcf5e5d
...
...
@@ -4,15 +4,14 @@
#include <vector>
#include "MapInterface.hpp"
using
namespace
OpenDrive
;
int
main
(
int
argc
,
char
*
argv
[])
{
printf
(
"hello world
\n
"
);
printf
(
"hello world
\n
"
);
std
::
string
dir
=
""
;
std
::
string
cfg
=
""
;
jf
::
MapInterface
mapInstance
(
dir
,
cfg
);
jf
::
MapInterface
mapInstance
(
dir
,
cfg
);
int
nLaneCnt
=
0
/*所在道路的车道总数*/
,
nOutLaneNum
=
0
;
//当前所在位置的车道序号,从左至右,从1开始
jf
::
LaneType
nOutLaneType
=
jf
::
LaneType
::
NotInvestigated
;
//车道类型,看头文件枚举
...
...
@@ -21,15 +20,15 @@ int main(int argc, char* argv[])
int
nOutSpeedLimit
=
0
;
//车道最高限速值,单位是千米每小时
double
dOutLaneAngle
=
0.0
;
//所在车道,车应该的朝向角度,北为0,顺时针旋转360,0-360
const
jf
::
Point
ptInLoc
=
{
objAll
.
obj
.
lon
,
objAll
.
obj
.
lat
,
0.0
};
const
jf
::
Point
ptInLoc
=
{
106.474419689
,
29.67213045
,
0.0
};
jf
::
Point
ptOutFoot
;
//车道中心线做垂线的点
double
dCarAngle
=
objAll
.
obj
.
heading
;
double
dCarAngle
=
0
;
long
lOutRaodId
;
std
::
vector
<
long
>
vctlOutPreRoadId
;
std
::
vector
<
long
>
vctlOutNxtRoadId
;
//ROS_INFO("begin call jfxmap");
bool
result
=
m
_OfflineMap
->
GetMapData
(
ptInLoc
,
dCarAngle
,
lOutRaodId
,
vctlOutPreRoadId
,
vctlOutNxtRoadId
,
bool
result
=
m
apInstance
.
GetMapData
(
ptInLoc
,
dCarAngle
,
lOutRaodId
,
vctlOutPreRoadId
,
vctlOutNxtRoadId
,
nLaneCnt
,
nOutLaneNum
,
nOutLaneType
,
nOutLeftEdgeCrossType
,
nOutRightEdgeCrossType
,
nOutSpeedLimit
,
dOutLaneAngle
,
ptOutFoot
);
...
...
@@ -137,5 +136,5 @@ int main(int argc, char* argv[])
//}
return
0
;
return
0
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment