Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
parameter_handler.hpp
1 // Copyright (c) 2022 Samsung Research America
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 NAV2_NAVFN_PLANNER__PARAMETER_HANDLER_HPP_
16 #define NAV2_NAVFN_PLANNER__PARAMETER_HANDLER_HPP_
17 
18 #include <string>
19 #include <vector>
20 #include <memory>
21 #include <algorithm>
22 #include <mutex>
23 
24 #include "rclcpp/rclcpp.hpp"
25 #include "nav2_ros_common/lifecycle_node.hpp"
26 #include "nav2_util/parameter_handler.hpp"
27 #include "nav2_ros_common/node_utils.hpp"
28 
29 namespace nav2_navfn_planner
30 {
31 
32 struct Parameters
33 {
34  // Whether or not the planner should be allowed to plan through unknown space
35  bool allow_unknown;
36  bool use_final_approach_orientation;
37  // If the goal is obstructed, the tolerance specifies how many meters the planner
38  // can relax the constraint in x and y before failing
39  double tolerance;
40  // Whether to use the astar planner or default dijkstras
41  bool use_astar;
42 };
43 
49 {
50 public:
55  const nav2::LifecycleNode::SharedPtr & node,
56  std::string & plugin_name,
57  rclcpp::Logger & logger);
58 
59 protected:
66  void
67  updateParametersCallback(const std::vector<rclcpp::Parameter> & parameters) override;
68 
77  rcl_interfaces::msg::SetParametersResult
78  validateParameterUpdatesCallback(const std::vector<rclcpp::Parameter> & parameters) override;
79 
80  std::string plugin_name_;
81 };
82 
83 } // namespace nav2_navfn_planner
84 
85 #endif // NAV2_NAVFN_PLANNER__PARAMETER_HANDLER_HPP_
Handles parameters and dynamic parameters for Navfn.
rcl_interfaces::msg::SetParametersResult validateParameterUpdatesCallback(const std::vector< rclcpp::Parameter > &parameters) override
Validate incoming parameter updates before applying them. This callback is triggered when one or more...
void updateParametersCallback(const std::vector< rclcpp::Parameter > &parameters) override
Apply parameter updates after validation This callback is executed when parameters have been successf...
ParameterHandler(const nav2::LifecycleNode::SharedPtr &node, std::string &plugin_name, rclcpp::Logger &logger)
Constructor for nav2_navfn_planner::ParameterHandler.