diff --git a/include/gscam/gscam.h b/include/gscam/gscam.h index e4b4ee2..2b31da9 100644 --- a/include/gscam/gscam.h +++ b/include/gscam/gscam.h @@ -62,6 +62,12 @@ namespace gscam { // Case of a jpeg only publisher ros::Publisher jpeg_pub_; ros::Publisher cinfo_pub_; + + // Deprecated publishers + image_transport::ImageTransport image_transport_deprecated_; + image_transport::CameraPublisher camera_pub_deprecated_; + ros::Publisher jpeg_pub_deprecated_; + ros::Publisher cinfo_pub_deprecated_; }; } diff --git a/src/gscam.cpp b/src/gscam.cpp index dc96c22..0eba846 100644 --- a/src/gscam.cpp +++ b/src/gscam.cpp @@ -25,10 +25,32 @@ extern "C"{ #include +#include + #include namespace gscam { + template + void topicDeprecationWarning(const SSP& pub) + { + std::string correct_topic = pub.getTopic(); + boost::replace_first(correct_topic, "camera/", ""); + ROS_WARN_STREAM( + "gscam: Your node, \""<("camera/image_raw/compressed",1); - cinfo_pub_ = nh_.advertise("camera/camera_info",1); + jpeg_pub_ = nh_.advertise("image_raw/compressed",1); + cinfo_pub_ = nh_.advertise("camera_info",1); + + jpeg_pub_deprecated_ = nh_.advertise("camera/image_raw/compressed",1,rosTopicDeprecationWarning); + cinfo_pub_deprecated_ = nh_.advertise("camera/camera_info",1,rosTopicDeprecationWarning); } else { - camera_pub_ = image_transport_.advertiseCamera("camera/image_raw", 1); + camera_pub_ = image_transport_.advertiseCamera("image_raw", 1); + + camera_pub_deprecated_ = image_transport_deprecated_.advertiseCamera( + "image_raw", 1, + imageTransportTopicDeprecationWarning, image_transport::SubscriberStatusCallback(), + rosTopicDeprecationWarning, ros::SubscriberStatusCallback() + ); } return true; @@ -300,6 +332,9 @@ namespace gscam { img->data.begin()); jpeg_pub_.publish(img); cinfo_pub_.publish(cinfo); + + jpeg_pub_deprecated_.publish(img); + cinfo_pub_deprecated_.publish(cinfo); } else { // Complain if the returned buffer is smaller than we expect const unsigned int expected_frame_size = @@ -340,6 +375,7 @@ namespace gscam { // Publish the image/info camera_pub_.publish(img, cinfo); + camera_pub_deprecated_.publish(img, cinfo); } // Release the buffer