Damon, <div><br></div><div>One option is to take the course of "When in doubt, follow the behavior of roscpp." In that case, when a second node registers with the same name, the first node dies. For example, if you run </div>
<div><br></div><div>{{{</div><div>rosrun roscpp_tutorials talker</div><div>}}}</div><div><br></div><div>twice, the second instance behaves normally, but the first instance shows </div><div><br></div><div>{{{</div><div><div>
[ INFO] [1308753854.115622000]: hello world 72</div><div>[ INFO] [1308753854.215643000]: hello world 73</div><div>[ WARN] [1308753854.285720000]: Shutdown request received.</div><div>[ WARN] [1308753854.285791000]: Reason given for shutdown: [new node registered with same name]</div>
<div>[ INFO] [1308753854.315770000]: hello world 74</div></div><div>}}}</div><div><br></div><div>Just a thought. What do you think?</div><div><br></div><div>--Nick </div><div><br></div><div><br><div class="gmail_quote">On Wed, Jun 22, 2011 at 7:03 AM, Damon Kohler <span dir="ltr"><<a href="mailto:damonkohler@google.com">damonkohler@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">So, I can explain what's going on, but I'll have to think about what<br>
the correct behavior should be. Please file an issue about this.<br>
<br>
Basically, the exception that's being thrown is correct. You should<br>
not try to register two nodes with the same name.<br>
<br>
The reason it still works is that you don't _have_ to register a<br>
subscriber in order to connect it to a publisher. At the point the<br>
exception is thrown, the subscriber has enough information to connect<br>
to the publisher.<br>
<br>
Because the master registration happens asynchronously, it doesn't<br>
affect your ability to connect to the publisher. To do that, we'd<br>
either have to wait for registration to succeed, or disconnect you<br>
some time in the future if it failed. Both of those options are pretty<br>
terrible.<br>
<br>
Damon<br>
<br>
On Tue, Jun 21, 2011 at 8:25 PM, Abhishek Verma<br>
<div><div></div><div class="h5"><<a href="mailto:toabhishekverma@gmail.com">toabhishekverma@gmail.com</a>> wrote:<br>
> How about remote subscribers ?<br>
> I dont know if this use case exist or not but There can be remote<br>
> publisher/subscriber?<br>
> What happens in c++? Do code core refuse connection?<br>
><br>
> Rosjava need fix ...I am seeing this exception but publisher and subscriber<br>
> are able to communicate..(with exception)<br>
><br>
><br>
> Thanks and Regards<br>
> Abhishek Verma<br>
><br>
><br>
> On Tue, Jun 21, 2011 at 6:41 PM, Nicholas Butko <<a href="mailto:nbutko@ucsd.edu">nbutko@ucsd.edu</a>> wrote:<br>
>><br>
>> ROS nodes must have unique names. Two start two nodes of the same type in<br>
>> c++, you would use the command line arguments to set the name of the nodes,<br>
>> which would override the default.<br>
>> I'm not sure if this command line argument name remapping was implemented<br>
>> in java, but if it wasn't, you may consider having java append a random<br>
>> number to the end of the node name.<br>
>> --Nick<br>
>> On Tue, Jun 21, 2011 at 10:33 AM, Abhishek Verma<br>
>> <<a href="mailto:toabhishekverma@gmail.com">toabhishekverma@gmail.com</a>> wrote:<br>
>>><br>
>>> Hi Friends,<br>
>>> I am seeing following exception<br>
>>> 21-Jun-2011 18:29:01 org.apache.xmlrpc.server.XmlRpcErrorLogger log<br>
>>> SEVERE: Failed to invoke method registerSubscriber in class<br>
>>> org.ros.internal.node.xmlrpc.MasterImpl: null<br>
>>> org.apache.xmlrpc.common.XmlRpcInvocationException: Failed to invoke<br>
>>> method registerSubscriber in class org.ros.internal.node.xmlrpc.MasterImpl:<br>
>>> null<br>
>>> at<br>
>>> org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:129)<br>
>>> at<br>
>>> org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.execute(ReflectiveXmlRpcHandler.java:106)<br>
>>> at<br>
>>> org.apache.xmlrpc.server.XmlRpcServerWorker.execute(XmlRpcServerWorker.java:46)<br>
>>> at org.apache.xmlrpc.server.XmlRpcServer.execute(XmlRpcServer.java:86)<br>
>>> at<br>
>>> org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:200)<br>
>>> at org.apache.xmlrpc.webserver.Connection.run(Connection.java:208)<br>
>>> at org.apache.xmlrpc.util.ThreadPool$Poolable$1.run(ThreadPool.java:68)<br>
>>> Caused by: java.lang.IllegalStateException<br>
>>> at<br>
>>> com.google.common.base.Preconditions.checkState(Preconditions.java:129)<br>
>>> at<br>
>>> org.ros.internal.node.server.MasterServer.addSlave(MasterServer.java:80)<br>
>>> at<br>
>>> org.ros.internal.node.server.MasterServer.registerSubscriber(MasterServer.java:110)<br>
>>> at<br>
>>> org.ros.internal.node.xmlrpc.MasterImpl.registerSubscriber(MasterImpl.java:123)<br>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
>>> at<br>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br>
>>> at<br>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br>
>>> at java.lang.reflect.Method.invoke(Method.java:597)<br>
>>> at<br>
>>> org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:115)<br>
>>><br>
>>> My code is<br>
>>> //Publisher<br>
>>> node = new Node("Camera1", configuration);<br>
>>> publisher = node.createPublisher("Camera1",<br>
>>> org.ros.message.sensor_msgs.Image.class);<br>
>>> ....................<br>
>>> //Subscriber<br>
>>>  node = new Node("Camera1", configuration);<br>
>>>       System.out.println("ScreenView.main() Starting");<br>
>>> //      final Log log = node.getLog();<br>
>>>       node.createSubscriber("Camera1", new<br>
>>> MessageListener<org.ros.message.sensor_msgs.Image>() {<br>
>>>         public void onNewMessage(org.ros.message.sensor_msgs.Image<br>
>>> message) {<br>
>>>           System.out<br>
>>> .println("Subscriber \"" + message + "\"");<br>
>>>         }<br>
>>>       }, org.ros.message.sensor_msgs.Image.class);<br>
>>><br>
>>> Reason behind this exception is Nodes with same name.<br>
>>> If I change this name and create different nodes in publisher and<br>
>>> subscribers code then its fine.<br>
>>> Anyone has any idea why is that or we are not supposed to create node<br>
>>> with same name?<br>
>>> Thanks and Regards<br>
>>> Abhishek Verma<br>
>>><br>
>>> _______________________________________________<br>
>>> ros-users mailing list<br>
>>> <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
>>> <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
>>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> ros-users mailing list<br>
>> <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
>> <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> ros-users mailing list<br>
> <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
> <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
><br>
><br>
<br>
<br>
<br>
</div></div>--<br>
----------------------------------------------<br>
Damon Kohler<br>
Software Engineer<br>
<br>
Google Germany GmbH<br>
Dienerstr. 12<br>
80331 München<br>
----------------------------------------------<br>
AG Hamburg, HRB 86891<br>
Sitz der Gesellschaft: Hamburg<br>
Geschäftsführer: John Herlihy, Graham Law, Lloyd Martin, Kent Walker<br>
----------------------------------------------<br>
Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat<br>
sind, leiten Sie diese bitte nicht weiter, informieren den Absender<br>
und löschen Sie die E-Mail und alle Anhänge. Vielen Dank.<br>
<br>
This email is confidential. If you are not the right addressee please<br>
do not forward it, please inform the sender, and please erase this<br>
e-mail including any attachments. Thanks.<br>
<div><div></div><div class="h5">_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</div></div></blockquote></div><br></div>