(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Connecting to a ROS Master

Description: This tutorial will show you the steps involved in introducing an Android device to your ROS Master.

Keywords: android, android_sensors_driver, master

Tutorial Level: BEGINNER

Setting up Environment (Computer)

The first step needed to connect to your ROS Master is setting up the proper environment variables.

To do this, you'll first need to determine your IP address for the network that your Android device and ROS master will share.

Once you have the IP address, use it to set the ROS_MASTER_URI environment variable. Be sure to substitute your IP address for '192.168.1.204'.

    export ROS_MASTER_URI=http://192.168.1.204:11311/

Next start up a roscore

    roscore

You can now move onto setting up the Android device.

Set up the Android device

On your Android device, connect to the wireless access point associated with your ROS_MASTER_URI.

When you run the android_sensors_driver app, the are presented with is the master chooser. Use this screen and enter the ROS_MASTER_URI you wish to connect to.

master.png

Once you've done this, you should see your device attempting to access sensors, so now it's time to go back to your computer to see if your device connected.

Testing the connection

To see if the Android device connected, try listed available nodes.

    rosnode list

You should see /android_sensors_driver in the list. To test connectivity to the Android device, try:

    rosnode ping /android_sensors_driver

You should see something like the following if it's successful:

rosnode: node is [/android_sensors_driver]
pinging /android_sensors_driver with a timeout of 3.0s
xmlrpc reply from http://192.168.1.223:48117    time=53.053141ms
xmlrpc reply from http://192.168.1.223:48117    time=115.639925ms
xmlrpc reply from http://192.168.1.223:48117    time=122.823000ms

To verify the topics, try

    rostopic list

Somewhere in the list of rostopics you should see /android/fix. This is currently the only topic published by android_sensors_driver.

Finally, you can debug the output of the driver by:

    rostopic echo /android/fix

However, be aware the driver will not publish a message until GPS on your device has acquired a fix (the GPS Icon on your phone will have the solid center).

Wiki: android_sensors_driver/Tutorials/Connecting to a ROS Master (last edited 2012-01-07 03:38:44 by ChadRockey)