Ask Your Question

How to check if the Pubsub tutorial is running correctly?

asked 2011-07-06 01:00:16 -0500

david gravatar image

updated 2011-07-06 06:16:20 -0500

mmwise gravatar image

Hi I'm trying to learn the following pubsub tutorial code fragment but apparently, is still not connecting to roscore running on pc yet. The program installs successfully but there is no sign of a successful roscore connection.


 * Copyright (C) 2011 Google Inc.
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.

package org.ros.tutorials.pubsub;

import org.ros.NodeConfiguration;
import org.ros.NodeRunner;
import org.ros.RosCore;
import org.ros.internal.node.address.InetAddressFactory;

import android.os.Bundle;
 * @author (Damon Kohler)

public class MainActivity extends Activity {

  private final NodeRunner nodeRunner;
  private RosCore rosCore;
  private RosTextView<org.ros.message.std_msgs.String> rosTextView;
  private Talker talker;

  public MainActivity() {
    nodeRunner = NodeRunner.createDefault();


  public void onCreate(Bundle savedInstanceState) {

    rosTextView = (RosTextView<org.ros.message.std_msgs.String>) findViewById(;
    rosTextView.setMessageToStringCallable(new MessageCallable<String, org.ros.message.std_msgs.String>() {
          public String call(org.ros.message.std_msgs.String message) {

  protected void onPause() {

  protected void onResume() {
    try {
      rosCore = RosCore.createPublic(11311);
      NodeConfiguration nodeConfiguration = NodeConfiguration.createDefault();
      nodeConfiguration.setHost(InetAddressFactory.createNonLoopback().getHostAddress());, nodeConfiguration);
      talker = new Talker();, nodeConfiguration);, nodeConfiguration);
    } catch (Exception e) {
      throw new RuntimeException(e);

/***********************End of Code*****************************/
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2011-09-02 10:58:03 -0500

kwc gravatar image

no activity in > 1 month, closing

edit flag offensive delete link more

answered 2011-07-06 04:30:59 -0500

fergs gravatar image

You might want to check this other question - rosjava(android) pubsub tutorial. In particular, it looks like you need to run ADB.

edit flag offensive delete link more

answered 2011-07-06 03:02:26 -0500

seanarm gravatar image

Running a roscore provides your system with a /rosout. After running your roscore, type 'rosnode list' to verify this. Your sample node should automatically to the roscore. To verify this, run your node, then run 'rxgraph'. See the line connecting your node and rosout? That means it's connected to the roscore.

Also, in roscpp, when you start a node you might get one of two messages: 1. "core service [/rosout] found" -- meaning the node found the roscore 2. "starting new master (master configured for auto start)" -- meaning a new roscore was started

edit flag offensive delete link more


In fact, I am trying to communicate between the android phone and the host pc. Running the roscore on the pc is not a problem; i'm trying to get android to come and communicate with the roscore on the pc. The concept is quite clear-- to make the android connect to the roscore on the pc, but couldn't implement it with the codes details
david gravatar image david  ( 2011-07-06 03:25:57 -0500 )edit

I have exactly the same problem. Did you find a solution in the end?

noe_vb gravatar image noe_vb  ( 2013-03-29 01:44:24 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-07-06 01:00:16 -0500

Seen: 1,504 times

Last updated: Sep 02 '11