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  // Integer factor applied to the largest costmap dimension to limit path extraction cycles
43  int max_cycles_factor;
44 };
45 
51 {
52 public:
57  const nav2::LifecycleNode::SharedPtr & node,
58  std::string & plugin_name,
59  rclcpp::Logger & logger);
60 
61 protected:
68  void
69  updateParametersCallback(const std::vector<rclcpp::Parameter> & parameters) override;
70 
79  rcl_interfaces::msg::SetParametersResult
80  validateParameterUpdatesCallback(const std::vector<rclcpp::Parameter> & parameters) override;
81 
82  std::string plugin_name_;
83 };
84 
85 } // namespace nav2_navfn_planner
86 
87 #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.