@SuppressWarnings("unchecked")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    //		rosTextView = (RosTextView<test_rospy.ArrayVal>) findViewById(R.id.text);
    //		rosTextView.setTopicName("chatter");
    //		rosTextView.setMessageType(test_rospy.ArrayVal._TYPE);
    //		rosTextView.setMessageToStringCallable(new MessageCallable<String, test_rospy.ArrayVal>() {
    //			@Override
    //			public String call(test_rospy.ArrayVal message) {
    //				System.out.println("Got message " + message.toString());
    //				return message.toString();
    //			}
    //		});

    rosTextView = (RosTextView<tf.tfMessage>) findViewById(R.id.text);
    rosTextView.setTopicName("tf");
    rosTextView.setMessageType(tf.tfMessage._TYPE);
    rosTextView.setMessageToStringCallable(
        new MessageCallable<String, tf.tfMessage>() {
          @Override
          public String call(tf.tfMessage message) {
            System.out.println("Got message " + message.toString());
            for (TransformStamped t : message.getTransforms()) {
              System.out.println(t.toString());
            }
            return message.toString();
          }
        });
  }
예제 #2
0
  public void onCreate(Bundle savedInstance) {
    super.onCreate(savedInstance);
    setContentView(R.layout.main2);
    gyroOrientation[0] = 0.0f;
    gyroOrientation[1] = 0.0f;
    gyroOrientation[2] = 0.0f;

    // initialise gyroMatrix with identity matrix
    gyroMatrix[0] = 1.0f;
    gyroMatrix[1] = 0.0f;
    gyroMatrix[2] = 0.0f;
    gyroMatrix[3] = 0.0f;
    gyroMatrix[4] = 1.0f;
    gyroMatrix[5] = 0.0f;
    gyroMatrix[6] = 0.0f;
    gyroMatrix[7] = 0.0f;
    gyroMatrix[8] = 1.0f;
  }
예제 #3
0
 protected void onResume() {
   super.onResume();
   // get sensorManager and initialise sensor listeners
   mSensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE);
   initListeners();
 }