Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autonomous_driving_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
autonomous_driving
autonomous_driving_tools
Commits
7d601ef2
Commit
7d601ef2
authored
1 year ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added an example to import an Open Street Map file.
parent
bec0e4b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2
Solved a bug when creating a new geometry object: the sale factor is...
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/examples/CMakeLists.txt
+5
-15
5 additions, 15 deletions
src/examples/CMakeLists.txt
src/examples/osm_import_test.cpp
+43
-0
43 additions, 0 deletions
src/examples/osm_import_test.cpp
src/road_map.cpp
+10
-0
10 additions, 0 deletions
src/road_map.cpp
with
58 additions
and
15 deletions
src/examples/CMakeLists.txt
+
5
−
15
View file @
7d601ef2
...
...
@@ -3,21 +3,6 @@ ADD_EXECUTABLE(dijkstra_test dijkstra_test.cpp)
# link necessary libraries
TARGET_LINK_LIBRARIES
(
dijkstra_test
${
PROJECT_NAME
}
)
# create an example application
#ADD_EXECUTABLE(opendrive_test opendrive_test.cpp)
# link necessary libraries
#TARGET_LINK_LIBRARIES(opendrive_test ${PROJECT_NAME})
# create an example application
#ADD_EXECUTABLE(opendrive_build_road_test opendrive_build_road_test.cpp)
# link necessary libraries
#TARGET_LINK_LIBRARIES(opendrive_build_road_test ${PROJECT_NAME})
# create an example application
#ADD_EXECUTABLE(osm_test osm_test.cpp)
# link necessary libraries
#TARGET_LINK_LIBRARIES(osm_test ${PROJECT_NAME})
# create an example application
ADD_EXECUTABLE
(
build_from_scratch_test build_from_scratch_test.cpp
)
# link necessary libraries
...
...
@@ -27,3 +12,8 @@ TARGET_LINK_LIBRARIES(build_from_scratch_test ${PROJECT_NAME})
ADD_EXECUTABLE
(
opendrive_import_test opendrive_import_test.cpp
)
# link necessary libraries
TARGET_LINK_LIBRARIES
(
opendrive_import_test
${
PROJECT_NAME
}
)
# create an example application
ADD_EXECUTABLE
(
osm_import_test osm_import_test.cpp
)
# link necessary libraries
TARGET_LINK_LIBRARIES
(
osm_import_test
${
PROJECT_NAME
}
)
This diff is collapsed.
Click to expand it.
src/examples/osm_import_test.cpp
0 → 100644
+
43
−
0
View file @
7d601ef2
#include
"road_map.h"
#include
"exceptions.h"
#include
<iostream>
//const std::string osm_file="/home/shernand/Downloads/test_osm.osm";
const
std
::
string
osm_file
=
"/home/shernand/Downloads/test_osm2.osm"
;
int
main
(
int
argc
,
char
*
argv
[])
{
try
{
CRoadMap
map
,
new_map
;
Eigen
::
MatrixXi
connectivity
;
std
::
vector
<
unsigned
int
>
id_map
,
new_path
,
old_path
;
std
::
vector
<
double
>
x
,
y
,
heading
;
map
.
load_osm
(
osm_file
);
map
.
get_lane_geometry
(
x
,
y
,
heading
);
for
(
unsigned
int
i
=
0
;
i
<
x
.
size
();
i
++
)
std
::
cout
<<
x
[
i
]
<<
","
<<
y
[
i
]
<<
","
<<
heading
[
i
]
<<
std
::
endl
;
return
0
;
// old_path.push_back(3);
// old_path.push_back(4);
old_path
.
push_back
(
22
);
// old_path.push_back(10);
new_path
=
map
.
get_path_sub_roadmap
(
old_path
,
new_map
);
new_map
.
get_segment_connectivity
(
connectivity
,
id_map
);
for
(
unsigned
int
i
=
0
;
i
<
id_map
.
size
();
i
++
)
std
::
cout
<<
i
<<
" -> "
<<
id_map
[
i
]
<<
" "
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
"Initial connectivity:"
<<
std
::
endl
;
std
::
cout
<<
connectivity
<<
std
::
endl
;
}
catch
(
CException
&
e
)
{
std
::
cout
<<
"[Exception caught] : "
<<
e
.
what
()
<<
std
::
endl
;
}
return
0
;
}
This diff is collapsed.
Click to expand it.
src/road_map.cpp
+
10
−
0
View file @
7d601ef2
...
...
@@ -4,6 +4,8 @@
#include
"opendrive/opendrive_road_segment.h"
#include
"opendrive/opendrive_junction.h"
#include
"osm/osm_map.h"
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<chrono>
...
...
@@ -372,6 +374,14 @@ void CRoadMap::save_opendrive(const std::string &filename)
}
}
void
CRoadMap
::
load_osm
(
const
std
::
string
&
filename
)
{
COSMMap
road_map
;
road_map
.
load
(
filename
);
road_map
.
convert
(
*
this
);
}
void
CRoadMap
::
set_resolution
(
double
resolution
)
{
this
->
resolution
=
resolution
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment