rosjava / android_core

Android libraries for rosjava
145 stars 166 forks source link

Running multiple subscribers in a ROS-android App #244

Closed sami-s-hajjaj closed 7 years ago

sami-s-hajjaj commented 7 years ago

Hi, I am trying to create a listener App that contains two subscribers, each subscribing to two different publishers, publishing on two different topics, and on two different message types. I want to capture that data from each and process it in my android app.

I can create and run each subscriber with no problems. The problem comes when attempting to run both of them at the same time. In which case only one will run, usually the one which was called first.

To avoid repetitiveness, you can see the complete code i created here

Thank you.

sami-s-hajjaj commented 7 years ago

OK I already managed to solve it .... the issue comes from the fact that both subscribers (ROSTextView) are calling the same class from source. In that class, the NodeName is defined as "ros_text_view", so if multiple subscribers call it, they will both have the same NodeName, which is not allowed in ROS.

The solution to this comes from this answer

simply by creating two separate NodeConfigurations, and assign a new NodeName for each (or at least one of them) , this way, there will be no Name Conflict