Ask Your Question

ROSActivity shutting down upon launching MasterChooser [closed]

asked 2012-11-27 12:50:28 -0500

updated 2014-01-28 17:14:24 -0500

ngrennan gravatar image

Hi I've been on this one for a while.

using the android_tutorial_pubsub as a guide I've adjusted it to run my own NodeMains. They initially ran well with feeds showing up in LOGCAT every time they failed to connect to my ROS_MASTER (separate issue). However afterward, eclipse drastically changed after updating, and after much frustration, i'm back to the command line environment.

During this time, my NodeMains are failing to run, as I start my program, the MasterChooser interface runs with a toast "Tutorial_PubSub" Shutting down. Even going back to the unchanged tutorial code this issue is happening.

Using some util.log messages, ive realised this issue belongs inside ROSActivity as the log messages don't even get called. Perhaps I'm missing something from the AndroidManifest file.

Heres my code (Please disregard my newPrivate() on the NodeConfiguration it doesn't change anyting.



import android.os.Bundle;
import android.util.Log;

import org.ros.address.InetAddressFactory;
import org.ros.node.NodeConfiguration;
import org.ros.node.NodeMainExecutor;
import org.ros.rosjava_tutorial_pubsub.Talker;

 * @author (Damon Kohler)
public class MainActivity extends RosActivity {

  private RosTextView<std_msgs.String> rosTextView;
  private controller_node controlnode;

  private Talker talker;

  public MainActivity() {
    // The RosActivity constructor configures the notification title and ticker
    // messages.

     super("HMMController", "HMMController");
     Log.d("Main Activity", "In init nodemain executer method");

  public void onCreate(Bundle savedInstanceState) {
    rosTextView = (RosTextView<std_msgs.String>) findViewById(;
    rosTextView.setMessageToStringCallable(new MessageCallable<String, std_msgs.String>() {
     public String call(std_msgs.String message) {
        return message.getData();

  protected void init(NodeMainExecutor nodeMainExecutor) {
    controlnode = new controller_node();
    talker = new Talker();
    Log.d("Main Activity", "In init nodemain executer method");
    //RosTextView= new rosTextView();
    //URI master_uri=null;

        //master_uri = new URI("");

    NodeConfiguration nodeConfiguration = NodeConfiguration.newPrivate();
   // NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress().toString());
    // At this point, the user has already been prompted to either enter the URI
    // of a master to use or to start a master locally.
    //nodeMainExecutor.execute(controlnode, nodeConfiguration);
    nodeMainExecutor.execute(talker, nodeConfiguration);
    // The RosTextView is also a NodeMain that must be executed in order to
    // start displaying incoming messages.
    nodeMainExecutor.execute(rosTextView, nodeConfiguration);

and here is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />


        android:label="@string/app_name" >
            android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
        <activity android:name="" />

        <service android:name ...
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by PeterMilani
close date 2012-11-29 11:52:58

1 Answer

Sort by ยป oldest newest most voted

answered 2012-11-27 14:00:56 -0500

updated 2012-11-29 11:52:36 -0500

Well I turned off my developer debug settings on the android device and the applications worked! Can connect to a remote host etc. Now went back into developer settings and only enabled usb debugging so that the apps could be installed.

Now the settings I had on that appeared to conflict with the applications were: Stay awake -- Screen will never sleep while charging. Not sure why this would interfere with the application.

I guess as a start you should reset your developer settings if having this problem.

edit flag offensive delete link more

Question Tools


Asked: 2012-11-27 12:50:28 -0500

Seen: 924 times

Last updated: Nov 29 '12