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