Rtabmap with drone and rover

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

Rtabmap with drone and rover

minato_99
Hello matlabbe,

I am trying to map an environment with drone and rover. How can I approach this problem? Your suggestions would be appreciated. Thanks.

Sincerely,
minato_99
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

matlabbe
Administrator
Assuming they have the same sensor/camera, you may run the same config on both robots. Run a mapping session independently on each robot. To merge the maps together, you would need to make sure that the drone lands or takes off from an area that the rover can map (ideally with very similar point of view), so that a loop closure can be detected between the two mapping sessions.

Combining maps offline:
rtabmap-reprocess "map_rover.db;map_drone.db" combined_map.db
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

minato_99
Hello matlabbe,

Thanks for your reply. I will let you know if some error comes up or if I am successful.

Sincerely,
minato_99
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

minato_99
This post was updated on .
Hello malabbe,

I started working on your advice and using the inbuilt iris model of PX4. I am using the same config file. I just change the base_link and the required topics. However, I am not being able to decide what should go in the odom_frame_id and remaps for the odom. I am getting the following error. I have attached my code. Any suggestions would be appreciated. Thanks.

[ WARN] [1705695384.541636748, 870.586000000]: /rtabmap/rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ("$ rostopic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=10).
/rtabmap/rtabmap subscribed to (approx sync):
   /rtabmap/stereo/odom \
   /rtabmap/stereo/left/image_raw \
   /rtabmap/stereo/right/image_raw \
   /rtabmap/stereo/left/camera_info \
   /rtabmap/stereo/right/camera_info

My config file is:
<?xml version="1.0" encoding="UTF-8"?>

<launch>

	
  <!-- Choose visualization -->
  <arg name="rtabmapviz"              default="false" />
  <arg name="rviz"                    default="true" />
  
   			<param name="use_sim_time" type="bool" value="True"/> 

  <!-- Localization-only mode -->
  <arg name="localization"            default="false"/>
  
  
<arg name="pi/2" value="1.5707963267948966" />
<arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2) " />
<arg name="optical_rotate2" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)  " />								<!-- roll  and yaw = -$(arg pi/2) -->
<node pkg="tf2_ros" type="static_transform_publisher" name="stereo_camera"
     args="$(arg optical_rotate) base_link camera_link" />  
     
     	
	<!-- <node pkg="tf2_ros" type="static_transform_publisher" name="odom_map"
     args="$(arg optical_rotate2) map odom" /> -->

<!-- Run the ROS package stereo_image_proc -->
<b>	 <remap from="stereo/odom"  to="mavros/local_position/odom"/> </b>
<group ns="stereo" > 
    <node pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc"/>

    <!-- Odometry -->
    <node pkg="rtabmap_odom" type="stereo_odometry" name="stereo_odometry" output="screen">
   <remap from="left/image_rect"   to="left/image_rect_color"/>
     <remap from="right/image_rect"  to="right/image_rect"/>
     <remap from="left/camera_info"  to="left/camera_info"/>
     <remap from="right/camera_info" to="right/camera_info"/>
     <param name="disparity_range" value="256"/>
<param name="frame_id" type="string" value="base_link"/>
    <b>    <param name="odom_frame_id" type="string" value="/odom"/></b>
        <param name="approx_sync"   type="bool" value="true"/>
        <param name="queue_size"    type="int" value="10"/>	
         <param name="Optimizer/Slam2D"             type="string" value="true"/>
        <param name="Reg/Force3DoF"                type="string" value="true"/> 	 
    </node>     
 </group> 

 <!-- Mapping -->

