Nav2 Navigation Stack - lyrical  lyrical
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/logger.hpp"
25 #include "rclcpp/parameter.hpp"
26 #include "nav2_ros_common/lifecycle_node.hpp"
27 #include "nav2_util/parameter_handler.hpp"
28 #include "nav2_ros_common/node_utils.hpp"
29 
30 namespace nav2_navfn_planner
31 {
32 
33 struct Parameters
34 {
35  // Whether or not the planner should be allowed to plan through unknown space
36  bool allow_unknown;
37  bool use_final_approach_orientation;
38  // If the goal is obstructed, the tolerance specifies how many meters the planner
39  // can relax the constraint in x and y before failing
40  double tolerance;
41  // Whether to use the astar planner or default dijkstras
42  bool use_astar;
43  // Integer factor applied to the largest costmap dimension to limit path extraction cycles
44  int max_cycles_factor;
45 };
46 
52 {
53 public:
58  const nav2::LifecycleNode::SharedPtr & node,
59  std::string & plugin_name,
60  rclcpp::Logger & logger);
61 
62 protected:
69  void
70  updateParametersCallback(const std::vector<rclcpp::Parameter> & parameters) override;
71 
80  rcl_interfaces::msg::SetParametersResult
81  validateParameterUpdatesCallback(const std::vector<rclcpp::Parameter> & parameters) override;
82 
83  std::string plugin_name_;
84 };
85 
86 } // namespace nav2_navfn_planner
87 
88 #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.