16 #ifndef NAV2_CONSTRAINED_SMOOTHER__OPTIONS_HPP_
17 #define NAV2_CONSTRAINED_SMOOTHER__OPTIONS_HPP_
22 #include "nav2_ros_common/lifecycle_node.hpp"
23 #include "nav2_ros_common/node_utils.hpp"
24 #include "ceres/ceres.h"
26 namespace nav2_constrained_smoother
49 std::string local_name = name + std::string(
".");
53 name +
".minimum_turning_radius", 0.4);
54 max_curvature = 1.0f / minimum_turning_radius;
58 local_name +
"w_cost_cusp_multiplier", 3.0);
59 cusp_costmap_weight = costmap_weight * cost_cusp_multiplier;
64 local_name +
"cost_check_points", std::vector<double>());
65 if (cost_check_points.size() % 3 != 0) {
68 "constrained_smoother"),
69 "cost_check_points parameter must contain values as follows: "
70 "[x1, y1, weight1, x2, y2, weight2, ...]");
71 throw std::runtime_error(
"Invalid parameter: cost_check_points");
74 double check_point_weights_sum = 0.0;
75 for (
size_t i = 2u; i < cost_check_points.size(); i += 3) {
76 check_point_weights_sum += cost_check_points[i];
78 for (
size_t i = 2u; i < cost_check_points.size(); i += 3) {
79 cost_check_points[i] /= check_point_weights_sum;
82 local_name +
"path_downsampling_factor", 1);
84 local_name +
"path_upsampling_factor", 1);
87 local_name +
"keep_goal_orientation",
true);
89 local_name +
"keep_start_orientation",
true);
92 double smooth_weight{0.0};
93 double costmap_weight{0.0};
94 double cusp_costmap_weight{0.0};
95 double cusp_zone_length{0.0};
96 double distance_weight{0.0};
97 double curvature_weight{0.0};
98 double max_curvature{0.0};
99 double max_time{10.0};
100 int path_downsampling_factor{1};
101 int path_upsampling_factor{1};
102 bool reversing_enabled{
true};
103 bool keep_goal_orientation{
true};
104 bool keep_start_orientation{
true};
105 std::vector<double> cost_check_points{};
130 std::string local_name = name + std::string(
".optimizer.");
134 local_name +
"linear_solver_type", std::string(
"SPARSE_NORMAL_CHOLESKY"));
135 if (solver_types.find(linear_solver_type) == solver_types.end()) {
136 std::stringstream valid_types_str;
137 for (
auto type = solver_types.begin(); type != solver_types.end(); type++) {
138 if (type != solver_types.begin()) {
139 valid_types_str <<
", ";
141 valid_types_str << type->first;
144 rclcpp::get_logger(
"constrained_smoother"),
145 "Invalid linear_solver_type. Valid values are %s", valid_types_str.str().c_str());
146 throw std::runtime_error(
"Invalid parameter: linear_solver_type");
155 const std::map<std::string, ceres::LinearSolverType> solver_types = {
156 {
"DENSE_QR", ceres::DENSE_QR},
157 {
"SPARSE_NORMAL_CHOLESKY", ceres::SPARSE_NORMAL_CHOLESKY}};
160 std::string linear_solver_type;
A lifecycle node wrapper to enable common Nav2 needs such as manipulating parameters.
ParameterT declare_or_get_parameter(const std::string ¶meter_name, const ParameterDescriptor ¶meter_descriptor=ParameterDescriptor())
Declares or gets a parameter with specified type (not value). If the parameter is already declared,...
void get(nav2::LifecycleNode *node, const std::string &name)
Get params from ROS parameter.
void get(nav2::LifecycleNode *node, const std::string &name)
Get params from ROS parameter.
SmootherParams()
A constructor for nav2_smac_planner::SmootherParams.