ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Network configuration ros <--> android_core

asked 2012-09-20 03:11:57 -0600

Poseidonius gravatar image

updated 2012-09-30 08:12:16 -0600

Hi everyone,

I just complied the pubsub example of the android_core package and run it on my (non rooted) Android 4.0.3 device. Hence, I guess I have to use IP numbers to configure the connection.

But the Android device get not included in the ROS network correctly. Rxgraph shows only a "red node" and a communication error.

Roscore runs on the PC. The .bashrc defines here:

export ROS_IP=192.168.178.21

In the Android program I answer the question for the "Master" with:

http://192.168.178.21:11311/

... but I do not receive any message. roswtf generates the following results

Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
ERROR: connection refused to [http://127.0.0.1:40446/]
ERROR: connection refused to [http://127.0.0.1:43793/]
... done running graph rules

Online checks summary:

Found 3 error(s).

ERROR Communication with [/rosout] raised an error: 
ERROR Could not contact the following nodes:
 * /android_gingerbread/ros_text_view
 * /rosjava_tutorial_pubsub/talker

ERROR The following nodes should be connected but aren't:
 * /rosjava_tutorial_pubsub/talker->/android_gingerbread/ros_text_view (/chatter)
 * /android_gingerbread/ros_text_view->/rosout (/rosout)
 * /rosjava_tutorial_pubsub/talker->/rosout (/rosout)

I do not understand the origin of "127.0.0.1". Any ideas?

Best wishes

Poseidonius

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-09-28 06:55:31 -0600

Poseidonius gravatar image

updated 2012-09-30 08:18:27 -0600

Dear ahendrix,

thanks for your advice. I tested this configuration too, but the result was the same.

After an attentive search I found "my" problem already discussed at answers.ros.org: Forum Entry

Hence, I do the recommenended change for the android_tutorial_pupsub in MainActivity.java

@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
   talker = new Talker();
   NodeConfiguration nodeConfiguration = NodeConfiguration.newPrivate();
   nodeConfiguration.setMasterUri(getMasterUri());
   nodeMainExecutor.execute(talker, nodeConfiguration);
   nodeMainExecutor.execute(rosTextView, nodeConfiguration);

}

the 4th line into

NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress().toString());

Thanks for your help Best wishes

Poseidonius

edit flag offensive delete link more

Comments

I found an explaination here: http://answers.ros.org/question/44472/android_core-pubsub-tutorial/ But why does the tutorials use different ways of node configuration?

Poseidonius gravatar image Poseidonius  ( 2012-09-30 08:14:37 -0600 )edit
1

answered 2012-09-24 17:01:52 -0600

ahendrix gravatar image

updated 2012-09-24 17:05:03 -0600

I suspect your phone is having some trouble resolving publisher hostnames; I suggest you set your ROS_MASTER_URI and ROS_HOSTNAME on the PC using IP addresses like so:

export ROS_MASTER_URI="http://192.168.178.21:11311"
export ROS_HOSTNAME="192.168.178.21"

The reason behind this is that, when your publisher registers a topic, it uses ROS_HOSTNAME as the host name for that topic. When a remote node contacts the master to get the address of a remote service, it gets back the value of ROS_HOSTNAME (among other things), and if it can't resolve that address, it can't subscribe to the associated topic or make the associated service call.

You may also have to explicitly set or choose an IP address as the address that is advertised on the android side; I think there's an API for this, but I'm not sure what it is.

You can see which address is actually associated with a topic using 'rostopic info <topic>'

You can get the address associated with a ROS node using 'rosnode info <node_name>'

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-09-20 03:11:57 -0600

Seen: 1,235 times

Last updated: Sep 30 '12