rosjava_tutorial_services on android
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?
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.
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.
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 thelocalhost
of the android device. It should be set to the IP of the host PC. Don't changelocalhost
.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).
How did you verify that the connection from client -> master is ok? Can you
rosnode ping ..
orrosnode info ..
the node on the android device?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.
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.
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 noderosnode info ..
i see all the nodes. But i cannot connect to client (because i cannot connect with the android device).