Using Kitti Dataset with ROS and Visualizing the Obtained Map with RViZ

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Kitti Dataset with ROS and Visualizing the Obtained Map with RViZ

robotomato

Hi, I am working with the KITTI dataset to test mapping using only one RGB camera with ROS. Unfortunately, I can't see the map cloud on RViZ even if I click the download button. (Note: I've downloaded rtabmap_ros package from github and built it with catkin_make. I've build rtabmap software from source)

$ rtabmap --version
RTAB-Map:               0.21.0
PCL:                    1.10.0
With VTK:                7.1.1
OpenCV:                  4.2.0
With OpenCV xfeatures2d:  true
With OpenCV nonfree:      true
With ORB OcTree:          true
With SuperPoint Torch:   false
With Python3:            false
With FastCV:             false
With OpenGV:             false
With Madgwick:            true
With PDAL:               false
With TORO:                true
With g2o:                 true
With GTSAM:               true
With Vertigo:             true
With CVSBA:              false
With Ceres:               true
With OpenNI2:             true
With Freenect:            true
With Freenect2:          false
With K4W2:               false
With K4A:                false
With DC1394:              true
With FlyCapture2:        false
With ZED:                false
With ZED Open Capture:   false
With RealSense:          false
With RealSense SLAM:     false
With RealSense2:         false
With MYNT EYE S:         false
With DepthAI:            false
With libpointmatcher:    false
With CCCoreLib:          false
With octomap:             true
With cpu-tsdf:           false
With open chisel:        false
With Alice Vision:       false
With LOAM:               false
With FLOAM:              false
With FOVIS:              false
With Viso2:              false
With DVO:                false
With ORB_SLAM:           false
With OKVIS:              false
With MSCKF_VIO:          false
With VINS-Fusion:        false
With OpenVINS:           false

Converting KITTI Dataset to Bag File

Using terminal to obtain the bag file:

$ wget https://s3.eu-central-1.amazonaws.com/avg-kitti/raw_data/2011_10_03_drive_0027/2011_10_03_drive_0027_sync.zip
$ wget https://s3.eu-central-1.amazonaws.com/avg-kitti/raw_data/2011_10_03_calib.zip
$ unzip 2011_10_03_drive_0027_sync.zip
$ unzip 2011_10_03_drive_calib.zip
$ # Changing image timestamps by using the same timestamp.txt file for each image folder
$ cp 2011_10_03/2011_10_03_drive_0027_sync/image_00/timestamps.txt 2011_10_03/2011_10_03_drive_0027_sync/image_01
$ cp 2011_10_03/2011_10_03_drive_0027_sync/image_00/timestamps.txt 2011_10_03/2011_10_03_drive_0027_sync/image_02
$ cp 2011_10_03/2011_10_03_drive_0027_sync/image_00/timestamps.txt 2011_10_03/2011_10_03_drive_0027_sync/image_03
$ # using kitti2bag to obtain the bag file
$ python __main__.py -t 2011_10_03 -r 0027 raw_synced .
Exporting static transformations
Exporting time dependent transformations
Exporting IMU
Exporting camera 0
100% (4544 of 4544) |##################################################################################################################################| Elapsed Time: 0:03:01 Time:  0:03:01
Exporting camera 1
100% (4544 of 4544) |##################################################################################################################################| Elapsed Time: 0:03:37 Time:  0:03:37
Exporting camera 2
100% (4544 of 4544) |##################################################################################################################################| Elapsed Time: 0:05:22 Time:  0:05:22
Exporting camera 3
100% (4544 of 4544) |##################################################################################################################################| Elapsed Time: 0:05:48 Time:  0:05:48
Exporting velodyne data
100% (4544 of 4544) |##################################################################################################################################| Elapsed Time: 0:16:49 Time:  0:16:49
## OVERVIEW ##
path:        kitti_2011_10_03_drive_0027_synced.bag
version:     2.0
duration:    7:50s (470s)
start:       Oct 03 2011 12:55:34.00 (1317642935.00)
end:         Oct 03 2011 13:03:25.83 (1317643405.83)
size:        24.0 GB
messages:    63616
compression: none [18184/18184 chunks]
types:
geometry_msgs/TwistStamped [98d34b0043a2093cf9d9345ab6eef12e]
sensor_msgs/CameraInfo     [c9a58c1b0b154e0e6da7578cb991d214]
sensor_msgs/Image          [060021388200f6f0f447d0fcd9c64743]
sensor_msgs/Imu            [6a62c6daae103f4ff57a132d6f95cec2]
sensor_msgs/NavSatFix      [2d3a8cd499b9b4a0249fb98fd05cfa48]
sensor_msgs/PointCloud2    [1158d486dd51d683ce2f1be655c3c181]
tf2_msgs/TFMessage         [94810edda583a504dfda3829e70d7eec]
topics:
/kitti/camera_color_left/camera_info    4544 msgs    : sensor_msgs/CameraInfo
/kitti/camera_color_left/image_raw      4544 msgs    : sensor_msgs/Image
/kitti/camera_color_right/camera_info   4544 msgs    : sensor_msgs/CameraInfo
/kitti/camera_color_right/image_raw     4544 msgs    : sensor_msgs/Image
/kitti/camera_gray_left/camera_info     4544 msgs    : sensor_msgs/CameraInfo
/kitti/camera_gray_left/image_raw       4544 msgs    : sensor_msgs/Image
/kitti/camera_gray_right/camera_info    4544 msgs    : sensor_msgs/CameraInfo
/kitti/camera_gray_right/image_raw      4544 msgs    : sensor_msgs/Image
/kitti/oxts/gps/fix                     4544 msgs    : sensor_msgs/NavSatFix
/kitti/oxts/gps/vel                     4544 msgs    : geometry_msgs/TwistStamped
/kitti/oxts/imu                         4544 msgs    : sensor_msgs/Imu
/kitti/velo/pointcloud                  4544 msgs    : sensor_msgs/PointCloud2
/tf                                     4544 msgs    : tf2_msgs/TFMessage
/tf_static                              4544 msgs    : tf2_msgs/TFMessage

