Re: Error when trying to run Rtabmap version ROS

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Error-when-trying-to-run-Rtabmap-version-ROS-tp179p368.html

Here is a minimal launch file. I removed the rtabmapviz part, to use only RVIZ. For convenience, I load the demo_robot_mapping.rviz configuration file for RVIZ (TF added, fixed_frame set to /map, MapCloud plugin loaded and the occupancy grid map is shown). To have an occupancy grid map, you need the grid_map_assembler node which subscribes to /rtabmap/mapData and publishes /rtabmap/grid_map (well in rtabmap latest source code, grid_map_assembler is not required as rtabmap publishes /grid_map already).

Note: I am not sure that you need to broadcast the TF between /base_link and /camera_link. Turtlebot should already publish the transform between /base_link and the kinect (/camera_link), so you can remove the static_transform_publisher below.

<launch>

  <!-- TF FRAMES -->
  <node pkg="tf" type="static_transform_publisher" name="base_to_camera_tf"
    args="0.0 0.0 0.0 0.0 0.0 0.0 /base_link /camera_link 100" />
    
  <group ns="rtabmap">

    <!-- rtabmap-->
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start">
      
      <param name="subscribe_depth" type="bool" value="true"/>
      <param name="subscribe_laserScan" type="bool" value="true"/>
      <param name="frame_id" type="string" value="base_link"/>

      <!-- Input topics -->
      <remap from="rgb/image" to="/camera/rgb/image_rect_color"/>
      <remap from="depth/image" to="/camera/depth_registered/image_raw"/>
      <remap from="rgb/camera_info" to="/camera/rgb/camera_info"/>
      <remap from="scan" to="/scan"/>
      <remap from="odom" to="/odom"/>
      
      <param name="RGBD/PoseScanMatching" type="string" value="true"/>
      <param name="RGBD/LocalLoopDetectionSpace" type="string" value="true"/>
      <param name="LccIcp/Type" type="string" value="2"/>     <!-- 2=ICP 2D -->
      <param name="LccBow/MinInliers" type="string" value="3"/>
      <param name="LccBow/InlierDistance" type="string" value="0.05"/>
      <param name="RGBD/AngularUpdate" type="string" value="0.01"/>
      <param name="RGBD/LinearUpdate" type="string" value="0.01"/>
      <param name="Rtabmap/TimeThr" type="string" value="700"/>
      <param name="Mem/RehearsalSimilarity" type="string" value="0.45"/>
      <param name="RGBD/OptimizeFromGraphEnd" type="string" value="false"/>
      <param name="Kp/MaxDepth" type="string" value="4.0"/>
      <param name="LccIcp2/CorrespondenceRatio" type="string" value="0.5"/>
    </node>

    <!-- Grid map assembler for rviz -->
    <node pkg="rtabmap_ros" type="grid_map_assembler" name="grid_map_assembler"/>

  </group>

  <!-- RVIZ -->
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find rtabmap_ros)/launch/config/demo_robot_mapping.rviz" output="screen"/>
</launch>


>I have a doubt in the last topic , i d'ont know if what i did in
>  <remap from="cloud"           to="/camera/depth_registered/points" /> is correct or not?
>also
> i remap /rgb/image_in" and /gb/image_in" to the same topic  /camera/rgb/image_rect_color
>Is this correct?

No, /camera/depth_registered/points is already published by openni_launch, you should set another output topic name.
Well, the data_odom_sync outputs are wrong too. You don't need the data_odom_sync nodelet either, it is used to synchronize images with the odom generated by rgbd_odometry node when used. If you want to publish a voxelized cloud of the kinect, use this:
<node pkg="nodelet" type="nodelet" name="points_xyzrgb" args="standalone rtabmap_ros/point_cloud_xyzrgb">
    <!-- Input topics -->
    <remap from="rgb/image"       to="/camera/rgb/image_rect_color"/>
    <remap from="depth/image"     to="/camera/depth_registered/image_raw"/>
    <remap from="rgb/camera_info" to="/camera/rgb/camera_info"/>
   
    <!-- Output topic -->
    <remap from="cloud"           to="voxel_cloud" />

    <param name="voxel_size" type="double" value="0.05"/>
  </node>