<group ns="rtabmap">   
  <node name="rtabmap" pkg="rtabmap_slam" type="rtabmap" output="screen" args="delete_db_on_start"> <!--	delete_db_on_start-->
  	<param name="database_path" type="string" value="/home/rakesh/.ros/database/drone_rtabmap.db"/>
     <param name="frame_id" type="string" value="base_link"/>
     <param name="subscribe_stereo" type="bool" value="true"/>
     <param name="subscribe_depth"  type="bool" value="false"/>
     <param name="approx_sync"      type="bool" value="true"/>
        <remap from="left/image_rect"       to="stereo/left/image_raw"/>
        <remap from="right/image_rect"      to="stereo/right/image_raw"/>
        <remap from="left/camera_info"      to="stereo/left/camera_info"/>
        <remap from="right/camera_info"     to="stereo/right/camera_info"/>
   <b>    <remap from="odom" to="stereo/odom"/></b>
     <!-- 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"/> <!-- true -->   <!-- 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="2"/>
	  <param name="Reg/Strategy"                 type="string" value="0"/>      <!-- Loop closure transformation: 0=Visual, 1=ICP, 2=Visual+ICP -->
	 
	  <param name="Vis/MinInliers"               type="string" value="15"/>      <!-- 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="RGBD/ProximityPathMaxNeighbors" type="string" value="0"/> 
	  <param name="Rtabmap/TimeThr"              type="string" value="3000"/> <!-- 700-->
	  <param name="Mem/RehearsalSimilarity"      type="string" value="0.30"/> <!-- 0.3 -->
	  <param name="Optimizer/Slam2D"             type="string" value="true"/>
	  <param name="Reg/Force3DoF"                type="string" value="true"/>  
	<!--  <param name="kp/MaxFeatures" type="string"      value="-1"/> -->
	        <!-- 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>
 </group>
 <!-- Visualisation RVIZ --> 
   <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(find rtabmap_demos)/launch/config/demo_stereo_outdoor.rviz"/> 
   
</launch>

 Sincerely,
minato_99


It seems the code with
<param/>
 is not showing up. what should I do for parameter odom_frame_id and while remapping odom.
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

matlabbe
Administrator
odom_frame_id would need to be set to rtabmap node if you want to use it. If you are using stereo_odometry, you should also be fine to use "stereo/odom" topic instead.

Ideally, stereo_odometry should use approx_sync:=false. For the warning, you may check the frequency of the topics listed:
rostopic hz /rtabmap/stereo/odom \
   /rtabmap/stereo/left/image_raw \
   /rtabmap/stereo/right/image_raw \
   /rtabmap/stereo/left/camera_info \
   /rtabmap/stereo/right/camera_info
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

minato_99
Hello matlabbe,

I used the stereo/odom. However, there are no messages publishing. I am using the PX4 iris model and I am using the same config file of Stereo B. I have the following topics being published. I have a model for rover and the drone. I was thinking there should be different config file for the drone. Please let me know if I am wrong because I am using the same "demo_stereo_outdoor.rviz" config file. I am stuck in this problem for so many days. Your help would be appreciated.

$ rostopic list
/stereo_camera/left/image_raw
/stereo_camera/left/camera_info
/stereo_camera/right/image_raw
/stereo_camera/right/camera_info


 tf_tree.png
topic_msg.png

Sincerely,
minato_99
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

matlabbe
Administrator
Do you have a stereo camera on your drone?
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

minato_99
Hello matlabbe,

Yes, I have stereo camera attached with drone. I have used the same camera with rover and have a map. I have attached the image below.

drone_with_stereo.png

Sincerely,
Rakesh Yadav
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

matlabbe
Administrator
Are there stereo topics published? If so, you may have to remap the name in the launch file you are using to ones published by gazebo.
Reply | Threaded
Open this post in threaded view
|

Re: Rtabmap with drone and rover

minato_99
In reply to this post by minato_99
Hello matlabbe,
It worked with stereo/odom.

I was not passing the correct topics while doing remaps. Instead of using  " /stereo/left/image_raw ". I was using " stereo/left/image_raw" so that rtabmap/stereo/left/image_raw was expected, which was not publishing. Thanks for your help.

Sincerely,
minato_99