0
$\begingroup$

Rosanswers logo

Hey!

I am currently following this tutorial on my turtlebot: http://wiki.ros.org/rtabmap_ros#Nodes

Therefore I started turtlebot and rviz like this:

$ roslaunch turtlebot_bringup minimal.launch
$ roslaunch rtabmap_ros demo_turtlebot_mapping.launch
$ roslaunch rtabmap_ros demo_turtlebot_rviz.launch

It all works fine but I don't know how to export the point cloud I created. My goal is to have a list of XYZ coordinates from all points. Anyone got any ideas?

EDIT:

I tried to run

rosservice call /rtabmap/get_map 1 0 0

but that does nothing... and when I click the get map option in RVIZ it is first trying to call get_map and then I get the error: screenshot rviz

rtab/get_map is in the namespace though. Here is part of my rosservice list:

/rtabmap/backup
/rtabmap/cancel_goal
/rtabmap/get_grid_map
/rtabmap/get_map
/rtabmap/get_proj_map
/rtabmap/list_labels
/rtabmap/octomap_binary
/rtabmap/octomap_full
/rtabmap/pause
/rtabmap/publish_map
/rtabmap/reset
/rtabmap/resume
/rtabmap/rtabmap/get_loggers
/rtabmap/rtabmap/set_logger_level
/rtabmap/set_goal
/rtabmap/set_label
/rtabmap/set_mode_localization
/rtabmap/set_mode_mapping
/rtabmap/trigger_new_map
/rtabmap/update_parameters
/rviz/get_loggers
/rviz/reload_shaders
/rviz/set_logger_level
/turtlebot/invite
/turtlebot/list_rapps
/turtlebot/platform_info
/turtlebot/start_rapp
/turtlebot/stop_rapp
/turtlebot_laptop_battery/get_loggers
/turtlebot_laptop_battery/set_logger_level

Originally posted by Salocin808 on ROS Answers with karma: 33 on 2015-08-05

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You can subscribe to /rtabmap/cloud_map topic to get the point cloud.

$ rosrun pcl_ros pointcloud_to_pcd input:=rtabmap/cloud_map
$ pcl_viewer ###.pcd  

If the mapping is paused, you can force rtabmap to publish the map again:

$ rosrun pcl_ros pointcloud_to_pcd input:=rtabmap/cloud_map
$ rosservice call /rtabmap/publish_map 1 1 0
$ pcl_viewer ###.pcd  

For the get_map service error, I can't reproduce the problem with RVIZ (the clouds are correctly downloaded and shown). If you call it from terminal, you would see a lot of numbers printed. Note that I tested with rtabmap_ros 0.10.4 (binaries on Indigo have just been released).

EDIT

To have the point cloud in PLY format (to open it in MeshLab or any other 3D programs), you can use pcd2ply tool from PCL:

$ pcl_pcd2ply ###.pcd output.ply

Originally posted by matlabbe with karma: 6409 on 2015-08-05

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by Salocin808 on 2015-08-06:
Thank you very much for your help! I am definately closer to where I want to be now. pcl_ros was a good tip. I can generate the .pcd files now but I want to have the coordinates with RGB values. So I figured, I could just convert it back with pcd_to_pointcloud. After these lines nothing's happening:

Comment by Salocin808 on 2015-08-06:
salocin@salocin-laptop:~$ rosrun pcl_ros pcd_to_pointcloud ~/1438846855801553.pcd [ INFO] [1438848137.530670782]: Publishing data on topic /cloud_pcd with frame_id /base_link. [ INFO] [1438848137.542530309]: Loaded a point cloud with 1670 points (total size is 26720) and the following channels: x y

Comment by matlabbe on 2015-08-06:
The PCD already contains RGB values. In pcl_viewer, you have to press "6" or "5" to see the RGB point cloud. The other keys "1", "2"... show different overlays (similar to that video).

Comment by Salocin808 on 2015-08-06:
Oh ok perfect. I have one more question: when opening the file, I get X Y Z RGB values for the points. But the RGB values are float. The representation looks like this: 1.8005456 -0.7766516 -0.0509897 4.8842062e-39 The fourth number should be RGB but how? Can I get values for the three channels?

Comment by matlabbe on 2015-08-06:
PCD format documentation here. In your case, the RGB field is a float 4 bytes (A-R-G-B). 4.8842062e-39=0x00352f2e -> RGB hex code=352F2E which is R=53 G=47 B=46 on decimal 0->255

Comment by Salocin808 on 2015-08-06:
Ok thank you very much, it has been very helpful!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.