0
$\begingroup$

Rosanswers logo

Hi,

Im new to ROS and Android Programming and Java but I really would like to try out ROS on my Samsung Nexus-S.

I have been searching for information/tutorials on how to get it running, I have even intimidated googles with questions on Google+ to try to figure out what Im doing wrong,.

So I figured I would write down what I've done, and maybe someone can point out where I went wrong.

  • First. Im running Linux Ubuntu 11.04 on a VMWare fusion 3.1.3 on my MAC OSX 10.6.8.

  • I downloaded ros diamond back (the natty one) from ros.org and followed the installation guide at: http://www.ros.org/wiki/diamondback/Installation/Ubuntu. No problem here except that apt-get didn't find any configuration called: "ros-diamondback-desktop-full" so I used "ros-diamondback-desktop"

  • I ran through a few of the tutorials did some rosmake, roscd, rosls, rosrun etc.. worked fine.

  • The downloaded Eclipse from here http://www.eclipse.org/downloads/ (I took the one for C++ and Linux) and tried to debug an step through the C++ tutorials from ROS. THat worked fine to.

  • I then downloaded Android SDK from here: http://developer.android.com/sdk/installing.html. and the ADT plugin for eclipse.

  • I followed the Hello World tutorial, just to make sure I was http://developer.android.com/resources/tutorials/hello-world.html able to get an app running on my phone.

  • First my phone wouldn't show up in my Linux running in Fusion, to fix that I had to modify the vmware config file. (located in the MAC file directory where I store my Virtual Machines.) The file does't show up in the Finder, but in a Terminal I did:

    $ vi Ubuntu.vmwarevm/Ubuntu.vmx (my virtual machine is called Ubuntu)

In that file I added:

usb.quirks.device0 = "0x18d1:0x4e22 skip-reset"

At the end. I found the uid and vid by doing a:

$ tail -f Ubuntu.vmwavevm/wmare.log

and when inserting the phone the vid and uid showed up.

  • So now I can build/download/debug the Hello World Andriod App.

  • Next I created a folder ~/ros and added this to my ~/.bashrc in Linux:

source /opt/ros/diamondback/setup.bash export ROS_PACKAGE_PATH=~/ros:$ROS_PACKAGE_PATH export PATH=~/andriod/android-sdk-linux_x86/tools:$PATH

  • Then I Googled for ROS Android and found: http://www.ros.org/wiki/android. I followed the directions on that page, and Installed SL4A and PY4A on my phone, but as I understand it now, I dont need anything of that. Python is the OLD way of running ROS on Android. What we want to do is run Java! (Actually I didn't get enythinhg work according to the this wiki).

  • Instead I found http://www.ros.org/wiki/rosjava and the Overview.

  • I read a bit and thought I needed ant to build stuff so I did a

    $ sudo apt-get install ant.

(Actually I think I did that before the Android SDK installation, im not sure I needed to do that step separate)

to be able to do that I first had to:

$ sudo apt-get install hg

  • Now I had a folder with code called rosjava_core. I did a:

$ rospack profile $ rospack list-names | grep java

and got a few hits on java, so it seems that the rosjava_core contains some ROS stuff.

  • The rosjava wiki talks a litte about how to build a package using the rosjava_core but I was hoping that there was some already made packages that I could try out.

  • I looked into the source tree and found a dierctory called android/tutorials and a script called create_projects.sh

  • I had to modify that script because I am running android-10 instead of android-9. I also changed all the AndroidManifest.xml files in the subfolders so that minSdkVersion="10"

  • When running the create_projects.sh I got the error messages: Error: Project folder '/home/mlangberg/ros/rosjava_core/android/library' is not a valid directory and I couldnt find any directory called "library" anywhere in the source tree.

  • I tried to do a rosmake in the tutorials folder and its subfolders, but the tutorials does not seem to be ROS, so instead i did:

$ ant (All that talk of ant dist, doesn't work for me, dist is an unknown target everywhere)

which failed because of that ../../library thing.

and that seemed to be a ROS Package that depend on rosjava that could be built using the description from the rosjava wiki, so I did:

$ rosmake android

  • I got all those problems with sdk.dir and com.android.ant.Setup. my solution was to edit the file rosjava_bootstrap/scripts/generate_properties.py and the section:

if is_android_package(package): props['sdk.dir'] = get_android_sdk_dir() # TODO: should be attribute of android export props['target']='android-10' props['android.library']='true'

( I changed from android.sdk.dir to sdk.dir and updated target to android-10)

  • Now I was able to rosmake the android package.

  • But I stil couldn't get the tutorials to build. Now I tried to move the android package down into the rosjava_core directory structure and rename it to library (The missing stuff one from above) so:

    $ rosls rosjava_core/android library tutorial

  • now I got further when doing a

$ ant debug (in the i.e pubsub tutorial folder)

But with about 100 errors.

  • So I tried a different approach, I imported the tutorial (pubsub) into eclipse using File->Import.. "Existing Projects into Workspace"

  • Then I also imported the rosjava as an existing project, and the android (now named library) the solved most of the errors in eclipse, the only thing left was that the AndroidManifest.xml file had a drawable/icon that couldn't be found, so I removed that

<application android:icon="@drawable/icon" android:label="@string/app_name"

Now the project was built, and I was able to download it to my phone and run it.

When I try to debug, the debugger takes me here (at new WebServer):

public NodeServer(BindAddress bindAddress, AdvertiseAddress advertiseAddress) {
    InetSocketAddress address = bindAddress.toInetSocketAddress();
    server = new WebServer(address.getPort(), address.getAddress());
    this.advertiseAddress = advertiseAddress;
    this.advertiseAddress.setPortCallable(new Callable() {
      @Override
      public Integer call() throws Exception {
        return server.getPort();
      }
    });
    startLatch = new CountDownLatch(1);
  }

And then I get an exception, and this is how far I come.

/Mike


Originally posted by Micke on ROS Answers with karma: 76 on 2011-07-19

Post score: 3

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Like a ROS and Android Virgin, I made it through the wilderness, some how I made it through,...

I now have the pubsub tutorial running on my Samsung,. thanks everyone


Originally posted by Micke with karma: 76 on 2011-07-20

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by elchan on 2015-03-04:
This whole thing is a little ridiculous. None of the tutorials will compile with indigo and Android Studio. Does ROS on Android really exist? I have over twenty years programming experience, and can not get any of the tutorials working and running on my android device.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.