Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Ensure parameters are initialized with default values if undefined in params.yml #5

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions samples/ros2_cpp_all_pkg/src/ros2_cpp_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name,
ss << param;
}
RCLCPP_WARN_STREAM(this->get_logger(), ss.str());
this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))});
}
}

Expand Down
1 change: 1 addition & 0 deletions samples/ros2_cpp_component_pkg/src/ros2_cpp_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name,
ss << param;
}
RCLCPP_WARN_STREAM(this->get_logger(), ss.str());
this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))});
}
}

Expand Down
1 change: 1 addition & 0 deletions samples/ros2_cpp_lifecycle_pkg/src/ros2_cpp_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name,
ss << param;
}
RCLCPP_WARN_STREAM(this->get_logger(), ss.str());
this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))});
}
}

Expand Down
1 change: 1 addition & 0 deletions samples/ros2_cpp_pkg/src/ros2_cpp_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void Ros2CppNode::declareAndLoadParameter(const std::string& name,
ss << param;
}
RCLCPP_WARN_STREAM(this->get_logger(), ss.str());
this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def declareAndLoadParameter(self,
else:
self.get_logger().warn(f"Missing parameter '{name}', using default value: {default}")
param = default
self.set_parameters([rclpy.Parameter(name=name, value=param)])

# add parameter to auto-reconfigurable parameters
if add_to_auto_reconfigurable_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def declareAndLoadParameter(self,
else:
self.get_logger().warn(f"Missing parameter '{name}', using default value: {default}")
param = default
self.set_parameters([rclpy.Parameter(name=name, value=param)])

# add parameter to auto-reconfigurable parameters
if add_to_auto_reconfigurable_params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ void {{ node_class_name }}::declareAndLoadParameter(const std::string& name,
ss << param;
}
RCLCPP_WARN_STREAM(this->get_logger(), ss.str());
this->set_parameters({rclcpp::Parameter(name, rclcpp::ParameterValue(param))});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class {{ node_class_name }}(Node):
else:
self.get_logger().warn(f"Missing parameter '{name}', using default value: {default}")
param = default
self.set_parameters([rclpy.Parameter(name=name, value=param)])

# add parameter to auto-reconfigurable parameters
if add_to_auto_reconfigurable_params:
Expand Down
Loading