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

[topic_tools] Abstract class to implement connection based transport #713

Closed
wants to merge 10 commits into from

Conversation

wkentaro
Copy link
Contributor

@wkentaro wkentaro commented Dec 4, 2015

No description provided.

@wkentaro
Copy link
Contributor Author

wkentaro commented Dec 4, 2015

ConnectionBased means the node does not subscribe unless there are any child subscribers of that node.

@dirk-thomas
Copy link
Member

I don't understand what you mean with:

ConnectionBased means the node does not subscribe unless there are any child subscribers of that node.

Please provide a detailed description what the use case is you are trying to address, the expected behavior of the provided patch and why this should be added in the ROS core (instead of being handled in user land code).

@wkentaro
Copy link
Contributor Author

ConnectionBased is the same function as lazy of throttle in topic_tools. https://github.com/ros/ros_comm/blob/indigo-devel/tools/topic_tools/src/throttle.cpp#L83-L88
It subscribes and process something only when there is at least a subscriber. This behavior is good for conserve the cpu and memory in particular when the node is doing image processing.
At this time, I think each author of each node uses event listener of connection/disconnection and subscribe/unsubscribe.
like

This seems a common practice enough to create an abstract class for it, that's why I think this should be included in topic_tools.
We have also c++ version of this kind of class in my lab package.
https://github.com/jsk-ros-pkg/jsk_common/blob/master/jsk_topic_tools/src/connection_based_nodelet.cpp#L74

@dirk-thomas
Copy link
Member

dirk-thomas commented Mar 2, 2016

The patch makes use of sensor_msgs within topic_tools. I don't think that is a viable dependency for this core repository.

Also topic_tools does currently not depend on six and I am not convinced it is necessary for this PR.

The remaining class ConnectionBasedTransport seems to be overly complicated for the desired task. E.g. _ever_subscribed and _connection_status can be easily modeled as one variable with the following value:

  • None: never been subscribed
  • False: currently not subscribed but has been subscribed before
  • True: currently subscribed

The class embeds decisions like getting all the configuration option from ros parameters. It is not possible to e.g. pass them as argument.

Regarding the naming if the class: when talking about transport connection-based as a clearly defined meaning. Therefore I think the current name is confusing - something with lazy seems to be more appropriate.

Based on the above comments I am not sure if this should be integrated into topic_tools. It might be better to place it into a separate package which still allow the code to be reused.

@dirk-thomas
Copy link
Member

@ros-pull-request-builder retest this please

@wkentaro
Copy link
Contributor Author

wkentaro commented Mar 2, 2016

I will change the commit like below, is these not enough to justify this to be merged?

  • Use std_msgs instead of sensor_msgs as the example.
  • Rename the class to be more common name (lazy)
  • Stop using enum and simplify the flag
  • Add python-six as run_depend (dependency on six is removed)

@dirk-thomas
Copy link
Member

I don't think a run dependency on Python six should be added since this code has been released for a very long time without. Can you update the code to not require six?

The other three options would be great.

@wkentaro wkentaro force-pushed the connection-based-transport branch 2 times, most recently from bc3b8b2 to 80d4463 Compare May 7, 2016 00:53
@wkentaro wkentaro force-pushed the connection-based-transport branch from 80d4463 to 9265200 Compare May 11, 2016 04:12
@wkentaro wkentaro changed the title Abstract class to implement connection based transport [topic_tools] Abstract class to implement connection based transport May 11, 2016
@dirk-thomas
Copy link
Member

Thank you for the patch and iterating on this. I have cherry-picked the changes to the kinetic-devel branch: f8f0d38

@wkentaro wkentaro deleted the connection-based-transport branch June 27, 2016 20:21
@wkentaro
Copy link
Contributor Author

Thank you!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants