Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

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

Closed
wkentaro wants to merge 10 commits intoros:indigo-develfrom
wkentaro:connection-based-transport
Closed

[topic_tools] Abstract class to implement connection based transport#713
wkentaro wants to merge 10 commits intoros:indigo-develfrom
wkentaro:connection-based-transport

Conversation

@wkentaro
Copy link
Copy Markdown
Contributor

@wkentaro wkentaro commented Dec 4, 2015

No description provided.

@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented Dec 4, 2015

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

@wkentaro wkentaro force-pushed the connection-based-transport branch from 3dcc9a2 to 0afccfa Compare December 4, 2015 08:37
@dirk-thomas
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

@ros-pull-request-builder retest this please

@wkentaro
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Thank you!.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants