-
Notifications
You must be signed in to change notification settings - Fork 226
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
image_transport: 'Republish' as a nodelet #73
image_transport: 'Republish' as a nodelet #73
Conversation
+1, Just searched if this is available somewhere and was close to implementing myself. |
// Use Publisher::publish as the subscriber callback | ||
typedef void (Publisher::*PublishMemFn)(const sensor_msgs::ImageConstPtr&) const; | ||
PublishMemFn pub_mem_fn = &Publisher::publish; | ||
sub_ = it_->subscribe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might yield a warning from the ReconfigureServer of the CompressedSubscriber. Since a new subscriber is created before the old one is destroyed, the new Server wants to advertise an existing service. My solution would be, to manually destroy the sub_ object in unsubscribe().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sefrin Thanks for the review! I could reproduced the bug,
# Terminal 1
roscore &
rosrun uvc_camera uvc_camera_node &
rosrun image_transport republish in:=image_raw compressed out:=foo
# Terminal 2
rostopic hz /foo/compressed
^C
rostopic hz /foo/compressed
And I could see the error message on the terminal 1:
furushchev@dango:~/ros/kinetic_test/src/image_common/image_transport/src [republish-nodelet]$ rosrun image_transport republish in:=image_raw compressed out:=foo
[ INFO] [1533828252.220730375] [/image_republisher_1533828252119766128:ros.nodelet]: Initializing nodelet with 8 worker threads.
[ WARN] [1533828257.226403951] [/image_republisher_1533828252119766128:ros.image_transport./image_republisher_1533828252119766128]: This node/nodelet subscribes topics only when subscribed.
[ERROR] [1533828263.122396843] [/image_republisher_1533828252119766128:ros.roscpp]: Tried to advertise a service that is already advertised in this node [/image_republisher_1533828252119766128/compressed/set_parameters]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a small bug that might produce warnings from the dynamic reconfigure server. I did not test this solution but I encountered this bug, when I rewrote the republish node for myself so that it stops subscribing when no one is listening.
@skohlbr I updated this PR to ensure the |
Thanks for the fast reply! This change might yield errors if we call methods ( If we want to fix this completely, we might need to change the CompressedSubscriber plugin (http://docs.ros.org/lunar/api/compressed_image_transport/html/compressed__subscriber_8cpp_source.html). Maybe we can override shutdown there and let it destroy the |
Confirmed! Fixed in this PR: ros-perception/image_transport_plugins#25 |
a6d7378
to
0649ec6
Compare
@Sefrin Thanks too! That is indeed a far better solution. I reverted the change now. |
What is the status of this PR? |
This PR is targeting |
Ported
republish
node as a nodelet, and changed to call the nodelet fromrepublish
executable.This PR requires and is an application of #72