Re: rtabmap with octomap and hector slam
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/rtabmap-with-octomap-and-hector-slam-tp696p719.html
I tried your launch file and it works (I used "quadrotor_with_asus_with_hokuyo_utm30lx.gazebo.xacro" though). I don't know how to move the quadrotor (I tried pr2_keyboard on /cmd_vel but nothing happened), so I couldn't test more than this screenshot, but we can see the point cloud. To avoid the map increasing when not moving, I also added in the launch under rtabmap node the parameters "RGBD/AngularUpdate" and "RGBD/LinearUpdate". Note that this simulated environment has poor visual features (see next image, only four features! normally it should have at least 400 features), rtabmap would not find any loop closure in this environment.

Here is my launch file:
UPDATE: Added laser scan filter to remove obstacles "on" the robot.
<launch>
<!-- Start Gazebo with wg world running in (max) realtime -->
<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find chefbot_gazebo)/worlds/complete_hotel.sdf"/>
</include>
<!-- Spawn simulated quadrotor uav -->
<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch" >
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_asus_with_hokuyo_utm30lx.gazebo.xacro"/>
</include>
<node pkg="tf" type="static_transform_publisher" name="world_to_map"
args="0.0 0.0 0.0 0.0 0.0 0.0 /world /map 100" />
<node pkg="tf" type="static_transform_publisher" name="scanmatcher_to_base_footprint"
args="0.0 0.0 0.0 0.0 0.0 0.0 /scanmatcher_frame /base_footprint 100" />
<node pkg="laser_filters" type="scan_to_scan_filter_chain" name="laser_filter">
<rosparam>
scan_filter_chain:
- name: range
type: LaserScanRangeFilter
params:
lower_threshold: 0.3
upper_threshold: .inf
</rosparam>
<remap from="scan" to="/scan" />
<remap from="scan_filtered" to="/scan_filtered" />
</node>
<!-- Odometry from laser scans -->
<!-- We use Hector mapping to generate odometry for us -->
<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping">
<!-- Frame names -->
<param name="map_frame" value="hector_map" />
<param name="base_frame" value="base_footprint" />
<param name="odom_frame" value="odom" />
<!-- Tf use -->
<param name="pub_map_odom_transform" value="false"/>
<param name="pub_map_scanmatch_transform" value="true"/>
<param name="pub_odometry" value="true"/>
<!-- Map size / start point -->
<param name="map_resolution" value="0.050"/>
<param name="map_size" value="2048"/>
<param name="map_multi_res_levels" value="2" />
<!-- Map update parameters -->
<param name="map_update_angle_thresh" value="0.06" />
<!-- Advertising config -->
<param name="scan_topic" value="/scan_filtered"/>
</node>
<group ns="rtabmap">
<!-- args: "delete_db_on_start" parameter deletes database on start -->
<node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start">
<param name="frame_id" type="string" value="base_footprint"/>
<param name="subscribe_depth" type="bool" value="true"/>
<param name="subscribe_laserScan" type="bool" value="true"/>
<!-- Inputs -->
<remap from="odom" to="/scanmatch_odom"/>
<remap from="scan" to="/scan_filtered"/>
<remap from="rgb/image" to="/camera/rgb/image_raw"/>
<remap from="depth/image" to="/camera/depth/image_raw"/>
<remap from="rgb/camera_info" to="/camera/rgb/camera_info"/>
<!-- RTAB-Map's parameters -->
<param name="LccIcp/Type" type="string" value="2"/>
<param name="RGBD/OptimizeSlam2D" type="string" value="true"/>
<param name="RGBD/LocalLoopDetectionSpace" type="string" value="true"/>
<param name="LccIcp2/CorrespondenceRatio" type="string" value="0.25"/>
<param name="LccBow/MaxDepth" type="string" value="10.0"/>
<param name="LccBow/InlierDistance" type="string" value="0.1"/>
<param name="LccBow/MinInliers" type="string" value="10"/>
<param name="RGBD/AngularUpdate" type="string" value="0.1"/>
<param name="RGBD/LinearUpdate" type="string" value="0.1"/>
</node>
</group>
<!-- Start rviz visualization with preset config -->
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find hector_quadrotor_demo)/rviz_cfg/indoor_slam.rviz"/>
</launch>