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
b8b34e58
Commit
b8b34e58
authored
1 year ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added some helper functions.
parent
22639813
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
include/opendrive/opendrive_lane.h
+1
-0
1 addition, 0 deletions
include/opendrive/opendrive_lane.h
include/road_segment.h
+3
-1
3 additions, 1 deletion
include/road_segment.h
src/road_segment.cpp
+37
-1
37 additions, 1 deletion
src/road_segment.cpp
with
41 additions
and
2 deletions
include/opendrive/opendrive_lane.h
+
1
−
0
View file @
b8b34e58
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
class
COpendriveLane
class
COpendriveLane
{
{
friend
class
COpendriveRoadSegment
;
friend
class
COpendriveRoadSegment
;
friend
class
COpendriveJunction
;
private:
private:
opendrive_mark_t
right_mark
;
opendrive_mark_t
right_mark
;
double
speed
;
double
speed
;
...
...
This diff is collapsed.
Click to expand it.
include/road_segment.h
+
3
−
1
View file @
b8b34e58
...
@@ -41,7 +41,7 @@ class CRoadSegment
...
@@ -41,7 +41,7 @@ class CRoadSegment
CRoadSegment
(
unsigned
int
lanes_in
,
unsigned
int
lanes_out
);
CRoadSegment
(
unsigned
int
lanes_in
,
unsigned
int
lanes_out
);
unsigned
int
get_id
(
void
);
unsigned
int
get_id
(
void
);
void
set_resolution
(
double
resolution
);
void
set_resolution
(
double
resolution
);
double
get_resolution
(
double
resolution
);
double
get_resolution
(
void
);
bool
has_parent_road
(
void
);
bool
has_parent_road
(
void
);
CRoad
&
get_parent_road
(
void
);
CRoad
&
get_parent_road
(
void
);
bool
has_parent_junction
(
void
);
bool
has_parent_junction
(
void
);
...
@@ -53,6 +53,7 @@ class CRoadSegment
...
@@ -53,6 +53,7 @@ class CRoadSegment
unsigned
int
get_num_lanes_in
(
void
);
unsigned
int
get_num_lanes_in
(
void
);
unsigned
int
get_num_lanes_out
(
void
);
unsigned
int
get_num_lanes_out
(
void
);
double
get_lane_width
(
void
);
double
get_lane_width
(
void
);
double
get_lane_speed
(
void
);
unsigned
int
get_lane
(
double
lateral_offset
);
unsigned
int
get_lane
(
double
lateral_offset
);
void
set_geometry
(
TPoint
&
start_point
,
TPoint
&
end_point
);
void
set_geometry
(
TPoint
&
start_point
,
TPoint
&
end_point
);
void
get_start_point
(
TPoint
&
point
);
void
get_start_point
(
TPoint
&
point
);
...
@@ -61,6 +62,7 @@ class CRoadSegment
...
@@ -61,6 +62,7 @@ class CRoadSegment
void
link_lanes
(
unsigned
int
lane1
,
unsigned
int
lane2
);
void
link_lanes
(
unsigned
int
lane1
,
unsigned
int
lane2
);
void
unlink_lanes
(
unsigned
int
lane1
,
unsigned
int
lane2
);
void
unlink_lanes
(
unsigned
int
lane1
,
unsigned
int
lane2
);
bool
are_lanes_linked
(
unsigned
int
lane1
,
unsigned
int
lane2
);
bool
are_lanes_linked
(
unsigned
int
lane1
,
unsigned
int
lane2
);
void
get_connectivity_matrix
(
Eigen
::
MatrixXd
&
connectivity
);
double
get_length
(
void
);
double
get_length
(
void
);
bool
get_point_at
(
double
distance
,
double
lateral_offset
,
TPoint
&
point
);
bool
get_point_at
(
double
distance
,
double
lateral_offset
,
TPoint
&
point
);
bool
get_closest_point
(
TPoint
&
target_point
,
TPoint
&
closest_point
,
double
&
distance
,
double
&
lateral_offset
,
double
angle_tol
=
std
::
numeric_limits
<
double
>::
max
());
bool
get_closest_point
(
TPoint
&
target_point
,
TPoint
&
closest_point
,
double
&
distance
,
double
&
lateral_offset
,
double
angle_tol
=
std
::
numeric_limits
<
double
>::
max
());
...
...
This diff is collapsed.
Click to expand it.
src/road_segment.cpp
+
37
−
1
View file @
b8b34e58
...
@@ -140,7 +140,7 @@ void CRoadSegment::set_resolution(double resolution)
...
@@ -140,7 +140,7 @@ void CRoadSegment::set_resolution(double resolution)
this
->
spline
.
generate
(
this
->
resolution
,(
unsigned
int
)
10
);
this
->
spline
.
generate
(
this
->
resolution
,(
unsigned
int
)
10
);
}
}
double
CRoadSegment
::
get_resolution
(
double
resolution
)
double
CRoadSegment
::
get_resolution
(
void
)
{
{
return
this
->
resolution
;
return
this
->
resolution
;
}
}
...
@@ -239,6 +239,37 @@ double CRoadSegment::get_lane_width(void)
...
@@ -239,6 +239,37 @@ double CRoadSegment::get_lane_width(void)
return
width
;
return
width
;
}
}
double
CRoadSegment
::
get_lane_speed
(
void
)
{
double
speed
;
if
(
this
->
parent_road
!=
NULL
)
return
this
->
parent_road
->
get_lane_width
();
else
{
if
(
this
->
get_num_prev_segments
()
==
1
)
{
CRoadSegment
&
prev_segment
=
this
->
get_prev_segment_by_index
(
0
);
if
(
prev_segment
.
has_parent_road
())
speed
=
prev_segment
.
get_parent_road
().
get_lane_speed
();
else
speed
=
50.0
;
}
else
if
(
this
->
get_num_next_segments
()
==
1
)
{
CRoadSegment
&
next_segment
=
this
->
get_next_segment_by_index
(
0
);
if
(
next_segment
.
has_parent_road
())
speed
=
next_segment
.
get_parent_road
().
get_lane_speed
();
else
speed
=
50.0
;
}
else
speed
=
0.0
;
}
return
speed
;
}
unsigned
int
CRoadSegment
::
get_lane
(
double
lateral_offset
)
unsigned
int
CRoadSegment
::
get_lane
(
double
lateral_offset
)
{
{
unsigned
int
num_lanes
;
unsigned
int
num_lanes
;
...
@@ -314,6 +345,11 @@ bool CRoadSegment::are_lanes_linked(unsigned int lane1,unsigned int lane2)
...
@@ -314,6 +345,11 @@ bool CRoadSegment::are_lanes_linked(unsigned int lane1,unsigned int lane2)
return
false
;
return
false
;
}
}
void
CRoadSegment
::
get_connectivity_matrix
(
Eigen
::
MatrixXd
&
connectivity
)
{
connectivity
=
this
->
connectivity
;
}
double
CRoadSegment
::
get_length
(
void
)
double
CRoadSegment
::
get_length
(
void
)
{
{
return
this
->
spline
.
get_length
();
return
this
->
spline
.
get_length
();
...
...
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