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

Handling latched topic #1

Closed
jihoonl opened this issue Oct 19, 2012 · 5 comments
Closed

Handling latched topic #1

jihoonl opened this issue Oct 19, 2012 · 5 comments

Comments

@jihoonl
Copy link
Member

jihoonl commented Oct 19, 2012

migrating issue from rosjs. https://github.com/RobotWebTools/rosjs/issues/23

In current implementation rosbridge are not aware of latched topic. It causes a problem when there are multiple rosbridge clients.(e.g only first subscriber receives the latched topic and the follower would not get any message).

I would like to suggest to have latchted:true option parsing handling in rosbridge. Though, this also require some changes in rosjs, it would be the quick way to fix the issue.

It is open question so please feed me any suggestion.

@jihoonl
Copy link
Member Author

jihoonl commented Oct 19, 2012

Another suggestion is having a rosbridge configuration file or parameter which we can specify which topics to be latched. As a ros system admin or back-end maintainer, they should know which topics have to be latched.

In this case, we don't have to cage every topic but the configured ones.

@RainCT
Copy link
Contributor

RainCT commented Oct 24, 2013

Hi,

This is quite a limitation in rosbridge. Is there any particular reason why MultiSubscriber is required in the first place? If there's no way to know if a topic is latched, I'd just drop it.

An alternative would be having subscribe() create a second subscription to see if it receives a latched topic, and removing it again once it receives a message or a timeout is reached (possibly with some handling to create only one second subscription if there's several clients subscribing before a message is received). I'd be happy to write the code for this if it sounds like a reasonable solution, but I'd like to know first what benefit there is in avoiding subscribers.

Thanks.

RainCT added a commit to RainCT/rosbridge_suite that referenced this issue Oct 24, 2013
@RainCT
Copy link
Contributor

RainCT commented Oct 24, 2013

I've submitted #58 which finally fixes this (by basically adding two lines of code). It's using some private API from rospy but it's the easiest fix.

The same could also be achieved without directly using the internal API by creating a second Subscriber instance (as I proposed in my previous commit). However, that'd probably still rely on the knowledge that the callback will be invoked immediately (from the same thread), so I'd rather just explicitly use the internal API.

Alternatively I'd just remove all this MultiSubscriber stuff, since rospy already does pretty much the same internally (but with proper support for latched topics; see https://github.com/ros/ros_comm/blob/hydro-devel/clients/rospy/src/rospy/topics.py). The only difference would be that the JSON encoding would happen multiple times.

@rctoris
Copy link
Contributor

rctoris commented Oct 24, 2013

Awesome!!!

@rctoris rctoris closed this as completed Oct 24, 2013
rctoris added a commit that referenced this issue Oct 24, 2013
Implement multiple subscriptions to latched topics (fixes #1).
@jihoonl
Copy link
Member Author

jihoonl commented Jan 23, 2014

jihoonl pushed a commit to robotics-in-concert/rosbridge_suite that referenced this issue Apr 16, 2015
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

No branches or pull requests

3 participants