Description
The non-regression is evidenced here.
Abstract
This is the first PR of 6 related to the HdMapUtils
refactor - a class that allows you to get access to lanelet data - from an *.osm
file.
The refactor is implemented in accordance with the proposal presented in the report WP11_Q2_2023
: shared here.
As a result of merging all 6 PRs, HdMapUtils
will no longer exist in the source code - it will be replaced by the LaneletWrapper
and its namespace lanelet_wrapper
- see a diagram below.
Background
The lanelet_wrapper
namespace contains:
LaneletLoader
LaneletWrapper
RouteCache
,CenterPointsCache
,LaneletLengthCache
TrafficRulesWithRoutingGraph
- 6 category-specific sub-namespaces
Main class LaneletWrapper
is developed in the singleton pattern, and contains the activate(<path_to_lanelet_file>)
method. LaneletWrapper
uses static methods from the LaneletLoader
class to load data from a *.osm
file. This namespace also contains RouteCache
, CenterPointsCache
and LaneletLengthCache
classes which are analogous to those in HdMapUtils
. LaneletWrapper
allows access to map data, graphs, rules and caches via static methods:
These static methods are used by the sub-namespaces of lanelet_wrapper
.
lanelet_wrapper
namespace consist of 6 sub-namespaces:
lanelet_wrapper::lanelet_map
,lanelet_wrapper::pose
,lanelet_wrapper::distance
,lanelet_wrapper::route
,lanelet_wrapper::lane_change
,lanelet_wrapper::traffic_lights
.
As a result of the merge of this PR 1/6, the necessary source code for LaneletWrapper
as a singleton and its activation in the required places is added to the project. As well as the first and second namespaces: lanelet_wrapper::lanelet_map
, lanelet_wrapper::pose
are added, But most importantly, the ::pose
from utils
is adapted for its use.
In addition to this, PR is making several other improvements to the code, see below for details.
Details
LaneletWrapper
is added and the lanelet_map
namespace in utils
is developed.
Now, in order to access the lanelet data, there is no need to create HdMapUtils
, just call lanelet_map::activate()
in a single instance of the program - passing the path to the *.osm
map.
Currently, LaneletWrapper
is activated in:
- Configuration constructor - i.e. in
openscenario_intepreter
andcpp_scenario_node
, simple_sensor_simulator
,- classes used in the unittests, such as
TrafficLightsTest
.
Note: By moving from HdMapUtils
, we mean moving the entire method to lanelet_wrapper
(as a free function), which traffic_simulator
has access to via free functions from utils
. Sample of the relationship between utils
and lanelet_wrapper
after changes: <HdMapUtils method name>
to <utils namespace and function name>
-> <lanelet_wrapper namespace and function name>
.
Moved from HdMapUtils
to lanelet_wrapper
namespaces - used by lanelet_map and pose
from utils
:
-
getLaneletLength
tolanelet_map::laneletLength -> lanelet_wrapper::lanelet_map::laneletLength
-
getLaneletAltitude
tolanelet_map::laneletAltitude -> lanelet_wrapper::lanelet_map::laneletAltitude
-
getCenterPoints
tolanelet_wrapper::lanelet_map::centerPoints
- this has been copied, the original will be deleted soon -
canonicalizeLaneletPose
topose::canonicalize() -> lanelet_wrapper::pose::canonicalizeLaneletPose
-
getAllCanonicalizedLaneletPoses
topose::alternativeLaneletPoses -> lanelet_wrapper::pose::alternativeLaneletPoses
-
getAlongLaneletPose
topose::alongLaneletPose -> lanelet_wrapper::pose::alongLaneletPose
-
getLeftLaneletIds
topose::leftLaneletIds -> lanelet_wrapper::pose::leftLaneletIds
-
getRightLaneletIds
topose::rightLaneletIds -> lanelet_wrapper::pose::rightLaneletIds
-
getNextLaneletIds
topose::nextLaneletIds -> lanelet_wrapper::pose::nextLaneletIds
-
getPreviousLaneletIds
topose::previousLaneletIds -> lanelet_wrapper::pose::previousLaneletIds
-
toMapPose
topose::toMapPose -> lanelet_wrapper::pose::toMapPose
-
matchToLane
topose::matchToLane -> lanelet_wrapper::pose::matchToLane
-
toLaneletPose
topose::toLaneletPose -> lanelet_wrapper::pose::toLaneletPose
-
toLaneletPoses
topose::toLaneletPoses -> lanelet_wrapper::pose::toLaneletPoses
-
isAltitudeMatching
topose::isAltitudeMatching -> lanelet_wrapper::pose::isAltitudeMatching
Thanks to this, the passing of HdMapUtils
ptr has been removed from functions:
CanonicalizedEntityStatus::set
pose::canonicalize
pose::toCanonicalizedLaneletPose
pose::toMapPose
pose::pedestrian::transformToCanonicalizedLaneletPose
CanonicalizedLaneletPose
contructorhelper::constructCanonicalizedLaneletPose
helper::constructLaneletPose
In addition:
- Adapted:
test_hdmap_utils
- to use functions fromlanelet_wrapper
- in the next PRs this file will be broken down so that tests for each sub-namespace oflanelet_wrapper
will be separated file.helper_functions
and other files from thetest/*
folder tolanelet_wrapper
.- Returned type and the definition of
pose::canonicalize()
- now it returnsLaneletPose
and throws an exception - which is in harmony with the name and expectations. WheneverCanonicalizedLaneletPose
is needed, thepose::toCanonicalizedLaneletPose()
function is used. In addition, there is no longer aCanonicalizedLaneletPose::canonicalize()
method - commonpose::canonicalize
is used there. Configuration
constructor and its use incpp_scenario_node
andopenscenario_interpreter
.
- Fixed
- Distance along lanelet calculation in
follow_trajectory_action
- previously the orientation was not taken into account leading to failures in some scenarios,
- Distance along lanelet calculation in
- Simplified:
ActionNode::getDistanceToTargetEntityPolygon
- by developing a more coherent version ofpose::isAltitudeMatching
ActionNode::calculateUpdatedEntityStatus
- thanks to the separation of the functionlanelet_wrapper::pose::alongLaneletPose
(in subsequent PRs an intermediate route:: sub-namespace will be created, then it will be route::moveAlongLaneletPose)TrafficController::appendAutoSinks
- by separating the functionlanelet_map::boarderlinePoses
- Added:
math::geometry::convertDirectionToQuaternion
- i.e. an assistant function to convert a direction vector into an orientation in a quaternionCanonicalizedLaneletPose::getAltitude()
CanonicalizedLaneletPose::getLaneletId()
CanonicalziedLaneletPose::alignOrientationtoLanelet()
pose::isInLanelet -> lanelet_wrapper::pose::isInLanelet
- with argument type ofgeometry_msgs::msg::Point
References
Destructive Changes
None
Known Limitations
None