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

rosjava image_transport example failing

asked 2011-05-23 18:11:56 -0600

Link gravatar image

updated 2011-05-27 17:48:57 -0600

I am planning to write a simple app to view the image my robot it will subscribe to the image via a wireless connection to my android phone (not a wifi tether). I started by running the image_transport example on my phone using the eclipse debugger. I run a bag file on my Ubuntu laptop which publishes the camera/image_raw message and am able to view on another ubuntu pc by setting the ROS_MASTER_URI, however I am unable to view this on my android device connected to the same network running the image_transport example.

The test is using the latest version of the image_transport found at https://rosjava.googlecode.com/hg/and... . I changed the following lines in the MainActivity.java example file:

  @SuppressWarnings("unchecked")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    RosImageView<CompressedImage> image = (RosImageView<CompressedImage>) findViewById(R.id.image);
    image.setTopicName("/camera/image_raw");
    image.setMessageClass(org.ros.message.sensor_msgs.CompressedImage.class);
    image.setMessageToBitmapCallable(new BitmapFromCompressedImage());
    try {
      // TODO(damonkohler): The master needs to be set via some sort of
      // NodeConfiguration builder.
      nodeRunner.run(image,
          Lists.newArrayList("Compressed", "__ip:=192.168.1.100", "__master:=http://192.168.1.123:11311/"));
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

No errors are reported, and the app pops up on the phone, but no image is displayed. The image in the message (sensor_msgs/Image) is black and white and 320x260.

I filtered logcat for image_transport during one of the attempts:

I/ActivityManager( 173): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.ros.tutorials.image_transport/.MainActivity } from pid 270 I/ActivityManager( 173): Displayed org.ros.tutorials.image_transport/.MainActivity: +289ms (total +1s717ms)

Is there anything that I could be doing wrong?

Tested on:

Motorola Droid OS: Android 2.3 (cyanogen mod 7.0.3)

HTC Incredible OS: Android 2.3 (cyanogen mod 7.0.3)

Laptops running ubuntu 10.4 and 10.10 with diamondback installed

:: UPDATE In a second attempt I changed the message to /camera/image_raw/compressed and the image still would not show up, which seem to be unrelated to the change to the message.

in logcat there is an error: the E/UpdatePublisherRunnable( 2697): java.lang.RuntimeException: java.net.UnknownHostException: ubuntu-laptop

roswtf shows that the imagetransport node created by the phone should be connected but isn't.

Are there any specific network settings that are needed? I added the laptop I was connecting to the host file of the android device.

edit retag flag offensive close merge delete

Comments

Do you see any errors on your Ubuntu system? What is the message type of your /camera/image_raw topic in the bagfile?
Eric Perko gravatar image Eric Perko  ( 2011-05-23 22:55:45 -0600 )edit
And does anything show up in logcat?
kwc gravatar image kwc  ( 2011-05-24 05:11:16 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2011-06-06 04:17:51 -0600

damonkohler gravatar image

I think you should try setting the ROS_IP environment variable on your laptop. It sounds like the phone is having trouble finding the laptop by hostname.

edit flag offensive delete link more
1

answered 2011-05-24 19:06:55 -0600

Eric Perko gravatar image

updated 2011-05-24 19:07:25 -0600

I had a similar issue at first. The image_transport example does not automatically subscribe to the compressed image topic, as normal image_transport does.

Change the topic you are subscribing to to one that has a type sensor_msgs/CompressedImage such as /camera/image_raw/compressed and then it should work.

edit flag offensive delete link more

Comments

In a second attempt I changed the message to /camera/image_raw/compressed and still had some problems viewing the image:
Link gravatar image Link  ( 2011-05-27 17:42:26 -0600 )edit

Question Tools

Stats

Asked: 2011-05-23 18:11:56 -0600

Seen: 1,639 times

Last updated: Jun 06 '11