MainActivity.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 Google Inc.
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00005  * use this file except in compliance with the License. You may obtain a copy of
00006  * the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
00013  * License for the specific language governing permissions and limitations under
00014  * the License.
00015  */
00016 
00017 package org.ros.android.android_tutorial_image_transport;
00018 
00019 import android.os.Bundle;
00020 import org.ros.address.InetAddressFactory;
00021 import org.ros.android.BitmapFromCompressedImage;
00022 import org.ros.android.RosActivity;
00023 import org.ros.android.view.RosImageView;
00024 import org.ros.node.NodeConfiguration;
00025 import org.ros.node.NodeMainExecutor;
00026 
00031 public class MainActivity extends RosActivity {
00032 
00033   private RosImageView<sensor_msgs.CompressedImage> image;
00034 
00035   public MainActivity() {
00036     super("ImageTransportTutorial", "ImageTransportTutorial");
00037   }
00038 
00039   @SuppressWarnings("unchecked")
00040   @Override
00041   public void onCreate(Bundle savedInstanceState) {
00042     super.onCreate(savedInstanceState);
00043     setContentView(R.layout.main);
00044     image = (RosImageView<sensor_msgs.CompressedImage>) findViewById(R.id.image);
00045     image.setTopicName("/usb_cam/image_raw/compressed");
00046     image.setMessageType(sensor_msgs.CompressedImage._TYPE);
00047     image.setMessageToBitmapCallable(new BitmapFromCompressedImage());
00048   }
00049 
00050   @Override
00051   protected void init(NodeMainExecutor nodeMainExecutor) {
00052     NodeConfiguration nodeConfiguration =
00053         NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress(),
00054             getMasterUri());
00055     nodeMainExecutor.execute(image, nodeConfiguration.setNodeName("android/video_view"));
00056   }
00057 }


android_core
Author(s): Damon Kohler
autogenerated on Thu Jun 6 2019 21:20:07