In implementing a typical connect callback for nodelets, I found the lack of Subscriber::reconnect to be problematic. Implementing a generic data-structure to store the name and callback for multiple subscribers seems counter productive since I'll just be re-implementing similar abstractions as ROS.
Current code:
if (!static_cast<void*>(sub1)) sub1 = nh.subscriber(topic1, qSize, callback1, this);
if (!static_cast<void*>(sub2)) sub2 = it.subscriber(topic2, qSize, callback2, this);
With enhancement:
sub1.reconnect();
sub2.reconnect();
Potential dummy-code implementation:
ros::Subscriber::reconnect() {
if (static_cast<void*>(*this)) { return; }
if (impl_) {
// grab the details from existing internal data struct and resubscribe
}
else {
// impossible to be here. The impl_ is never deleted in current code
}
}
This will largely simplify the life of nodelet writers
In implementing a typical connect callback for nodelets, I found the lack of
Subscriber::reconnect
to be problematic. Implementing a generic data-structure to store the name and callback for multiple subscribers seems counter productive since I'll just be re-implementing similar abstractions as ROS.Current code:
With enhancement:
Potential dummy-code implementation:
This will largely simplify the life of nodelet writers