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
00cf70ad
Commit
00cf70ad
authored
4 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Updated the example.
parent
d37ad5b8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/examples/opendrive_test.cpp
+91
-32
91 additions, 32 deletions
src/examples/opendrive_test.cpp
with
91 additions
and
32 deletions
src/examples/opendrive_test.cpp
+
91
−
32
View file @
00cf70ad
...
@@ -6,13 +6,13 @@
...
@@ -6,13 +6,13 @@
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
// TOpendriveWorldPo
int
closest_po
int
;
// TOpendriveWorldPo
se
closest_po
se
;
//
std::vector<double> x,y;
std
::
vector
<
double
>
x
,
y
;
COpendriveRoad
road
,
new_road
;
COpendriveRoad
road
,
new_road
;
std
::
vector
<
unsigned
int
>
path
;
std
::
vector
<
unsigned
int
>
path
;
TOpendriveWorldPo
int
end_po
int
,
start_po
int
;
TOpendriveWorldPo
se
end_po
se
,
start_po
se
;
//
std::string xml_file="/home/sergi/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/add_road_full.xodr";
std
::
string
xml_file
=
"/home/sergi/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/add_road_full.xodr"
;
std
::
string
xml_file
=
"/home/sergi/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/adc_road.xodr"
;
//
std::string xml_file="/home/sergi/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/adc_road.xodr";
try
try
{
{
...
@@ -21,7 +21,6 @@ int main(int argc, char *argv[])
...
@@ -21,7 +21,6 @@ int main(int argc, char *argv[])
road
.
set_min_road_length
(
0.01
);
road
.
set_min_road_length
(
0.01
);
road
.
load
(
xml_file
);
road
.
load
(
xml_file
);
// std::cout << road << std::endl;
// std::cout << road << std::endl;
/*
for
(
unsigned
int
i
=
0
;
i
<
road
.
get_num_nodes
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
road
.
get_num_nodes
();
i
++
)
{
{
const
COpendriveRoadNode
&
node
=
road
.
get_node
(
i
);
const
COpendriveRoadNode
&
node
=
road
.
get_node
(
i
);
...
@@ -33,6 +32,47 @@ int main(int argc, char *argv[])
...
@@ -33,6 +32,47 @@ int main(int argc, char *argv[])
std
::
cout
<<
x
[
k
]
<<
","
<<
y
[
k
]
<<
std
::
endl
;
std
::
cout
<<
x
[
k
]
<<
","
<<
y
[
k
]
<<
std
::
endl
;
}
}
}
}
/*
path.push_back(4);
start_pose.x=10.0;
start_pose.y=0.0;
start_pose.heading=0.0;
end_pose.x=17.0;
end_pose.y=0.0;
end_pose.heading=0.0;
road.get_sub_road(path,start_pose,end_pose,new_road);
std::cout << "road1" << std::endl;
std::cout << new_road << std::endl;
*/
/*
path.clear();
path.push_back(4);
path.push_back(6);
path.push_back(8);
path.push_back(150);
path.push_back(67);
path.push_back(69);
path.push_back(71);
start_pose.x=10.0;
start_pose.y=0.0;
start_pose.heading=0.0;
end_pose.x=18.5;
end_pose.y=22.0;
end_pose.heading=0.0;
road.get_sub_road(path,start_pose,end_pose,new_road);
// std::cout << "road2" << std::endl;
// std::cout << new_road << std::endl;
for(unsigned int i=0;i<new_road.get_num_nodes();i++)
{
const COpendriveRoadNode &node=new_road.get_node(i);
for(unsigned int j=0;j<node.get_num_links();j++)
{
const COpendriveLink &link=node.get_link(j);
link.get_trajectory(x,y);
for(unsigned int k=0;k<x.size();k++)
std::cout << x[k] << "," << y[k] << std::endl;
}
}
*/
*/
/*
/*
if(argc!=4)
if(argc!=4)
...
@@ -41,33 +81,36 @@ int main(int argc, char *argv[])
...
@@ -41,33 +81,36 @@ int main(int argc, char *argv[])
std::cout << argv[0] << " x y heading" << std::endl;
std::cout << argv[0] << " x y heading" << std::endl;
return -1;
return -1;
}
}
end_po
int
.x=std::stod(argv[1]);
end_po
se
.x=std::stod(argv[1]);
end_po
int
.y=std::stod(argv[2]);
end_po
se
.y=std::stod(argv[2]);
end_po
int
.heading=std::stod(argv[3]);
end_po
se
.heading=std::stod(argv[3]);
length=road.get_closest_po
int
(end_po
int
,closest_po
int
);
length=road.get_closest_po
se
(end_po
se
,closest_po
se
);
std::cout << "closest po
int
to: " << x << "," << y << "," << heading << " -> " << closest_po
int
.x << "," << closest_po
int
.y << "," << closest_po
int
.heading << " at " << length << " m" << std::endl;
std::cout << "closest po
se
to: " << x << "," << y << "," << heading << " -> " << closest_po
se
.x << "," << closest_po
se
.y << "," << closest_po
se
.heading << " at " << length << " m" << std::endl;
*/
*/
/*
path.push_back(0);
path.push_back(0);
start_po
int
.
x
=
1.0
;
start_po
se
.x=1.0;
start_po
int
.
y
=
0.0
;
start_po
se
.y=0.0;
start_po
int
.
heading
=
0.0
;
start_po
se
.heading=0.0;
end_po
int
.
x
=
2.0
;
end_po
se
.x=2.0;
end_po
int
.
y
=
0.0
;
end_po
se
.y=0.0;
end_po
int
.
heading
=
0.0
;
end_po
se
.heading=0.0;
road
.
get_sub_road
(
path
,
start_po
int
,
end_po
int
,
new_road
);
road.get_sub_road(path,start_po
se
,end_po
se
,new_road);
std::cout << "road1" << std::endl;
std::cout << "road1" << std::endl;
std::cout << new_road << std::endl;
std::cout << new_road << std::endl;
*/
/*
path.clear();
path.clear();
path.push_back(0);
path.push_back(0);
path.push_back(22);
path.push_back(22);
path.push_back(2);
path.push_back(2);
start_po
int
.
x
=
1.0
;
start_po
se
.x=1.0;
start_po
int
.
y
=
0.0
;
start_po
se
.y=0.0;
start_po
int
.
heading
=
0.0
;
start_po
se
.heading=0.0;
end_po
int
.
x
=
5.0
;
end_po
se
.x=5.0;
end_po
int
.
y
=
0.0
;
end_po
se
.y=0.0;
end_po
int
.
heading
=
0.0
;
end_po
se
.heading=0.0;
road
.
get_sub_road
(
path
,
start_po
int
,
end_po
int
,
new_road
);
road.get_sub_road(path,start_po
se
,end_po
se
,new_road);
std::cout << "road2" << std::endl;
std::cout << "road2" << std::endl;
std::cout << new_road << std::endl;
std::cout << new_road << std::endl;
path.clear();
path.clear();
...
@@ -80,15 +123,31 @@ int main(int argc, char *argv[])
...
@@ -80,15 +123,31 @@ int main(int argc, char *argv[])
path.push_back(10);
path.push_back(10);
path.push_back(25);
path.push_back(25);
path.push_back(21);
path.push_back(21);
start_point
.
x
=
1.0
;
path.push_back(24);
start_point
.
y
=
0.0
;
path.push_back(1);
start_point
.
heading
=
0.0
;
start_pose.x=1.0;
end_point
.
x
=
3.0
;
start_pose.y=0.0;
end_point
.
y
=
1.5
;
start_pose.heading=0.0;
end_point
.
heading
=
0.0
;
end_pose.x=2.0;
road
.
get_sub_road
(
path
,
start_point
,
end_point
,
new_road
);
end_pose.y=0.0;
end_pose.heading=0.0;
road.get_sub_road(path,start_pose,end_pose,new_road);
std::cout << "road3" << std::endl;
std::cout << "road3" << std::endl;
std::cout << new_road << std::endl;
std::cout << new_road << std::endl;
*/
/*
for(unsigned int i=0;i<new_road.get_num_nodes();i++)
{
const COpendriveRoadNode &node=new_road.get_node(i);
for(unsigned int j=0;j<node.get_num_links();j++)
{
const COpendriveLink &link=node.get_link(j);
link.get_trajectory(x,y);
for(unsigned int k=0;k<x.size();k++)
std::cout << x[k] << "," << y[k] << std::endl;
}
}
*/
}
}
catch
(
CException
&
e
)
catch
(
CException
&
e
)
{
{
...
...
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