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_CONTROLLER__PARAMETER_HANDLER_HPP_
16 #define NAV2_CONTROLLER__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_controller
30 {
31 
32 struct Parameters
33 {
34  double controller_frequency;
35  double min_x_velocity_threshold;
36  double min_y_velocity_threshold;
37  double min_theta_velocity_threshold;
38  std::string speed_limit_topic;
39  double failure_tolerance;
40  bool use_realtime_priority;
41  bool publish_zero_velocity;
42  rclcpp::Duration costmap_update_timeout{0, 0};
43  std::string odom_topic;
44  double odom_duration;
45  double search_window;
46  std::vector<std::string> progress_checker_ids;
47  std::vector<std::string> progress_checker_types;
48  std::vector<std::string> goal_checker_ids;
49  std::vector<std::string> goal_checker_types;
50  std::vector<std::string> controller_ids;
51  std::vector<std::string> controller_types;
52  std::vector<std::string> path_handler_ids;
53  std::vector<std::string> path_handler_types;
54 };
55 
61 {
62 public:
67  const nav2::LifecycleNode::SharedPtr & node,
68  const rclcpp::Logger & logger);
69 
70 protected:
79  rcl_interfaces::msg::SetParametersResult validateParameterUpdatesCallback(
80  const std::vector<rclcpp::Parameter> & parameters) override;
81 
88  void updateParametersCallback(const std::vector<rclcpp::Parameter> & parameters) override;
89 
90  const std::vector<std::string> default_progress_checker_ids_{"progress_checker"};
91  const std::vector<std::string> default_progress_checker_types_{
92  "nav2_controller::SimpleProgressChecker"};
93  const std::vector<std::string> default_goal_checker_ids_{"goal_checker"};
94  const std::vector<std::string> default_goal_checker_types_{"nav2_controller::SimpleGoalChecker"};
95  const std::vector<std::string> default_controller_ids_{"FollowPath"};
96  const std::vector<std::string> default_controller_types_{"nav2_mppi_controller::MPPIController"};
97  const std::vector<std::string> default_path_handler_ids_{"PathHandler"};
98  const std::vector<std::string> default_path_handler_types_{
99  "nav2_controller::FeasiblePathHandler"};
100 };
101 
102 } // namespace nav2_controller
103 
104 #endif // NAV2_CONTROLLER__PARAMETER_HANDLER_HPP_
Handles parameters and dynamic parameters for Controller Server.
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, const rclcpp::Logger &logger)
Constructor for nav2_controller::ParameterHandler.