Because this bag file is 24 GB in size, I am unable to share it .

Launch file

This launch is based on this sample launch file

<?xml version="1.0" encoding="UTF-8"?>

<launch>
    <arg name="is_built_from_source" default="true" />
    <arg name="frame_id" default="base_frame" />
    <arg name="fixed_frame_id" default="world" />

    <arg name="rosbag_file_name"
        default="kitti_2011_10_03_drive_0027_synced" />

    <arg if="$(arg is_built_from_source)" name="mapping_pkg" value="slam" />
    <arg unless="$(arg is_built_from_source)" name="mapping_pkg" value="ros" />
    <arg if="$(arg is_built_from_source)" name="viz_pkg" value="viz" />
    <arg unless="$(arg is_built_from_source)" name="viz_pkg" value="ros" />
    <arg if="$(arg is_built_from_source)" name="sub_viz_pkg" value="_viz" />
    <arg unless="$(arg is_built_from_source)" name="sub_viz_pkg" value="viz" />

    <arg if="$(arg is_built_from_source)" name="rgbd_config"
        value="$(find rtabmap_demos)/launch/config/rgbd_gui.ini" />
    <arg unless="$(arg is_built_from_source)" name="rgbd_config"
        value="$(find rtabmap_ros)/launch/config/rgbd_gui.ini" />


    <arg name="database_path" default="rtabmap.db" />

    <!-- catkin_ws/src/kitti_test/scripts/kitti_2011_10_03_drive_0027_synced.bag -->
    <!-- If the default terminal isn't gnome-terminal, change launch-prefix as "xterm -e" -->

    <node pkg="rosbag" type="play" name="rosbag_play"
        args="--pause $(find kitti_test)/scripts/$(arg rosbag_file_name).bag --clock"
        launch-prefix="gnome-terminal --">
        <param name="/use_sim_time" value="true" />
    </node>

    <!-- Arguments for launch file with defaults provided -->
    <arg name="depth_topic" default="/kitti/depth/image_raw" />
    <arg name="gps_topic" default="/kitti/oxts/gps/fix" />
    <arg name="imu_topic" default="/kitti/oxts/imu" />
    <arg name="lidar_topic" default="/kitti/velo/pointcloud" />
    <!-- The RGB camera on the left side is used for mapping-->
    <arg name="camera_id" default="2" />

    <arg name="camera_color_right_topic" default="/kitti/camera_color_right/image_raw" />
    <arg name="camera_color_left_topic" default="/kitti/camera_color_left/image_raw" />
    <arg name="camera_color_right_info_topic" default="/kitti/camera_color_right/camera_info" />
    <arg name="camera_color_left_info_topic" default="/kitti/camera_color_left/camera_info" />

    <arg name="camera_gray_right_topic" default="/kitti/camera_gray_right/image_raw" />
    <arg name="camera_gray_left_topic" default="/kitti/camera_gray_left/image_raw" />
    <arg name="camera_gray_right_info_topic" default="/kitti/camera_gray_right/camera_info" />
    <arg name="camera_gray_left_info_topic" default="/kitti/camera_gray_left/camera_info" />

    <arg if="$(eval arg('camera_id') == 3)" name="rgb_topic" value="$(arg camera_color_right_topic)" />
    <arg if="$(eval arg('camera_id') == 3)" name="camera_info_topic"
        value="$(arg camera_color_right_info_topic)" />

    <arg if="$(eval arg('camera_id') == 2)" name="rgb_topic" value="$(arg camera_color_left_topic)" />
    <arg if="$(eval arg('camera_id') == 2)" name="camera_info_topic"
        value="$(arg camera_color_left_info_topic)" />

    <arg if="$(eval arg('camera_id') == 1)" name="rgb_topic" value="$(arg camera_gray_right_topic)" />
    <arg if="$(eval arg('camera_id') == 1)" name="camera_info_topic"
        value="$(arg camera_gray_right_info_topic)" />

    <arg if="$(eval arg('camera_id') == 0)" name="rgb_topic" value="$(arg camera_gray_left_topic)" />
    <arg if="$(eval arg('camera_id') == 0)" name="camera_info_topic"
        value="$(arg camera_gray_left_info_topic)" />

    <!-- Point Cloud to Depth Image -->
    <node name="PC2Depth" pkg="rtabmap_util" type="pointcloud_to_depthimage"
        args="cloud:=$(arg
    lidar_topic) camera_info:=$(arg camera_info_topic) _fixed_frame_id:=$(arg fixed_frame_id)
    _decimation:=1 _wait_for_transform:=0.12 _fill_holes_size:=5">

        <remap from="image_raw" to="$(arg depth_topic)" />

    </node>

    <!-- Mapping -->
    <include file="$(find rtabmap_ros)/launch/rtabmap.launch">
        <arg name="frame_id" value="base_link" />
        <arg name="subscribe_scan_cloud" value="true" />
        <arg name="scan_cloud_max_points" value="130000" /> <!-- Velodyne HDL-64E -->

        <arg name="rgb_topic" value="$(arg rgb_topic)" />
        <arg name="depth_topic" value="$(arg depth_topic)" />
        <arg name="camera_info_topic" value="$(arg camera_info_topic)" />
        <arg name="scan_cloud_topic" value="$(arg lidar_topic)" />

        <arg name="rtabmapviz" value="true"/>
        <arg name="rviz" value="true"/>

        <!-- Icp parameters based on KITTI dataset -->
        <arg name="rtabmap_args"
            value="--approx_sync false --delete_db_on_start --Reg/Strategy 1 --Icp/MaxTranslation 0 --Icp/VoxelSize 0.3 --Icp/DownsamplingStep 10 --Icp/MaxCorrespondenceDistance 0.3 --Icp/Iterations 10 Icp/Epsilon 0.01 --Icp/CorrespondenceRatio 0.1 --Icp/PointToPlane true" />

        <!-- Default visual-only odometry, Icp ROS interface is not yet implemented-->
        <arg name="odom_args" value="--Reg/Strategy 0" />

    </include>

</launch>
Reply | Threaded
Open this post in threaded view
|

Re: Using Kitti Dataset with ROS and Visualizing the Obtained Map with RViZ

matlabbe
Administrator
Are there warnings in the terminal?

fixed_frame_id set to "world"? What is "world" frame?

Instead of using pointcloud_to_depthimage, you may use these parameters directly for rtabmap.launch. Set subscribe_depth=false, then rtabmap will subscribe to single RGB + camera_info + scan_cloud.

Related post: http://official-rtab-map-forum.206.s1.nabble.com/Multi-monocular-cameras-tp9383p9396.html

cheers,
Mathieu