ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

corvin_zhang's profile - activity

2017-07-03 07:11:56 -0500 received badge  Popular Question (source)
2017-07-03 07:11:56 -0500 received badge  Notable Question (source)
2016-11-28 21:59:33 -0500 received badge  Supporter (source)
2016-09-27 00:42:06 -0500 asked a question android app get arduino sensor data error

hi all, I connected the light sensors, temperature and humidity sensors on arduino board,then by modifying the android_tutorial_pubsub android_core code, want to get to the sensor data on android.But can't work. when i run roswtf, the output below:

corvin@workspace:~$ roswtf
Loaded plugin tf.tfwtf

    No package or stack in context
   ================================================================================
    Static checks summary:

No errors or warnings
================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...

  ... done analyzing graph

running graph rules...
ERROR: connection refused to [http://192.168.20.77:35954/]
... done running graph rules

Online checks summary:

 Found 1 warning(s).

Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /rqt_gui_py_node_31453:
   * /statistics
  Found 2 error(s).

ERROR Could not contact the following nodes:
 * /rosjava_tutorial_pubsub/talker

ERROR The following nodes should be connected but aren't:
 * /serial_node->/android_gingerbread/ros_text_view (/lightValue)

my source code is: I only commet this line:

nodeMainExecutor.execute(talker, nodeConfiguration);

package org.ros.android.android_tutorial_pubsub;

import android.os.Bundle;
import org.ros.android.MessageCallable;
import org.ros.android.RosActivity;
import org.ros.android.view.RosTextView;

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

/**
 * @author damonkohler@google.com (Damon Kohler)
 */
public class MainActivity extends RosActivity {

  private RosTextView<std_msgs.String> rosTextView;
  private Talker talker;

  public MainActivity() {
    // The RosActivity constructor configures the notification title and ticker messages.
    super("Pubsub Tutorial", "Pubsub Tutorial");
  }

  @SuppressWarnings("unchecked")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    rosTextView = (RosTextView<std_msgs.String>) findViewById(R.id.text);
    rosTextView.setTopicName("/lightValue");
    rosTextView.setMessageType(std_msgs.String._TYPE);
    rosTextView.setMessageToStringCallable(new MessageCallable<String, std_msgs.String>() {
      @Override
      public String call(std_msgs.String message) {
        return message.getData();
      }
    });
  }

  @Override
  protected void init(NodeMainExecutor nodeMainExecutor) {
  talker = new Talker();

  // 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.
  // The user can easily use the selected ROS Hostname in the master chooser
  // activity.
  NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getRosHostname());
  nodeConfiguration.setMasterUri(getMasterUri());
  //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);
  }
}
enter code here