Skip to content

Using ROSJava with Tango Vio and Depth Data

shilohc edited this page Sep 18, 2014 · 5 revisions

This page is rather miscellaneous in nature. It contains information about which apps and launch files to run for vio/depth data, differences between the Peanut (phone) and Yellowstone (tablet) APIs, and ROSJava tips. At the time of this writing (9/18/2014), this information applies to the yellowstone branch.

This page will probably not be of much use until you've completed the following:

Table of Contents

Apps to Publish Vio and Depth Data on Peanut and Yellowstone

The Tango Vio app can be used on both Peanut (Tango phone) and Yellowstone (Tango tablet) to publish vio data. ROSTango Build and Running Instructions provides instructions for running this app from Android Studio. On Peanut, this app will provide vio data only. On Yellowstone, it will also publish depth data as a sensor_msgs/PointCloud2 on the /camera/depth/points topic. It's possible to edit the app's source code (TangoVio.java) to publish vio data only on Yellowstone by declaring and initializing mVioNode as a VioNode instead of a VioDepthNode.

On Peanut, the Tango Depthimage app will publish depth data as a sensor_msgs/Image on the /camera/depth/image_raw topic. This app is not Yellowstone-compatible.

Viewing Vio and Depth Data in RViz

ROSTango Build and Running Instructions describes how to view vio data alone on both Peanut and Yellowstone.

To view depth data alone on Peanut, run tango_depth.launch. Currently, no Peanut app publishes both depth and vio data.

To view both vio and depth data on Yellowstone, run tango_vio_depth_ys.launch.

Accessing Vio and Depth Data using the Tango APIs

The Tango phone (Peanut) and tablet (Yellowstone) have two very different APIs with different ways of accessing vio and depth data.

On Peanut, vio data is accessed through a VinsServiceHelper, and depth data is accessed using a SuperFrame containing a depth image.

On Yellowstone, a TangoUpdateListener can be used to update both vio and depth data. It's also possible to use the Tango object's getPoseAtTime() method to update vio data, but there is no equivalent method for accessing depth data. Depth data is returned as a PointCloud containing (x, y, z) points. The returned x, y, and z values are measured in meters.

Helpful Project Tango sample code (Yellowstone-only):

ROSJava Tips

The sensor_msgs/PointCloud2 message type contains an is_bigendian field, but rviz doesn't display big-endian depth data correctly even when this field is set to true. Since the Java Virtual Machine is big-endian, it's important to be careful of endianness when publishing depth data with ROSJava.

In the PointCloud2 message, there's also a field named fields, an array of sensor_msgs/PointField messages, that contains information about how to read the data in the message. If fields is not set correctly, the message will be misread, producing incorrect depth data.

When facing baffling errors publishing PointCloud2 messages, it's sometimes helpful to check the publisher code against the source code of the point_cloud_converter, to make sure fields like point_step and row_step are set correctly.

Those unfamiliar with ROSJava might want to read through the highly useful Getting Started documentation page, which is a good introduction.

Further Helpful Links