Controlling SparkV using Android phone's accelerometer

After integrating ROS and SparkV robot, its very easy to control the SparkV robot using Android phone's accelerometer. The prerequisite for this tutorial is basic understanding of ROS and my previous tutorial of integrating ROS and SparkV.

Package summary :

sparkV_android is a basic ROS package that subscribes to imu messages published by phone and according to the phone's orientation publishes motion command to sparkV robot.


First install the ROS android sensor driver app from android market.

After that you have to connect your phone and computer to same network. For this you can check this tutorial. OR simply you can start a portable WiFi hotspot from your android device and connect your laptop to that network. After that open a new terminal and write


You will see your IP address in wlan tab as

inet addr:YOUR-IP

Now enter this IP address as http://YOUR-IP:11311/ in the app and start the app.

To verify the topics, try

rostopic list
Somewhere in the list of topics you will see /android/fix and /android/imu. You can analyze how the accelerometer data chances with change in your phone orientation by
rostopic echo /android/imu
After this download the [sparkV_android]( "SparkV_android github") and [sparkV_msg]( "sparkV_msg Github") package and make them. **Published topics:** motor ([sparkV_msg/velocity](/ros-and-sparkv#velocity)):

Sends velocity commands to SparkV robot.

**Subscribed topics:** android/imu ([sensor_msgs/Imu](

accelerometer data is published on this topic.

### Usage: After connecting the android device and sparkV robot run
rosrun rosserial_python /dev/ttyUSB0
rosrun sparkV_android android
NOTE: You might have to edit android.cpp depending on your accelerometer data from phone. See the video below how it works!.