scenario_simulator_v2 C++ API
pose.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef TRAFFIC_SIMULATOR__LANELET_WRAPPER_POSE_HPP_
16 #define TRAFFIC_SIMULATOR__LANELET_WRAPPER_POSE_HPP_
17 
18 #include <lanelet2_matching/LaneletMatching.h>
19 
21 
22 namespace traffic_simulator
23 {
24 namespace lanelet_wrapper
25 {
26 namespace pose
27 {
30 constexpr static double DEFAULT_MATCH_TO_LANE_REDUCTION_RATIO = 0.8;
31 
32 auto toMapPose(const LaneletPose & lanelet_pose, const bool fill_pitch = true) -> PoseStamped;
33 
34 auto isAltitudeMatching(const double current_altitude, const double target_altitude) -> bool;
35 
36 auto toLaneletPose(
37  const Pose & map_pose, const lanelet::Id lanelet_id, const double matching_distance = 1.0)
38  -> std::optional<LaneletPose>;
39 
40 auto toLaneletPose(
41  const Pose & map_pose, const lanelet::Ids & lanelet_ids, const double matching_distance = 1.0)
42  -> std::optional<LaneletPose>;
43 
44 auto toLaneletPose(
45  const Pose & map_pose, const bool include_crosswalk, const double matching_distance = 1.0)
46  -> std::optional<LaneletPose>;
47 
48 auto toLaneletPose(
49  const Pose & map_pose, const BoundingBox & bounding_box, const bool include_crosswalk,
50  const double matching_distance = 1.0,
51  const RoutingGraphType type = RoutingConfiguration().routing_graph_type)
52  -> std::optional<LaneletPose>;
53 
54 auto toLaneletPoses(
55  const Pose & map_pose, const lanelet::Id lanelet_id, const double matching_distance = 5.0,
56  const bool include_opposite_direction = true,
57  const RoutingGraphType type = RoutingConfiguration().routing_graph_type)
58  -> std::vector<LaneletPose>;
59 
78 auto alternativeLaneletPoses(const LaneletPose & reference_lanelet_pose)
79  -> std::vector<LaneletPose>;
80 
81 auto alongLaneletPose(
82  const LaneletPose & from_pose, const lanelet::Ids & route_lanelets, const double distance)
83  -> LaneletPose;
84 
85 auto alongLaneletPose(
86  const LaneletPose & from_pose, const double distance,
87  const RoutingGraphType type = RoutingConfiguration().routing_graph_type) -> LaneletPose;
88 
89 auto canonicalizeLaneletPose(const LaneletPose & lanelet_pose)
90  -> std::tuple<std::optional<LaneletPose>, std::optional<lanelet::Id>>;
91 
92 auto canonicalizeLaneletPose(const LaneletPose & lanelet_pose, const lanelet::Ids & route_lanelets)
93  -> std::tuple<std::optional<LaneletPose>, std::optional<lanelet::Id>>;
94 
97  const bool include_crosswalk, const double matching_distance = 1.0,
98  const double reduction_ratio = DEFAULT_MATCH_TO_LANE_REDUCTION_RATIO,
100  traffic_simulator::RoutingConfiguration().routing_graph_type)
101  -> std::optional<std::set<std::pair<double, lanelet::Id>>>;
102 
103 auto matchToLane(
104  const Pose & map_pose, const BoundingBox & bounding_box, const bool include_crosswalk,
105  const double matching_distance = 1.0,
106  const double reduction_ratio = DEFAULT_MATCH_TO_LANE_REDUCTION_RATIO,
107  const RoutingGraphType type = RoutingConfiguration().routing_graph_type)
108  -> std::optional<lanelet::Id>;
109 
110 auto leftLaneletIds(
111  const lanelet::Id lanelet_id, const RoutingGraphType type, const bool include_opposite_direction)
112  -> lanelet::Ids;
113 
114 auto rightLaneletIds(
115  const lanelet::Id lanelet_id, const RoutingGraphType type, const bool include_opposite_direction)
116  -> lanelet::Ids;
117 } // namespace pose
118 } // namespace lanelet_wrapper
119 } // namespace traffic_simulator
120 #endif // TRAFFIC_SIMULATOR__LANELET_WRAPPER_POSE_HPP_
auto distance(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
Definition: detection_sensor.cpp:36
auto canonicalizeLaneletPose(const LaneletPose &lanelet_pose) -> std::tuple< std::optional< LaneletPose >, std::optional< lanelet::Id >>
Canonicalizes a given LaneletPose by adjusting the longitudinal position (s) to ensure it lies within...
Definition: pose.cpp:351
auto toLaneletPose(const Pose &map_pose, const lanelet::Id lanelet_id, const double matching_distance=1.0) -> std::optional< LaneletPose >
Definition: pose.cpp:89
auto alongLaneletPose(const LaneletPose &from_pose, const lanelet::Ids &route_lanelets, const double distance) -> LaneletPose
Definition: pose.cpp:310
auto matchToLane(const Pose &map_pose, const BoundingBox &bounding_box, const bool include_crosswalk, const double matching_distance=1.0, const double reduction_ratio=DEFAULT_MATCH_TO_LANE_REDUCTION_RATIO, const RoutingGraphType type=RoutingConfiguration().routing_graph_type) -> std::optional< lanelet::Id >
Definition: pose.cpp:461
auto toLaneletPoses(const Pose &map_pose, const lanelet::Id lanelet_id, const double matching_distance=5.0, const bool include_opposite_direction=true, const RoutingGraphType type=RoutingConfiguration().routing_graph_type) -> std::vector< LaneletPose >
Definition: pose.cpp:192
auto findMatchingLanes(const geometry_msgs::msg::Pose &, const traffic_simulator_msgs::msg::BoundingBox &, const bool include_crosswalk, const double matching_distance=1.0, const double reduction_ratio=DEFAULT_MATCH_TO_LANE_REDUCTION_RATIO, const traffic_simulator::RoutingGraphType type=traffic_simulator::RoutingConfiguration().routing_graph_type) -> std::optional< std::set< std::pair< double, lanelet::Id >>>
Definition: pose.cpp:410
auto alternativeLaneletPoses(const LaneletPose &reference_lanelet_pose) -> std::vector< LaneletPose >
Retrieves alternative lanelet poses based on the reference lanelet pose.
Definition: pose.cpp:213
auto rightLaneletIds(const lanelet::Id lanelet_id, const RoutingGraphType type, const bool include_opposite_direction) -> lanelet::Ids
Definition: pose.cpp:490
auto isAltitudeMatching(const double current_altitude, const double target_altitude) -> bool
Definition: pose.cpp:70
auto leftLaneletIds(const lanelet::Id lanelet_id, const RoutingGraphType type, const bool include_opposite_direction) -> lanelet::Ids
Definition: pose.cpp:476
auto toMapPose(const LaneletPose &lanelet_pose, const bool fill_pitch=true) -> PoseStamped
Definition: pose.cpp:33
geometry_msgs::msg::Pose Pose
Definition: lanelet_wrapper.hpp:65
traffic_simulator_msgs::msg::BoundingBox BoundingBox
Definition: lanelet_wrapper.hpp:61
traffic_simulator_msgs::msg::LaneletPose LaneletPose
Definition: lanelet_wrapper.hpp:63
geometry_msgs::msg::PoseStamped PoseStamped
Definition: lanelet_wrapper.hpp:66
RoutingGraphType
Definition: routing_graph_type.hpp:24
Definition: api.hpp:48
Definition: routing_configuration.hpp:24