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(const std::shared_ptr<hdmap_utils::HdMapUtils> &);
30 
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  std::shared_ptr<hdmap_utils::HdMapUtils> hdmap_utils_ptr_;
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 };
55 } // namespace traffic_simulator
56 
57 #endif // BEHAVIOR_TREE_PLUGIN__ROUTE_PLANNER_HPP_
Definition: route_planner.hpp:27
RoutePlanner(const std::shared_ptr< hdmap_utils::HdMapUtils > &)
Definition: route_planner.cpp:19
auto getGoalPoses() const -> std::vector< CanonicalizedLaneletPose >
Definition: route_planner.cpp:86
auto getGoalPosesInWorldFrame() const -> std::vector< geometry_msgs::msg::Pose >
Definition: route_planner.cpp:77
auto getRouteLanelets(const CanonicalizedLaneletPose &entity_lanelet_pose, double horizon=100) -> lanelet::Ids
Definition: route_planner.cpp:33
auto cancelRoute() -> void
Definition: route_planner.cpp:55
auto setWaypoints(const std::vector< CanonicalizedLaneletPose > &waypoints) -> void
Definition: route_planner.cpp:24
Definition: lanelet_pose.hpp:27
Definition: api.hpp:48