scenario_simulator_v2 C++ API
route_planner.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 BEHAVIOR_TREE_PLUGIN__ROUTE_PLANNER_HPP_
16 #define BEHAVIOR_TREE_PLUGIN__ROUTE_PLANNER_HPP_
17 
18 #include <deque>
19 #include <memory>
21 #include <vector>
22 
23 namespace traffic_simulator
24 {
26 {
27 public:
29 
30  auto getWholeRouteLanelets() const -> lanelet::Ids { return whole_lanelet_ids_; }
31  auto getRouteLanelets(const CanonicalizedLaneletPose & entity_lanelet_pose, double horizon = 100)
32  -> lanelet::Ids;
33 
34  auto setWaypoints(const std::vector<CanonicalizedLaneletPose> & waypoints) -> void;
35 
36  auto cancelRoute() -> void;
37  auto getGoalPoses() const -> std::vector<CanonicalizedLaneletPose>;
38  auto getGoalPosesInWorldFrame() const -> std::vector<geometry_msgs::msg::Pose>;
39 
40 private:
41  auto cancelWaypoint(const CanonicalizedLaneletPose & entity_lanelet_pose) -> void;
42 
43  auto updateRoute(const CanonicalizedLaneletPose & entity_lanelet_pose) -> void;
44 
45  std::optional<lanelet::Ids> route_;
46  const traffic_simulator::RoutingGraphType routing_graph_type_;
47 
48  /*
49  What we need is a queue, but we need to be able to iterate over the
50  elements for getGoalPoses, so we use std::deque instead of std::queue
51  which is not iterable.
52  */
53  std::deque<traffic_simulator::CanonicalizedLaneletPose> waypoint_queue_;
54  lanelet::Ids whole_lanelet_ids_;
55 };
56 } // namespace traffic_simulator
57 
58 #endif // BEHAVIOR_TREE_PLUGIN__ROUTE_PLANNER_HPP_
Definition: route_planner.hpp:26
auto getGoalPoses() const -> std::vector< CanonicalizedLaneletPose >
Definition: route_planner.cpp:97
auto getGoalPosesInWorldFrame() const -> std::vector< geometry_msgs::msg::Pose >
Definition: route_planner.cpp:88
auto getRouteLanelets(const CanonicalizedLaneletPose &entity_lanelet_pose, double horizon=100) -> lanelet::Ids
Definition: route_planner.cpp:40
auto cancelRoute() -> void
Definition: route_planner.cpp:66
auto setWaypoints(const std::vector< CanonicalizedLaneletPose > &waypoints) -> void
Definition: route_planner.cpp:25
RoutePlanner(const traffic_simulator::RoutingGraphType &)
Definition: route_planner.cpp:20
auto getWholeRouteLanelets() const -> lanelet::Ids
Definition: route_planner.hpp:30
Definition: lanelet_pose.hpp:35
Definition: lanelet_wrapper.hpp:43
geometry_msgs::msg::Pose Pose
Definition: lanelet_map.hpp:30
RoutingGraphType
Definition: routing_graph_type.hpp:24
Definition: api.hpp:33