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
4deb4763
Commit
4deb4763
authored
1 year ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Solved a bug when computing the (x,y) center of the imported map.
parent
2cac3c19
No related branches found
No related tags found
1 merge request
!2
Solved a bug when creating a new geometry object: the sale factor is...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/osm/osm_map.cpp
+18
-16
18 additions, 16 deletions
src/osm/osm_map.cpp
with
18 additions
and
16 deletions
src/osm/osm_map.cpp
+
18
−
16
View file @
4deb4763
...
@@ -73,6 +73,7 @@ void COSMMap::process_map(void)
...
@@ -73,6 +73,7 @@ void COSMMap::process_map(void)
{
{
std
::
vector
<
COSMNode
*>::
iterator
node_it
;
std
::
vector
<
COSMNode
*>::
iterator
node_it
;
std
::
vector
<
COSMWay
*>::
iterator
way_it
;
std
::
vector
<
COSMWay
*>::
iterator
way_it
;
double
x
,
y
;
// remove all nodes that do not belong to any road
// remove all nodes that do not belong to any road
for
(
node_it
=
this
->
nodes
.
begin
();
node_it
!=
this
->
nodes
.
end
();)
for
(
node_it
=
this
->
nodes
.
begin
();
node_it
!=
this
->
nodes
.
end
();)
...
@@ -102,6 +103,20 @@ void COSMMap::process_map(void)
...
@@ -102,6 +103,20 @@ void COSMMap::process_map(void)
// remove nodes inside other ways width
// remove nodes inside other ways width
for
(
unsigned
int
i
=
0
;
i
<
this
->
nodes
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
nodes
.
size
();
i
++
)
this
->
nodes
[
i
]
->
remove_in_junction_nodes
();
this
->
nodes
[
i
]
->
remove_in_junction_nodes
();
for
(
unsigned
int
i
=
0
;
i
<
this
->
nodes
.
size
();
i
++
)
{
this
->
nodes
[
i
]
->
get_location
(
x
,
y
);
// get the coordinates
if
(
x
>
this
->
max_x
)
this
->
max_x
=
x
;
if
(
x
<
this
->
min_x
)
this
->
min_x
=
x
;
if
(
y
>
this
->
max_y
)
this
->
max_y
=
y
;
if
(
y
<
this
->
min_y
)
this
->
min_y
=
y
;
}
this
->
normalize_locations
();
}
}
void
COSMMap
::
create_junctions
(
void
)
void
COSMMap
::
create_junctions
(
void
)
...
@@ -239,6 +254,9 @@ void COSMMap::normalize_locations(void)
...
@@ -239,6 +254,9 @@ void COSMMap::normalize_locations(void)
this
->
min_x
-=
center_x
;
this
->
min_x
-=
center_x
;
this
->
max_y
-=
center_y
;
this
->
max_y
-=
center_y
;
this
->
min_y
-=
center_y
;
this
->
min_y
-=
center_y
;
// compute the width and heigth
this
->
width
=
this
->
max_x
-
this
->
min_x
;
this
->
height
=
this
->
max_y
-
this
->
min_y
;
}
}
void
COSMMap
::
load
(
const
std
::
string
&
filename
)
void
COSMMap
::
load
(
const
std
::
string
&
filename
)
...
@@ -264,11 +282,6 @@ void COSMMap::load(const std::string &filename)
...
@@ -264,11 +282,6 @@ void COSMMap::load(const std::string &filename)
osmium
::
apply
(
relation_reader
,
*
this
);
osmium
::
apply
(
relation_reader
,
*
this
);
relation_reader
.
close
();
relation_reader
.
close
();
// normalize locations
this
->
normalize_locations
();
// compute the width and heigth
this
->
width
=
this
->
max_x
-
this
->
min_x
;
this
->
height
=
this
->
max_y
-
this
->
min_y
;
this
->
process_map
();
this
->
process_map
();
this
->
create_road_segments
();
this
->
create_road_segments
();
this
->
create_junctions
();
this
->
create_junctions
();
...
@@ -277,20 +290,9 @@ void COSMMap::load(const std::string &filename)
...
@@ -277,20 +290,9 @@ void COSMMap::load(const std::string &filename)
void
COSMMap
::
node
(
const
osmium
::
Node
&
node
)
void
COSMMap
::
node
(
const
osmium
::
Node
&
node
)
{
{
COSMNode
*
new_node
;
COSMNode
*
new_node
;
double
x
,
y
;
// create and add the new node
// create and add the new node
new_node
=
new
COSMNode
(
node
,
this
);
new_node
=
new
COSMNode
(
node
,
this
);
new_node
->
get_location
(
x
,
y
);
// get the coordinates
if
(
x
>
this
->
max_x
)
this
->
max_x
=
x
;
if
(
x
<
this
->
min_x
)
this
->
min_x
=
x
;
if
(
y
>
this
->
max_y
)
this
->
max_y
=
y
;
if
(
y
<
this
->
min_y
)
this
->
min_y
=
y
;
this
->
add_node
(
new_node
);
this
->
add_node
(
new_node
);
}
}
...
...
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