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
78444e7e
Commit
78444e7e
authored
1 year ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Updated the examples.
parent
4beec299
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
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/examples/build_from_scratch_test.cpp
+24
-18
24 additions, 18 deletions
src/examples/build_from_scratch_test.cpp
src/examples/opendrive_import_test.cpp
+6
-4
6 additions, 4 deletions
src/examples/opendrive_import_test.cpp
with
30 additions
and
22 deletions
src/examples/build_from_scratch_test.cpp
+
24
−
18
View file @
78444e7e
...
@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
...
@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
std
::
vector
<
double
>
x
,
y
,
heading
;
std
::
vector
<
double
>
x
,
y
,
heading
;
road0
=
new
CRoad
();
road0
=
new
CRoad
();
road0
->
set_num_lanes
(
1
);
road0
->
set_num_lanes
(
2
);
road0
->
set_lane_width
(
4.0
);
road0
->
set_lane_width
(
4.0
);
road0
->
set_start_point
(
20.0
,
60.0
,
3.14159
,
0.0
);
road0
->
set_start_point
(
20.0
,
60.0
,
3.14159
,
0.0
);
road0
->
add_segment
(
0.0
,
60.0
,
3.14159
,
0.0
);
road0
->
add_segment
(
0.0
,
60.0
,
3.14159
,
0.0
);
...
@@ -23,7 +23,7 @@ int main(int argc, char *argv[])
...
@@ -23,7 +23,7 @@ int main(int argc, char *argv[])
road0
->
add_segment
(
0.0
,
0.0
,
0.0
,
0.0
);
road0
->
add_segment
(
0.0
,
0.0
,
0.0
,
0.0
);
road0
->
add_segment
(
20.0
,
0.0
,
0.0
,
0.0
);
road0
->
add_segment
(
20.0
,
0.0
,
0.0
,
0.0
);
road1
=
new
CRoad
();
road1
=
new
CRoad
();
road1
->
set_num_lanes
(
1
);
road1
->
set_num_lanes
(
2
);
road1
->
set_lane_width
(
4.0
);
road1
->
set_lane_width
(
4.0
);
road1
->
set_start_point
(
20.0
,
0.0
,
3.14159
,
0.0
);
road1
->
set_start_point
(
20.0
,
0.0
,
3.14159
,
0.0
);
road1
->
add_segment
(
0.0
,
0.0
,
3.14159
,
0.0
);
road1
->
add_segment
(
0.0
,
0.0
,
3.14159
,
0.0
);
...
@@ -32,17 +32,17 @@ int main(int argc, char *argv[])
...
@@ -32,17 +32,17 @@ int main(int argc, char *argv[])
road1
->
add_segment
(
0.0
,
60.0
,
0.0
,
0.0
);
road1
->
add_segment
(
0.0
,
60.0
,
0.0
,
0.0
);
road1
->
add_segment
(
20.0
,
60.0
,
0.0
,
0.0
);
road1
->
add_segment
(
20.0
,
60.0
,
0.0
,
0.0
);
road2
=
new
CRoad
();
road2
=
new
CRoad
();
road2
->
set_num_lanes
(
1
);
road2
->
set_num_lanes
(
2
);
road2
->
set_lane_width
(
4.0
);
road2
->
set_lane_width
(
4.0
);
road2
->
set_start_point
(
30.0
,
50.0
,
4.71238898
,
0.0
);
road2
->
set_start_point
(
30.0
,
50.0
,
4.71238898
,
0.0
);
road2
->
add_segment
(
30.0
,
10.0
,
4.71238898
,
0.0
);
road2
->
add_segment
(
30.0
,
10.0
,
4.71238898
,
0.0
);
road3
=
new
CRoad
();
road3
=
new
CRoad
();
road3
->
set_num_lanes
(
1
);
road3
->
set_num_lanes
(
2
);
road3
->
set_lane_width
(
4.0
);
road3
->
set_lane_width
(
4.0
);
road3
->
set_start_point
(
30.0
,
10.0
,
1.5707
,
0.0
);
road3
->
set_start_point
(
30.0
,
10.0
,
1.5707
,
0.0
);
road3
->
add_segment
(
30.0
,
50.0
,
1.5707
,
0.0
);
road3
->
add_segment
(
30.0
,
50.0
,
1.5707
,
0.0
);
road4
=
new
CRoad
();
road4
=
new
CRoad
();
road4
->
set_num_lanes
(
1
);
road4
->
set_num_lanes
(
2
);
road4
->
set_lane_width
(
4.0
);
road4
->
set_lane_width
(
4.0
);
road4
->
set_start_point
(
40.0
,
60.0
,
0.0
,
0.0
);
road4
->
set_start_point
(
40.0
,
60.0
,
0.0
,
0.0
);
road4
->
add_segment
(
60.0
,
60.0
,
0.0
,
0.0
);
road4
->
add_segment
(
60.0
,
60.0
,
0.0
,
0.0
);
...
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
...
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
road4
->
add_segment
(
60.0
,
0.0
,
3.14159
,
0.0
);
road4
->
add_segment
(
60.0
,
0.0
,
3.14159
,
0.0
);
road4
->
add_segment
(
40.0
,
0.0
,
3.14159
,
0.0
);
road4
->
add_segment
(
40.0
,
0.0
,
3.14159
,
0.0
);
road5
=
new
CRoad
();
road5
=
new
CRoad
();
road5
->
set_num_lanes
(
1
);
road5
->
set_num_lanes
(
2
);
road5
->
set_lane_width
(
4.0
);
road5
->
set_lane_width
(
4.0
);
road5
->
set_start_point
(
40.0
,
0.0
,
0.0
,
0.0
);
road5
->
set_start_point
(
40.0
,
0.0
,
0.0
,
0.0
);
road5
->
add_segment
(
60.0
,
0.0
,
0.0
,
0.0
);
road5
->
add_segment
(
60.0
,
0.0
,
0.0
,
0.0
);
...
@@ -70,6 +70,10 @@ int main(int argc, char *argv[])
...
@@ -70,6 +70,10 @@ int main(int argc, char *argv[])
map
.
add_road
(
road4
);
map
.
add_road
(
road4
);
map
.
add_road
(
road5
);
map
.
add_road
(
road5
);
map
.
set_opposite_direction_roads_by_id
(
road0
->
get_id
(),
road1
->
get_id
());
map
.
set_opposite_direction_roads_by_id
(
road2
->
get_id
(),
road3
->
get_id
());
map
.
set_opposite_direction_roads_by_id
(
road4
->
get_id
(),
road5
->
get_id
());
map
.
add_junction
(
junction0
);
map
.
add_junction
(
junction0
);
map
.
add_junction
(
junction1
);
map
.
add_junction
(
junction1
);
...
@@ -80,17 +84,17 @@ int main(int argc, char *argv[])
...
@@ -80,17 +84,17 @@ int main(int argc, char *argv[])
junction0
->
add_outgoing_road
(
road2
);
junction0
->
add_outgoing_road
(
road2
);
junction0
->
add_outgoing_road
(
road4
);
junction0
->
add_outgoing_road
(
road4
);
junction0
->
link_roads_by_id
(
road1
->
get_id
(),
road2
->
get_id
());
junction0
->
link_roads_by_id
(
road1
->
get_id
(),
road2
->
get_id
());
junction0
->
link_lanes_by_id
(
road1
->
get_id
(),
0
,
road2
->
get_id
()
,
0
);
junction0
->
link_
same_
lanes_by_id
(
road1
->
get_id
(),
road2
->
get_id
());
junction0
->
link_roads_by_id
(
road1
->
get_id
(),
road4
->
get_id
());
junction0
->
link_roads_by_id
(
road1
->
get_id
(),
road4
->
get_id
());
junction0
->
link_lanes_by_id
(
road1
->
get_id
(),
0
,
road4
->
get_id
()
,
0
);
junction0
->
link_
same_
lanes_by_id
(
road1
->
get_id
(),
road4
->
get_id
());
junction0
->
link_roads_by_id
(
road3
->
get_id
(),
road0
->
get_id
());
junction0
->
link_roads_by_id
(
road3
->
get_id
(),
road0
->
get_id
());
junction0
->
link_lanes_by_id
(
road3
->
get_id
(),
0
,
road0
->
get_id
()
,
0
);
junction0
->
link_
same_
lanes_by_id
(
road3
->
get_id
(),
road0
->
get_id
());
junction0
->
link_roads_by_id
(
road3
->
get_id
(),
road4
->
get_id
());
junction0
->
link_roads_by_id
(
road3
->
get_id
(),
road4
->
get_id
());
junction0
->
link_lanes_by_id
(
road3
->
get_id
(),
0
,
road4
->
get_id
()
,
0
);
junction0
->
link_
same_
lanes_by_id
(
road3
->
get_id
(),
road4
->
get_id
());
junction0
->
link_roads_by_id
(
road5
->
get_id
(),
road0
->
get_id
());
junction0
->
link_roads_by_id
(
road5
->
get_id
(),
road0
->
get_id
());
junction0
->
link_lanes_by_id
(
road5
->
get_id
(),
0
,
road0
->
get_id
()
,
0
);
junction0
->
link_
same_
lanes_by_id
(
road5
->
get_id
(),
road0
->
get_id
());
junction0
->
link_roads_by_id
(
road5
->
get_id
(),
road2
->
get_id
());
junction0
->
link_roads_by_id
(
road5
->
get_id
(),
road2
->
get_id
());
junction0
->
link_lanes_by_id
(
road5
->
get_id
(),
0
,
road2
->
get_id
()
,
0
);
junction0
->
link_
same_
lanes_by_id
(
road5
->
get_id
(),
road2
->
get_id
());
junction1
->
add_incomming_road
(
road0
);
junction1
->
add_incomming_road
(
road0
);
junction1
->
add_incomming_road
(
road2
);
junction1
->
add_incomming_road
(
road2
);
...
@@ -99,18 +103,20 @@ int main(int argc, char *argv[])
...
@@ -99,18 +103,20 @@ int main(int argc, char *argv[])
junction1
->
add_outgoing_road
(
road3
);
junction1
->
add_outgoing_road
(
road3
);
junction1
->
add_outgoing_road
(
road5
);
junction1
->
add_outgoing_road
(
road5
);
junction1
->
link_roads_by_id
(
road0
->
get_id
(),
road3
->
get_id
());
junction1
->
link_roads_by_id
(
road0
->
get_id
(),
road3
->
get_id
());
junction1
->
link_lanes_by_id
(
road0
->
get_id
(),
0
,
road3
->
get_id
()
,
0
);
junction1
->
link_
same_
lanes_by_id
(
road0
->
get_id
(),
road3
->
get_id
());
junction1
->
link_roads_by_id
(
road0
->
get_id
(),
road5
->
get_id
());
junction1
->
link_roads_by_id
(
road0
->
get_id
(),
road5
->
get_id
());
junction1
->
link_lanes_by_id
(
road0
->
get_id
(),
0
,
road5
->
get_id
()
,
0
);
junction1
->
link_
same_
lanes_by_id
(
road0
->
get_id
(),
road5
->
get_id
());
junction1
->
link_roads_by_id
(
road2
->
get_id
(),
road1
->
get_id
());
junction1
->
link_roads_by_id
(
road2
->
get_id
(),
road1
->
get_id
());
junction1
->
link_lanes_by_id
(
road2
->
get_id
(),
0
,
road1
->
get_id
()
,
0
);
junction1
->
link_
same_
lanes_by_id
(
road2
->
get_id
(),
road1
->
get_id
());
junction1
->
link_roads_by_id
(
road2
->
get_id
(),
road5
->
get_id
());
junction1
->
link_roads_by_id
(
road2
->
get_id
(),
road5
->
get_id
());
junction1
->
link_lanes_by_id
(
road2
->
get_id
(),
0
,
road5
->
get_id
()
,
0
);
junction1
->
link_
same_
lanes_by_id
(
road2
->
get_id
(),
road5
->
get_id
());
junction1
->
link_roads_by_id
(
road4
->
get_id
(),
road3
->
get_id
());
junction1
->
link_roads_by_id
(
road4
->
get_id
(),
road3
->
get_id
());
junction1
->
link_lanes_by_id
(
road4
->
get_id
(),
0
,
road3
->
get_id
()
,
0
);
junction1
->
link_
same_
lanes_by_id
(
road4
->
get_id
(),
road3
->
get_id
());
junction1
->
link_roads_by_id
(
road4
->
get_id
(),
road1
->
get_id
());
junction1
->
link_roads_by_id
(
road4
->
get_id
(),
road1
->
get_id
());
junction1
->
link_lanes_by_id
(
road4
->
get_id
(),
0
,
road1
->
get_id
()
,
0
);
junction1
->
link_
same_
lanes_by_id
(
road4
->
get_id
(),
road1
->
get_id
());
map
.
save_opendrive
(
"test_road.xodr"
);
map
.
get_lane_geometry
(
x
,
y
,
heading
);
map
.
get_lane_geometry
(
x
,
y
,
heading
);
for
(
unsigned
int
i
=
0
;
i
<
x
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
x
.
size
();
i
++
)
std
::
cout
<<
x
[
i
]
<<
","
<<
y
[
i
]
<<
","
<<
heading
[
i
]
<<
std
::
endl
;
std
::
cout
<<
x
[
i
]
<<
","
<<
y
[
i
]
<<
","
<<
heading
[
i
]
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
src/examples/opendrive_import_test.cpp
+
6
−
4
View file @
78444e7e
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
#include
<iostream>
#include
<iostream>
const
std
::
string
opendrive_file
=
"/home/sergi/iri-lab/add_robot/add_ws/code/autonomous_driving_tools/src/xml/adc_road.xodr"
;
//const std::string opendrive_file="/home/sergi/iri-lab/add_robot/add_ws/code/autonomous_driving_tools/src/xml/adc_road.xodr";
const
std
::
string
opendrive_file
=
"/home/sergi/iri-lab/add_robot/add_ws/code/autonomous_driving_tools/build/test_road.xodr"
;
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
@@ -15,16 +16,17 @@ int main(int argc, char *argv[])
...
@@ -15,16 +16,17 @@ int main(int argc, char *argv[])
map
.
load_opendrive
(
opendrive_file
);
map
.
load_opendrive
(
opendrive_file
);
map
.
get_lane_geometry
(
x
,
y
,
heading
);
map
.
get_lane_geometry
(
x
,
y
,
heading
);
for
(
unsigned
int
i
=
0
;
i
<
x
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
x
.
size
();
i
++
)
std
::
cout
<<
x
[
i
]
<<
","
<<
y
[
i
]
<<
","
<<
heading
[
i
]
<<
std
::
endl
;
std
::
cout
<<
x
[
i
]
<<
","
<<
y
[
i
]
<<
","
<<
heading
[
i
]
<<
std
::
endl
;
return
0
;
return
0
;
old_path
.
push_back
(
3
);
//
old_path.push_back(3);
old_path
.
push_back
(
4
);
//
old_path.push_back(4);
old_path
.
push_back
(
22
);
old_path
.
push_back
(
22
);
old_path
.
push_back
(
10
);
//
old_path.push_back(10);
new_path
=
map
.
get_path_sub_roadmap
(
old_path
,
new_map
);
new_path
=
map
.
get_path_sub_roadmap
(
old_path
,
new_map
);
new_map
.
get_segment_connectivity
(
connectivity
,
id_map
);
new_map
.
get_segment_connectivity
(
connectivity
,
id_map
);
...
...
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