RTABmap compiled with OpenCV (CUDA compiled)

Posted by andreacelani on
URL: http://official-rtab-map-forum.206.s1.nabble.com/RTABmap-compiled-with-OpenCV-CUDA-compiled-tp3496.html

Hi Mathieu,

I'm working on moving the OpenCV computation to GPU through CUDA 8.0 .
I fixed some issue related to installation of CUDA and compilation of OpenCV (2.4.8).
Now everything is fine except for R200 sensor camera nodelet manager that loaded by the main launcher that dies after the "/camera/driver - Initializing Depth Control Preset to 5"



If I roslaunch 3dsensor_r200.launch the camera driver starts normally and I can see data coming out from "rostopic echo /camera/depth_registered/sw_registered/image_rect_raw"

Seems the nodelet of rtabmap that reads from camera stream stuck the camera driver

here the main launch file portion after the camera loading:
<group ns="rtabmap">
	  
    <node pkg="nodelet" type="nodelet" name="data_throttle" args="standalone rtabmap_ros/data_throttle" output="screen">
      <param name="rate" type="double" value="10"/>
      <param name="decimation" type="int" value="1"/>

      <remap from="rgb/image_in"       to="/camera/rgb/image_rect_color"/>
      <remap from="depth/image_in"     to="/camera/depth_registered/sw_registered/image_rect_raw"/>
      <remap from="rgb/camera_info_in" to="/camera/rgb/camera_info"/>

      <remap from="rgb/image_out"       to="data_throttled_image"/>
      <remap from="depth/image_out"     to="data_throttled_image_depth"/>
      <remap from="rgb/camera_info_out" to="data_throttled_camera_info"/>
    </node>
	  
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg args)">
	  <param name="database_path"       type="string" value="$(arg database_path)"/>
	  <param name="frame_id"            type="string" value="base_footprint"/>
	  <param name="odom_frame_id"       type="string" value="odom"/>
	  <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>
	  <param name="subscribe_depth"     type="bool"   value="true"/>
      <param name="Grid/DepthDecimation"    type="int" value="2"/>
      <param name="Rtabmap/DetectionRate"  type="int" value="1"/>
	  <param name="subscribe_scan"      type="bool"   value="false"/>				<!-- da commentare per eliminare laserscan-->
	  <param name="grid_size"           type="double" value="20"/>  <!-- 4 meters wide -->
	
	  <!-- inputs -->
	  <remap from="scan"            to="/scan"/>				<!-- da commentare per eliminare laserscan-->
	  <remap from="rgb/image"       to="data_throttled_image"/>
  	  <remap from="depth/image"     to="data_throttled_image_depth"/>
  	  <remap from="rgb/camera_info" to="data_throttled_camera_info"/>
  	  
	  <param name="queue_size" type="int" value="100"/>
	  
  	  <!-- output -->
  	  <!-- <remap from="proj_map" to="/map"/> -->
      <remap from="grid_map" to="/map"/>
	
	  <!-- RTAB-Map's parameters: do "rosrun rtabmap rtabmap (double-dash)params" to see the list of available parameters. -->
	  <param name="RGBD/ProximityBySpace"        type="string" value="false"/>   <!-- Local loop closure detection (using estimated position) with locations in WM -->
	  <param name="RGBD/OptimizeFromGraphEnd"    type="string" value="false"/>  <!-- Set to false to generate map correction between /map and /odom -->
	  <param name="Kp/MaxDepth"                  type="string" value="4.0"/>
	  <param name="Grid/NoiseFilteringRadius" type="string" value="0.1"/>
      <param name="Grid/NoiseFilteringMinNeighbors" type="string" value="5"/>
	  <param name="Reg/Strategy"                 type="string" value="0"/>      <!-- Loop closure transformation refining with ICP: 0=Visual, 1=ICP, 2=Visual+ICP -->
	  <param name="Icp/CoprrespondenceRatio"     type="string" value="0.3"/>
	  <param name="Vis/MinInliers"               type="string" value="20"/>      <!-- 3D visual words minimum inliers to accept loop closure -->
	  <param name="Vis/InlierDistance"           type="string" value="0.1"/>    <!-- 3D visual words correspondence distance -->
	  <param name="RGBD/AngularUpdate"           type="string" value="0.1"/>    <!-- Update map only if the robot is moving -->
	  <param name="RGBD/LinearUpdate"            type="string" value="0.1"/>    <!-- Update map only if the robot is moving -->
	  <param name="Rtabmap/TimeThr"              type="string" value="400"/>
	  <param name="Mem/RehearsalSimilarity"      type="string" value="0.30"/>
	  <!-- <param name="Optimizer/Slam2D"             type="string" value="true"/>	era true--> <!-- abilita il mapping su superficie piana, diabilita per il 6DOF, era true--> 
	  <param name="Reg/Force3DoF"                type="string" value="true"/>   <!-- abilita il mapping su superficie piana, diabilita per il 6DOF, era true-->    
	  <!-- <param name="Grid/MaxGroundHeight"       type="string" value="0.1"/> -->
      <param name="Grid/MaxGroundAngle"          type="string" value="45"/>
      <param name="Grid/MaxGroundHeight"         type="string" value="0.7"/>       <!-- all points below 20 cm are ground -->
      <param name="Grid/MaxObstacleHeight"       type="string" value="1.7"/>       <!-- all points above 20 cm and below 2 m are obstacles -->
      <param name="Grid/NormalsSegmentation"     type="string" value="false"/> <!-- Use simple passthrough to filter the ground instead of normals segmentation -->
      <param name="Grid/FromDepth"               type="string" value="true"/> <!-- use depth data for map -->
		
	  <!-- 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)"/> 
    </node>
   
    <!-- Odometry : ONLY for testing without the actual robot! /odom TF should not be already published. -->
    <node if="$(arg rgbd_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen">
      <param name="frame_id"                    type="string" value="base_footprint"/>
      <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
      <param name="Reg/Force3DoF"               type="string" value="true"/>     <!-- abilita il mapping su superficie piana, disabilita per il 6DOF, era true-->
      <param name="Vis/InlierDistance"          type="string" value="0.1"/>
      <param name="Odom/ResetCountdown"         type="string" value="10" />     <!-- reset odometry when lost 10 frames -->
		
      <remap from="rgb/image"       to="data_throttled_image"/>
      <remap from="depth/image"     to="data_throttled_image_depth"/>
      <remap from="rgb/camera_info" to="data_throttled_camera_info"/>
    </node>
    
    <!-- visualization with rtabmapviz -->
    <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" output="screen">
  	  <param name="subscribe_depth"             type="bool" value="true"/>
      <param name="subscribe_scan"              type="bool" value="true"/>				<!-- da commentare per eliminare laserscan-->
      <param name="frame_id"                    type="string" value="base_footprint"/>
      <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
    
      <remap from="rgb/image"       to="data_throttled_image"/>
      <remap from="depth/image"     to="data_throttled_image_depth"/>
      <remap from="rgb/camera_info" to="data_throttled_camera_info"/>
      <remap from="scan"            to="/scan"/>				<!-- da commentare per eliminare laserscan-->
    </node>
    
  </group>

  <!-- point cloud generation for obstacles detection -->
  <node pkg="nodelet" type="nodelet" name="pcl_manager" args="manager" output="screen" />
    <node pkg="nodelet" type="nodelet" name="points_xyz_planner" args="load rtabmap_ros/point_cloud_xyz pcl_manager">
      <remap from="depth/image"            to="/rtabmap/data_throttled_image_depth"/>
      <remap from="depth/camera_info"      to="/rtabmap/data_throttled_camera_info"/>
      <remap from="cloud"                  to="cloudXYZ" />
      <param name="decimation" type="int" value="2"/>
      <param name="max_depth"  type="double" value="4.0"/>
	  <param name="min_depth"  type="double" value="1.5"/>
      <param name="voxel_size" type="double" value="0.02"/>
    </node>

  <node pkg="nodelet" type="nodelet" name="pcl_manager_b" args="manager" output="screen" />
    <node pkg="nodelet" type="nodelet" name="obstacles_detection" args="load rtabmap_ros/obstacles_detection pcl_manager_b">
      <remap from="cloud"     to="cloudXYZ"/> -->
      <remap from="obstacles" to="/obstacles_cloud"/>
      <remap from="ground"    to="/ground_cloud"/>

      <param name="frame_id"             type="string" value="base_footprint"/>
	  <param name="Grid/NormalsSegmentation" type="string" value="false"/> 
      <param name="map_frame_id"         type="string" value="map"/>
      <param name="wait_for_transform"   type="bool" value="true"/>
      <param name="Grid/MaxGroundHeight"         type="string" value="0.4"/>       <!-- was 0.7 all points below 20 cm are ground -->
      <param name="Grid/MaxGroundAngle"  type="double" value="0.785"/>
      <param name="Grid/MinClusterSize"     type="int" value="50"/>
      <param name="Grid/MaxObstacleHeight" type="double" value="1.0"/>       <!-- was 1.5 -->
      <param name="queue_size"           type="int" value="100"/>
    </node>  

Any idea how the OpenCV-Cuda_compiled has affected the reading of camera stream?
Thank you!

Andrea