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_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/duration.hpp"
25 #include "rclcpp/logger.hpp"
26 #include "rclcpp/parameter.hpp"
27 #include "nav2_ros_common/lifecycle_node.hpp"
28 #include "nav2_util/parameter_handler.hpp"
29 #include "nav2_ros_common/node_utils.hpp"
30 
31 namespace nav2_controller
32 {
33 
34 struct Parameters
35 {
36  double controller_frequency;
37  double min_x_velocity_threshold;
38  double min_y_velocity_threshold;
39  double min_theta_velocity_threshold;
40  std::string speed_limit_topic;
41  double failure_tolerance;
42  bool use_realtime_priority;
43  bool publish_zero_velocity;
44  rclcpp::Duration costmap_update_timeout{0, 0};
45  std::string odom_topic;
46  double odom_duration;
47  double search_window;
48  std::vector<std::string> progress_checker_ids;
49  std::vector<std::string> progress_checker_types;
50  std::vector<std::string> goal_checker_ids;
51  std::vector<std::string> goal_checker_types;
52  std::vector<std::string> controller_ids;
53  std::vector<std::string> controller_types;
54  std::vector<std::string> path_handler_ids;
55  std::vector<std::string> path_handler_types;
56 };
57 
63 {
64 public:
69  const nav2::LifecycleNode::SharedPtr & node,
70  const rclcpp::Logger & logger);
71 
72 protected:
81  rcl_interfaces::msg::SetParametersResult validateParameterUpdatesCallback(
82  const std::vector<rclcpp::Parameter> & parameters) override;
83 
90  void updateParametersCallback(const std::vector<rclcpp::Parameter> & parameters) override;
91 
92  const std::vector<std::string> default_progress_checker_ids_{"progress_checker"};
93  const std::vector<std::string> default_progress_checker_types_{
94  "nav2_controller::SimpleProgressChecker"};
95  const std::vector<std::string> default_goal_checker_ids_{"goal_checker"};
96  const std::vector<std::string> default_goal_checker_types_{"nav2_controller::SimpleGoalChecker"};
97  const std::vector<std::string> default_controller_ids_{"FollowPath"};
98  const std::vector<std::string> default_controller_types_{"nav2_mppi_controller::MPPIController"};
99  const std::vector<std::string> default_path_handler_ids_{"PathHandler"};
100  const std::vector<std::string> default_path_handler_types_{
101  "nav2_controller::FeasiblePathHandler"};
102 };
103 
104 } // namespace nav2_controller
105 
106 #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.