-
Notifications
You must be signed in to change notification settings - Fork 41
Using ROSJava with Tango Vio and Depth Data
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:
- Apps to Publish Vio and Depth Data on Peanut and Yellowstone: Which one of the OLogic Tango apps to run, depending on your platform and what kind of data you'd like to publish.
- Viewing Vio and Depth Data in RViz: Which launch file to use, depending on your platform and what kind of data you're trying to view.
- Accessing Vio and Depth Data using the Tango APIs: Tips for reading Tango vio/depth data with both the Peanut and Yellowstone APIs, with links to sample code for Yellowstone.
- ROSJava Tips: Tips for using ROSJava to publish depth and vio data.
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.
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
.
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):
- Reading vio data: https://github.com/googlesamples/tango-examples-java/blob/master/MotionTrackingJava/src/com/projecttango/motiontrackingjava/MotionTracking.java
- Reading depth data: https://github.com/googlesamples/tango-examples-java/blob/master/PointCloudJava/src/com/projecttango/pointcloudjava/JPointCloud.java
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.
- http://wiki.ros.org/sensor_msgs: Links to documentation for all ROS depth image and point cloud message types.
- http://answers.ros.org/question/118701/displaying-a-point-cloud-in-rviz/, http://answers.ros.org/question/136376/send-pointcloud2-from-matlab-to-ros/: Example code for setting PointFields.
- http://www.ros.org/reps/rep-0103.html: ROS units and coordinate frame conventions.
- http://www.ros.org/reps/rep-0118.html: Description of depth image representations in ROS.