0
$\begingroup$

Rosanswers logo

Hello

i try to xtion, kobuki(2 wheel mobile robot).

i read http://wiki.ros.org/rtabmap_ros/Tutorials/SetupOnYourRobot.

and apply my launch.

i modify rgbd_mapping.launch.and program work normally.

  <arg name="subscribe_scan"          default="true"/>         <!-- Assuming 2D scan if set, rtabmap will do 3DoF mapping instead of 6DoF -->
  <arg name="scan_topic"              default="/kinect_scan"/>
  
  <arg name="subscribe_scan_cloud"    default="false"/>         <!-- Assuming 3D scan if set -->
  <arg name="scan_cloud_topic"        default="/scan_cloud"/>
  
  <arg name="visual_odometry"         default="false"/>          <!-- Generate visual odometry -->
  <arg name="odom_topic"              default="/odom"/>         <!-- Odometry topic used if visual_odometry is false -->

  <!-- Kinect cloud to laser scan  11cm 16cm-->
    <node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan">
      <remap from="image"     to="/camera/depth_registered/image_raw"/>
      <remap from="camera_info" to="/camera/depth_registered/camera_info"/>
      <remap from="scan" to="/kinect_scan"/>
      <param name="range_max" type="double" value="4"/>
    </node>
<node pkg="tf" type="static_transform_publisher" name="odom_camera_tf" args="0.11 0 0.16 0 0 0 1 /base_footprint /camera_link 100" />

but result is strange.

first. set my xtion from robot ( 0.11cm, 0, 0.16cm) so i add tf broadcaster.

result is below link.

https://plus.google.com/110617758145783258429/posts/RCTNymgamWp

1.point cloud and map cloud is different.

is the result normal??

2.map is bad when robot turn a round and go to origin.

https://plus.google.com/110617758145783258429/posts/KcxDVQqxNyg

full launch file.

<launch>
  <!-- Your RGB-D sensor should be already started with "depth_registration:=true".
        Examples:
           $ roslaunch freenect_launch freenect.launch depth_registration:=true 
           $ roslaunch openni2_launch openni2.launch depth_registration:=true -->
 
  
  <!-- Choose visualization -->
  <arg name="rviz"                    default="false" />
  <arg name="rtabmapviz"              default="true" /> 
  
  <!-- Localization-only mode -->
  <arg name="localization"            default="false"/>
  
  <!-- Corresponding config files -->
  <arg name="rtabmapviz_cfg"          default="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" />
  <arg name="rviz_cfg"                default="-d $(find rtabmap_ros)/launch/config/rgbd.rviz" />
  
  <arg name="frame_id"                default="camera_link"/>   <!-- Fixed frame id, you may set "base_link" or "base_footprint" if they are published -->
  <arg name="time_threshold"          default="0"/>             <!-- (ms) If not 0 ms, memory management is used to keep processing time on this fixed limit. -->
  <arg name="optimize_from_last_node" default="false"/>         <!-- Optimize the map from the last node. Should be true on multi-session mapping and when time threshold is set -->
  <arg name="database_path"           default="~/.ros/rtabmap.db"/>
  <arg name="rtabmap_args"            default=""/>              <!-- delete_db_on_start, udebug -->
  <arg name="launch_prefix"           default=""/>              <!-- for debugging purpose, it fills launch-prefix tag of the nodes -->
   
  <arg name="rgb_topic"               default="/camera/rgb/image_rect_color" />
  <arg name="depth_registered_topic"  default="/camera/depth_registered/image_raw" />
  <arg name="camera_info_topic"       default="/camera/rgb/camera_info" />
  <arg name="compressed"              default="false"/>
  <arg name="convert_depth_to_mm"     default="true"/>
   
  **<arg name="subscribe_scan"          default="true"/>         <!-- Assuming 2D scan if set, rtabmap will do 3DoF mapping instead of 6DoF -->
  <arg name="scan_topic"              default="/kinect_scan"/>**
  
  <arg name="subscribe_scan_cloud"    default="false"/>         <!-- Assuming 3D scan if set -->
  <arg name="scan_cloud_topic"        default="/scan_cloud"/>
  
  <arg name="visual_odometry"         default="false"/>          <!-- Generate visual odometry -->
  <arg name="odom_topic"              default="/odom"/>         <!-- Odometry topic used if visual_odometry is false -->
   
  <arg name="namespace"               default="rtabmap"/>
  <arg name="wait_for_transform"      default="0.2"/>
  

  <!-- Kinect cloud to laser scan  11cm 16cm-->
    <node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan">
      <remap from="image"     to="/camera/depth_registered/image_raw"/>
      <remap from="camera_info" to="/camera/depth_registered/camera_info"/>
      <remap from="scan" to="/kinect_scan"/>
      <param name="range_max" type="double" value="4"/>
    </node>
