-
Notifications
You must be signed in to change notification settings - Fork 11
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
After Disconnect/Connect, previous topics can't be correctly re-subscribed to "Listener already available in ros.listeners[0]" #20
Comments
looks like that check is already being done as that is where the error message is coming from
not sure why it wouldn't allow msgs to be pushed to the console then... |
Perhaps with the reconnect the value of ros.ROS changes? Might be able to add an && to that if statement? if (newListener.name === ros.listeners[listener].name && newListener.ros ===ros.listeners[listener].ros) So maybe instead... reset the old listeners to the new ros.ROS if it changes??
in handleConnect (index.js)
?
|
This may work too:
however using it with the example code:
actually adds listeners, so you get additional messages pushed to the console. |
well, ok, it doesn't add listeners... it subscribes multiple times to the same listener... so the example code does this
regardless if the listener was already contained in the ros.listeners, so if you delete the last alphanumeric of the topic path and then re-add it - react-ros returns the previous listener, but the example code then adds another subscribe and adds extra messages to the console. |
possibly related: RobotWebTools/roslibjs#288 |
I think if you modify this in the example, you might be able to eliminate the double messaging (see my comment on RobotWebTools/roslibjs#288)... I don't have the example currently working to check, but it seems to have eliminated my issue... even though it is a bit of a clunky workaround.
|
As I wrote in the other thread... |
@jaguardo thanks for digging into this. im not sure if ill have time to get to implementing the change this week - maybe by this weekend. if you'd like to make a PR with any changes you think would be useful/could fix this issue it would help me out a lot! |
I'm not sure how it should change (or if?)... making a change to the example makes sense. could add it to the handleConnect/handleDisconnect functionality - which I think would be useful, but that might not fit with the "ROS" philosophy/standard? (ROS is still a little new for me) From what I can tell they expect the user to handle this, but the methods to do that are obviously not intuitive. I would think anytime there is a disconnect and a reconnect that the topics/listeners should be erased (would probably break a lot of folks code though!) since you could be connecting to another ROS-bridge and might have different topics and the need for different listeners. And/or if you ever wanted to connect to more than 1 ROS connection, wouldn't want the listeners message handlers accumulating. I also noticed if I subscribe to publish to a topic, (I'm not sure how this is mechanized either yet) it also requires removing the ros component from the listener as I think there is a similar problem there where it keeps adding to it rather then removing and creating a new one... so when I disconnect/connect I can no longer publish without refreshing the page, unless I do this before creating the listener:
|
I cant seem to push a new branch on this repo... might be some permission issue? here is what I would have pushed, made a pull request:
add an additional line to reset the listeners back to blank, seems to help/work. not sure what other effects it will have yet. would be nice to eventually get to a point where even if there is an interruption (self initiated or otherwise) that the listeners and/or topics could be saved... or when creating the ros.ros connection quickly re-load what was used previously. |
@jaguardo if you fork it and then push to your fork, you should be able to make a PR that way. |
using the simple example:
https://flynneva.github.io/react-ros/examples/simple_echo/
with a ROS turtle simulator.
When connected, can add "Topic to echo". However if "toggle connect" to disconnect and then again to reconnect, this message appears in the console:
and the topic is no longer pushed to the console...
However, if another topic is entered into the "topic to echo:" input it will subscribe, find without that error? and its message pushed to the console... can then repeat the disconnect/connect process and now that topic will no longer be subscribed and a similar message:
so need to be able to check if the listener is already created and use the available one, versus try to recreate a new one?
The text was updated successfully, but these errors were encountered: