Nav2 Navigation Stack - lyrical  lyrical
ROS 2 Navigation Stack
smoother_error_plugin.hpp
1 // Copyright (c) 2022 Joshua Wallace
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 ERROR_CODES__SMOOTHER__SMOOTHER_ERROR_PLUGIN_HPP_
16 #define ERROR_CODES__SMOOTHER__SMOOTHER_ERROR_PLUGIN_HPP_
17 
18 #include <string>
19 #include <memory>
20 
21 #include "nav2_core/smoother.hpp"
22 #include "nav2_core/smoother_exceptions.hpp"
23 #include "nav2_ros_common/tf2_factories.hpp"
24 
25 namespace nav2_system_tests
26 {
27 
29 {
30 public:
31  void configure(
32  const nav2::LifecycleNode::WeakPtr &,
33  std::string, nav2::TransformBuffer::SharedPtr,
34  std::shared_ptr<nav2_costmap_2d::CostmapSubscriber>,
35  std::shared_ptr<nav2_costmap_2d::FootprintSubscriber>) override {}
36 
37  void cleanup() override {}
38 
39  void activate() override {}
40 
41  void deactivate() override {}
42 
43  bool smooth(
44  nav_msgs::msg::Path &,
45  const rclcpp::Duration &) override
46  {
47  throw nav2_core::SmootherException("Unknown Smoother exception");
48  }
49 };
50 
52 {
53  bool smooth(
54  nav_msgs::msg::Path &,
55  const rclcpp::Duration &)
56  {
57  throw nav2_core::SmootherTimedOut("Smoother timedOut");
58  }
59 };
60 
62 {
63  bool smooth(
64  nav_msgs::msg::Path &,
65  const rclcpp::Duration &)
66  {
67  throw nav2_core::SmoothedPathInCollision("Smoother path in collision");
68  }
69 };
70 
72 {
73  bool smooth(
74  nav_msgs::msg::Path &,
75  const rclcpp::Duration &)
76  {
77  throw nav2_core::FailedToSmoothPath("Failed to smooth path");
78  }
79 };
80 
82 {
83  bool smooth(
84  nav_msgs::msg::Path &,
85  const rclcpp::Duration &)
86  {
87  throw nav2_core::InvalidPath("Invalid path");
88  }
89 };
90 
91 } // namespace nav2_system_tests
92 
93 #endif // ERROR_CODES__SMOOTHER__SMOOTHER_ERROR_PLUGIN_HPP_
smoother interface that acts as a virtual base class for all smoother plugins
Definition: smoother.hpp:37
void cleanup() override
Method to cleanup resources.
void deactivate() override
Method to deactivate smoother and any threads involved in execution.
bool smooth(nav_msgs::msg::Path &, const rclcpp::Duration &) override
Method to smooth given path.
void activate() override
Method to activate smoother and any threads involved in execution.