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
c628306a
Commit
c628306a
authored
4 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Implemented the function to generate the spline.
Added functions to get the spline trajectory (with and without heading).
parent
982ea9f1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendrive_link.h
+3
-1
3 additions, 1 deletion
include/opendrive_link.h
src/opendrive_link.cpp
+54
-4
54 additions, 4 deletions
src/opendrive_link.cpp
with
57 additions
and
5 deletions
include/opendrive_link.h
+
3
−
1
View file @
c628306a
...
...
@@ -27,7 +27,7 @@ class COpendriveLink
void
set_road_mark
(
opendrive_mark_t
mark
);
void
set_resolution
(
double
res
);
void
set_scale_factor
(
double
scale
);
void
generate
(
void
);
void
generate
(
double
start_curvature
,
double
end_curvature
,
double
length
,
bool
lane
);
void
update_references
(
std
::
map
<
COpendriveRoadNode
*
,
COpendriveRoadNode
*>
refs
);
public:
const
COpendriveRoadNode
&
get_prev
(
void
)
const
;
...
...
@@ -39,6 +39,8 @@ class COpendriveLink
double
find_closest_local_point
(
TOpendriveLocalPoint
&
local
,
TPoint
&
point
);
double
get_track_point_world
(
TOpendriveTrackPoint
&
track
,
TOpendriveWorldPoint
&
world
);
double
get_track_point_local
(
TOpendriveTrackPoint
&
track
,
TOpendriveLocalPoint
&
local
);
void
get_trajectory
(
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
double
start_length
=
0.0
,
double
end_length
=-
1.0
)
const
;
void
get_trajectory
(
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
std
::
vector
<
double
>
&
yaw
,
double
start_length
=
0.0
,
double
end_length
=-
1.0
)
const
;
double
get_length
(
void
)
const
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
COpendriveLink
&
link
);
~
COpendriveLink
();
...
...
This diff is collapsed.
Click to expand it.
src/opendrive_link.cpp
+
54
−
4
View file @
c628306a
...
...
@@ -46,9 +46,24 @@ void COpendriveLink::set_scale_factor(double scale)
this
->
scale_factor
=
scale
;
}
void
COpendriveLink
::
generate
(
void
)
{
void
COpendriveLink
::
generate
(
double
start_curvature
,
double
end_curvature
,
double
length
,
bool
lane
)
{
TOpendriveWorldPoint
node_start
,
node_end
;
TPoint
start
,
end
;
node_start
=
this
->
prev
->
get_start_pose
();
start
.
x
=
node_start
.
x
;
start
.
y
=
node_start
.
y
;
start
.
heading
=
node_start
.
heading
;
start
.
curvature
=
start_curvature
;
node_end
=
this
->
next
->
get_start_pose
();
end
.
x
=
node_end
.
x
;
end
.
y
=
node_end
.
y
;
end
.
heading
=
node_end
.
heading
;
end
.
curvature
=
end_curvature
;
// std::cout << start.x << "," << start.y << "," << start.heading << "," << start_curvature << "," << end.x << "," << end.y << "," << end.heading << "," << end_curvature << std::endl;
this
->
spline
=
new
CG2Spline
(
start
,
end
);
this
->
spline
->
generate
(
this
->
resolution
,
length
);
}
void
COpendriveLink
::
update_references
(
std
::
map
<
COpendriveRoadNode
*
,
COpendriveRoadNode
*>
refs
)
...
...
@@ -102,9 +117,44 @@ double COpendriveLink::get_track_point_local(TOpendriveTrackPoint &track,TOpendr
}
double
COpendriveLink
::
get_length
(
void
)
const
void
COpendriveLink
::
get_trajectory
(
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
double
start_length
,
double
end_length
)
const
{
std
::
vector
<
double
>
curvature
,
heading
;
CG2Spline
*
partial_spline
=
NULL
;
if
(
start_length
!=
0.0
||
end_length
!=-
1.0
)
// get partial spline
{
partial_spline
=
new
CG2Spline
;
this
->
spline
->
get_part
(
partial_spline
,
start_length
,
end_length
);
partial_spline
->
evaluate_all
(
x
,
y
,
curvature
,
heading
);
delete
partial_spline
;
}
else
this
->
spline
->
evaluate_all
(
x
,
y
,
curvature
,
heading
);
}
void
COpendriveLink
::
get_trajectory
(
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
std
::
vector
<
double
>
&
yaw
,
double
start_length
,
double
end_length
)
const
{
std
::
vector
<
double
>
curvature
;
CG2Spline
*
partial_spline
=
NULL
;
if
(
start_length
!=
0.0
||
end_length
!=-
1.0
)
// get partial spline
{
partial_spline
=
new
CG2Spline
;
this
->
spline
->
get_part
(
partial_spline
,
start_length
,
end_length
);
partial_spline
->
evaluate_all
(
x
,
y
,
curvature
,
yaw
);
delete
partial_spline
;
}
else
this
->
spline
->
evaluate_all
(
x
,
y
,
curvature
,
yaw
);
}
double
COpendriveLink
::
get_length
(
void
)
const
{
if
(
this
->
spline
!=
NULL
)
return
this
->
spline
->
get_length
();
else
return
0.0
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
COpendriveLink
&
link
)
...
...
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