Rosjava image_transport tutorial - no image display on android tablet despite successful compilation
Hi,
I am trying out the rosjava image_transport tutorial by importing it as an android project in Eclipse and port it to a Motorola Xoom.
To get the sample code to compile, I have modified it slightly (see code fragment below) and also delete the line in main.xml that contains the android:src=”@drawable/” as it could not be resolved.
Problem:
Image is not displayed although checks show that the node is connected to host PC roscore (rxgraph shows android node and shows that it subscribes to /camera/image/compressed for the correct message sensor_msgs/CompressedImage)
I have tried to call a similar subscriber node - code from ( http://www.ros.org/wiki/image_transpo... ) on my PC and I can retrieve a static image. I look through the code for this node and it required OpenCV to display the image through the bridge class.
For the Xoom, I guess I just miss one line of code that call the image to display on the Xoom. I look through the RosImageView class and I guess the line image.setMessageToBitmapCallable(new BitmapFromCompressedImage()); will serve a similar function.
However, no image is shown on the Xoom.
Could any one offer help on this please?
Please refer to the code fragment below and my configuration.
... public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//1. Initialise connection to host PC here
try {
//2.1 First manually set the URI & port of MASTER node (the node that contains roscore)
java.net.URI master_uri = new java.net.URI("http://129.31.193.253:11311");
//2.2 Assign the configuration to the tablet with its own address so that roscore can talk back to
nodeConfiguration = NodeConfiguration.newPublic("129.31.202.25",master_uri);
//2.3 Add the master URI & port set up in 2.1 to the configuration
nodeConfiguration.setMasterUri(master_uri);
} catch (Exception e) {
throw new RuntimeException(e);
}
//retrieving the image from host
image = (RosImageView<compressedimage>) findViewById(R.id.image_);
image.setTopicName("/camera/image/compressed");
image.setMessageType("sensor_msgs/CompressedImage");
image.setMessageToBitmapCallable(new BitmapFromCompressedImage());
// startActivityForResult(new Intent(this, MasterChooser.class), 0); // comment because causing forced close
try{
nodeRunner.run(image,nodeConfiguration);
}
catch(Exception e){
throw new RuntimeException(e);
}
}
…
My configuration is as follows:
Basic
Ubuntu 10.10
ROSDiamondback
Porting into a Motorola Xoom (wifi) – android API level 11 (but I compile at level 9)
Have already successfully tested RosjavaPubSub tutorial
ROS
Host PC running roscore
Host PC running image_transport publisher that publishes a static image - exactly the same code as the tutorial at