introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.75k stars 785 forks source link

Interfacing and viewing ROS RTAB map on android? #428

Open GrantDare opened 5 years ago

GrantDare commented 5 years ago

Hi Team,

I am doing a project where I am using the RTAB map algorithm with ROS to produce a 3D map and am using a custom android application to interface with the robot. We are using ROSJava to connect to the robot and so can access the PointCloud2 topics. I am requiring a way to view the resulting RTAB map on android based on the ROS output. I see there is an RTABMap application for the Tango however I was wondering if there was a way to leverage just the viewer from the application?

Thanks team for any assistance you can provide me :)

matlabbe commented 5 years ago

The android app doesn't use ROS and the visualization is done in cpp (jni). See RTABMapApp::Render() for the main rendering loop. This is where we process rtabmap events, creating clouds and updating the graph. On Java side, it is simply a GLSurfaceView view, for which we do the rendering on jni side. It would be easier if you receive the PointCloud2 on jni side already (is ROSJava using jni under the hood for subscriber and publisher?), so there is no conversion between java and cpp. For the cpp side, the app follows mainly the c++ example here: https://github.com/introlab/rtabmap/wiki/Cplusplus-RGBD-Mapping

cheers, Mathieu

GrantDare commented 5 years ago

Thanks @matlabbe,

I am not the android developer so I have passed your feedback to him to assess the applicability. I have found a point cloud android viewer. Is there a way to view the optimized map as a PointCloud2 message? I really appreciate your support :)

edit

I have checked out the Render method myself and I see that there are data structures passed from the tango mapping stage which it uses to generate the map, I was wondering if this data is available in the ROS messages? If so, Could I possibly extract all data from the existing ros messages and then call the render method and display it in a GLSurfaceViewer?

matlabbe commented 5 years ago

I am not sure what is the application, but the code I referred is to do SLAM directly in the android app. If rtabmap can be started independently of the android UI (so like a standard ROS node), you could subscribe to /rtabmap/cloud_map (sensor_msgs/PointCloud2) topic generated from rtabmap to see the map. http://wiki.ros.org/android_pointcloud_viewer may be then used directly.