<node pkg="tf" type="static_transform_publisher" name="odom_camera_tf" args="0.11 0 0.16 0 0 0 1 /base_footprint /camera_link 100" />


 
 <!-- Nodes -->
  <group ns="$(arg namespace)">
  
    <node if="$(arg compressed)" name="republish_rgb"   type="republish" pkg="image_transport" args="compressed in:=$(arg rgb_topic) raw out:=$(arg rgb_topic)" />
    <node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="compressedDepth in:=$(arg depth_registered_topic) raw out:=$(arg depth_registered_topic)" />
  
    <!-- Odometry -->
    <node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      
      <param name="frame_id"                    type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
      
      <param name="Odom/FillInfoData"           type="string" value="true"/> 
    </node>
  
    <!-- Visual SLAM (robot side) -->
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"             type="bool"   value="true"/>
      <param name="subscribe_scan"              type="bool"   value="$(arg subscribe_scan)"/>
      <param name="subscribe_scan_cloud"        type="bool"   value="$(arg subscribe_scan_cloud)"/>
      <param name="frame_id"                    type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
      <param name="database_path"               type="string" value="$(arg database_path)"/>
    
      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="scan"            to="$(arg scan_topic)"/>
      <remap from="scan_cloud"      to="$(arg scan_cloud_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>
      
      <param name="Rtabmap/TimeThr"              type="string" value="$(arg time_threshold)"/>
      <param name="RGBD/OptimizeFromGraphEnd"    type="string" value="$(arg optimize_from_last_node)"/>
      <param name="Mem/SaveDepth16Format"        type="string" value="$(arg convert_depth_to_mm)"/>
      
      <!-- localization mode -->
      <param     if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
      <param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/>
      <param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/>

      <!-- when 2D scan is set -->
      <param if="$(arg subscribe_scan)" name="Optimizer/Slam2D"        type="string" value="true"/>
      <param if="$(arg subscribe_scan)" name="Icp/CorrespondenceRatio" type="string" value="0.25"/>
      <param if="$(arg subscribe_scan)" name="Reg/Strategy"            type="string" value="1"/> 
      <param if="$(arg subscribe_scan)" name="Reg/Force3DoF"           type="string" value="true"/>

      <!-- when 3D scan is set -->
      <param if="$(arg subscribe_scan_cloud)" name="Reg/Strategy"      type="string" value="1"/>
    </node>
  
    <!-- Visualisation RTAB-Map -->
    <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="$(arg rtabmapviz_cfg)" output="screen" launch-prefix="$(arg launch_prefix)">
      <param name="subscribe_depth"       type="bool"   value="true"/>
      <param name="subscribe_scan"        type="bool"   value="$(arg subscribe_scan)"/>
      <param name="subscribe_scan_cloud"  type="bool"   value="$(arg subscribe_scan_cloud)"/>
      <param name="subscribe_odom_info"   type="bool"   value="$(arg visual_odometry)"/>
      <param name="frame_id"              type="string" value="$(arg frame_id)"/>
      <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>
    
      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_registered_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="scan"            to="$(arg scan_topic)"/>
      <remap from="scan_cloud"      to="$(arg scan_cloud_topic)"/>
      <remap unless="$(arg visual_odometry)" from="odom"  to="$(arg odom_topic)"/>
    </node>
  
  </group>
  
  <!-- Visualization RVIZ -->
  <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="$(arg rviz_cfg)"/>
  <!-- sync cloud with odometry and voxelize the point cloud (for fast visualization in rviz) -->
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="standalone_nodelet"  args="manager" output="screen"/>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="data_odom_sync" args="load rtabmap_ros/data_odom_sync standalone_nodelet">
    <remap from="rgb/image_in"        to="$(arg rgb_topic)"/>
    <remap from="depth/image_in"      to="$(arg depth_registered_topic)"/>
    <remap from="rgb/camera_info_in"  to="$(arg camera_info_topic)"/>
    <remap if="$(arg visual_odometry)"     from="odom_in"  to="rtabmap/odom"/>
    <remap unless="$(arg visual_odometry)" from="odom_in"  to="$(arg odom_topic)"/>
    
    <remap from="rgb/image_out"       to="data_odom_sync/image"/>
    <remap from="depth/image_out"     to="data_odom_sync/depth"/>
    <remap from="rgb/camera_info_out" to="data_odom_sync/camera_info"/>
    <remap from="odom_out"            to="odom_sync"/>
  </node>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="load rtabmap_ros/point_cloud_xyzrgb standalone_nodelet">
    <remap from="rgb/image"       to="data_odom_sync/image"/>
    <remap from="depth/image"     to="data_odom_sync/depth"/>
    <remap from="rgb/camera_info" to="data_odom_sync/camera_info"/>
    <remap from="cloud"           to="voxel_cloud" />

    <param name="decimation" type="double" value="2"/>
    <param name="voxel_size" type="double" value="0.02"/>
  </node>

</launch>

Originally posted by JunJun on ROS Answers with karma: 26 on 2016-06-07

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Oh.. i found problem.

i didnt change frame_id.

"frame_id" default="camera_link"

i change camera_link --> base_footprint.

1.point cloud and map cloud is different. solved!!


Originally posted by JunJun with karma: 26 on 2016-06-07

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

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