beltransen / velo2cam_gazebo

Repository including Gazebo models, plugins and worlds to test calibration algorithms for Lidar-camera setups.
http://wiki.ros.org/velo2cam_gazebo
GNU General Public License v2.0
141 stars 41 forks source link

How to record simulated data #6

Closed BorisLerouxFox closed 6 years ago

BorisLerouxFox commented 6 years ago

Dear everyone, Impressive works, thanks for sharing. I'm a newbie at Gazebo and ROS and I don't know how to record simulated data in readable files like LAS/ASCII point cloud for Velodyne and JPG/TIF images for the stereo camera. I have already try : rostopic echo /velodyne_points > test.txt and also : rosbag record -O subset /velodyne_points But, both of this files are not easily readable for me, so can you explain me how to export it in the right format ? Please let me know Chears Boris

beltransen commented 6 years ago

Hi Boris, I think there is no straightforward method to record ROS messages in the format you want. The easiest way should be to create a ROS node that listens to the LiDAR and camera messages and save them in the desired file format. Here you can find the ROS tutorial to write a C++ subscriber, and here you can find the Python version.

Hope this helps, Jorge

BorisLerouxFox commented 6 years ago

I have found a way to do it, Just record the /velodyne_point topic in a bag file : rosbag record -O velodyne /velodyne_points Then convert the bag PointCloud2 message to PCL .pcd format : rosrun pcl_ros bag_to_pcd velodyne.bag /velodyne_points ./pointscloud Then convert binary .pcd file into ASCII .pcd files : `pcl_conver_ascii_binary .pcd *_ascii.pcd ascii` In attachment, you will find a snapshot of the pointcloud opened in CloudCompare test_calib

I will also try your solution, thanks for your help. Best regards Boris

beltransen commented 6 years ago

Glad to hear that you found a solution. Thanks for sharing your approach. I'll close the issue then.

Regards, Jorge