rosjava_tutorial_services on android

asked 2015-11-30 12:26:27 -0600

denis gravatar image

Hello.

I am trying to create a ROS client server application in android. I'm using the rosjava_tutorial_services. If i create both server and client on the android emulator everything works fine. But if i create the client on the android emulator and the server on the pc, the client can not connect to the server (connection refused on address 127.0.0.1:(generic port)). I also tried to change the file hosts of the emulator (localhost from 127.0.0.1 to 10.0.2.2) but i received the same error.

Anyone know how to connect the client to the server? What IP address should i use?

edit retag flag offensive close merge delete

Comments

This could be caused by incorrect network configuration. The android emulator instances use a specific network setup, and iirc you'll need to change that, or at least keep it in mind.

gvdhoorn gravatar imagegvdhoorn ( 2015-12-01 02:26:14 -0600 )edit

Thanks a lot for the answer, but I'm not sure that is a network problem. If it was a network configuration problem, the app should not even connect with rosmaster. Instead the app connects to rosmaster normally.

denis gravatar imagedenis ( 2015-12-01 03:14:43 -0600 )edit

is your ros master also running on your PC? Or does the rosjava app start it? How is the ros master uri configured in your rosjava app? If it's set to localhost it should try to connect to the localhost of the android device. It should be set to the IP of the host PC. Don't change localhost.

gvdhoorn gravatar imagegvdhoorn ( 2015-12-01 03:52:09 -0600 )edit

Master and server running on PC. Also the client, but using an emulator. Initially i start to run the master and the server. After this I start to run the client, then the client connects to the master using localhost(it works fine). The connection with server failed instead (also using localhost).

denis gravatar imagedenis ( 2015-12-01 04:26:10 -0600 )edit

How did you verify that the connection from client -> master is ok? Can you rosnode ping .. or rosnode info .. the node on the android device?

gvdhoorn gravatar imagegvdhoorn ( 2015-12-01 06:05:47 -0600 )edit

I cannot call these commands from the android device, but the connection between client and master is ok, I'm sure. If the connection between client and master fails the app stops the execution.

denis gravatar imagedenis ( 2015-12-01 07:26:41 -0600 )edit

I know you can't use those commands on the android device, but you can run them on the host, in a terminal. It would tell us if there are any basic networking issues.

gvdhoorn gravatar imagegvdhoorn ( 2015-12-01 07:32:06 -0600 )edit

If I run rosnode list from my desktop, I see all three nodes (client, server, master), everything works fine between the client try to connect the server. If I use the node rosnode info .. i see all the nodes. But i cannot connect to client (because i cannot connect with the android device).

denis gravatar imagedenis ( 2015-12-01 08:54:53 -0600 )edit