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

Use newer 'add_on_set_parameters_callback' API #562

Merged
merged 1 commit into from
Jul 9, 2020
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
2 changes: 2 additions & 0 deletions image_publisher/include/image_publisher/image_publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ImagePublisher : public rclcpp::Node
cv::Mat image_;
rclcpp::TimerBase::SharedPtr timer_;

rclcpp::Node::OnSetParametersCallbackHandle::SharedPtr on_set_parameters_callback_handle_;

std::string filename_;
bool flip_horizontal_;
bool flip_vertical_;
Expand Down
2 changes: 1 addition & 1 deletion image_publisher/src/image_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ImagePublisher::ImagePublisher(const rclcpp::NodeOptions & options)
ImagePublisher::reconfigureCallback();
return result;
};
this->set_on_parameters_set_callback(param_change_callback);
on_set_parameters_callback_handle_ = this->add_on_set_parameters_callback(param_change_callback);
}

void ImagePublisher::reconfigureCallback()
Expand Down
2 changes: 2 additions & 0 deletions image_rotate/include/image_rotate/image_rotate_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class ImageRotateNode : public rclcpp::Node
void disconnectCb();
void onInit();

rclcpp::Node::OnSetParametersCallbackHandle::SharedPtr on_set_parameters_callback_handle_;

std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
std::shared_ptr<tf2_ros::TransformListener> tf_sub_;
std::shared_ptr<tf2_ros::TransformBroadcaster> tf_pub_;
Expand Down
2 changes: 1 addition & 1 deletion image_rotate/src/image_rotate_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ ImageRotateNode::ImageRotateNode()
}
return result;
};
this->set_on_parameters_set_callback(reconfigureCallback);
on_set_parameters_callback_handle_ = this->add_on_set_parameters_callback(reconfigureCallback);
onInit();
}

Expand Down
1 change: 1 addition & 0 deletions image_view/include/image_view/image_view_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class ImageViewNode
std::shared_ptr<rclcpp::Publisher<sensor_msgs::msg::Image>> pub_;
std::string window_name_;
std::thread window_thread_;
rclcpp::Node::OnSetParametersCallbackHandle::SharedPtr on_set_parameters_callback_handle_;

void imageCb(const sensor_msgs::msg::Image::ConstSharedPtr & msg);
static void mouseCb(int event, int x, int y, int flags, void * param);
Expand Down
2 changes: 1 addition & 1 deletion image_view/src/image_view_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ImageViewNode::ImageViewNode(const rclcpp::NodeOptions & options)
window_thread_ = std::thread(&ImageViewNode::windowThread, this);
}

this->set_on_parameters_set_callback(
on_set_parameters_callback_handle_ = this->add_on_set_parameters_callback(
std::bind(&ImageViewNode::paramCallback, this, std::placeholders::_1));
}

Expand Down
6 changes: 5 additions & 1 deletion stereo_image_proc/src/stereo_image_proc/disparity_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class DisparityNode : public rclcpp::Node
// Publications
std::shared_ptr<rclcpp::Publisher<stereo_msgs::msg::DisparityImage>> pub_disparity_;

// Handle to parameters callback
rclcpp::Node::OnSetParametersCallbackHandle::SharedPtr on_set_parameters_callback_handle_;

// Processing state (note: only safe because we're single-threaded!)
image_geometry::StereoCameraModel model_;
// contains scratch buffers for block matching
Expand Down Expand Up @@ -175,7 +178,8 @@ DisparityNode::DisparityNode(const rclcpp::NodeOptions & options)
}

// Register a callback for when parameters are set
this->set_on_parameters_set_callback(std::bind(&DisparityNode::parameterSetCb, this, _1));
on_set_parameters_callback_handle_ = this->add_on_set_parameters_callback(
std::bind(&DisparityNode::parameterSetCb, this, _1));

// Describe int parameters
std::map<std::string, std::pair<int, rcl_interfaces::msg::ParameterDescriptor>> int_params;
Expand Down