ros-noetic usage

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

ros-noetic usage

xantho
Hello guys,

I have been battling with visual slam using RTABMAP for the last week. I am trying to rectify a bunch of problems but lets start from the beginning.
When I install rtabmap i have to to install the standalone and ros versions. That's clear.
The github instructions specify the following:

The easiest way to get all them (Qt, PCL, VTK, OpenCV, ...) is to install/uninstall rtabmap binaries:

sudo apt install ros-$ROS_DISTRO-rtabmap ros-$ROS_DISTRO-rtabmap-ros
sudo apt remove ros-$ROS_DISTRO-rtabmap ros-$ROS_DISTRO-rtabmap-ros

Does that mean that I first install using the first command and then immediately uninstall it again?
I tried that, then proceeded with the standalone install and then the ros install. When I tried to catkin_make it wouldn't compile because it wanted to use the  ros-noetic-rtabmap-conversions.

I then did sudo apt install ros-noetic-rtabmap-conversions and it compiled, but didn't rectify my problems so I uninstalled everything.

Can someone clarify this?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

matlabbe
Administrator

Hi,

I've forgot to update the README when we split the packages into subpackages. I just updated it, you should do instead:
sudo apt remove ros-$ROS_DISTRO-rtabmap*

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

xantho
Thanks!
I managed to install and compile the ros package.
Now, I run a modified sensor_fusion.launch file (I have a second file renamed) and when I run

rosrun rtabmap_viz rtabmap_viz

I get a bunch of warnings about parameters not found. A sample follows:
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
[ WARN] [1691695802.851864689]: rtabmap_viz: rtabmap's parameters seem not all there yet! continuing with those there if some...
[ WARN] [1691695802.852541348]: rtabmap_viz: Parameter BRIEF/Bytes not found
[ WARN] [1691695802.853130560]: rtabmap_viz: Parameter BRISK/Octaves not found
[ WARN] [1691695802.853741172]: rtabmap_viz: Parameter BRISK/PatternScale not found
[ WARN] [1691695802.854313535]: rtabmap_viz: Parameter BRISK/Thresh not found
[ WARN] [1691695802.854976338]: rtabmap_viz: Parameter Bayes/FullPredictionUpdate not found
[ WARN] [1691695802.855572809]: rtabmap_viz: Parameter Bayes/PredictionLC not found
[ WARN] [1691695802.856124587]: rtabmap_viz: Parameter Bayes/VirtualPlacePriorThr not found
[ WARN] [1691695802.856622453]: rtabmap_viz: Parameter Db/TargetVersion not found
[ WARN] [1691695802.857101153]: rtabmap_viz: Parameter DbSqlite3/CacheSize not found
[ WARN] [1691695802.857574110]: rtabmap_viz: Parameter DbSqlite3/InMemory not found
[ WARN] [1691695802.858071463]: rtabmap_viz: Parameter DbSqlite3/JournalMode not found
[ WARN] [1691695802.858615275]: rtabmap_viz: Parameter DbSqlite3/Synchronous not found
[ WARN] [1691695802.859286116]: rtabmap_viz: Parameter DbSqlite3/TempStore not found
[ WARN] [1691695802.859805136]: rtabmap_viz: Parameter FAST/CV not found
[ WARN] [1691695802.860221372]: rtabmap_viz: Parameter FAST/Gpu not found
[ WARN] [1691695802.860613992]: rtabmap_viz: Parameter FAST/GpuKeypointsRatio not found
[ WARN] [1691695802.861053459]: rtabmap_viz: Parameter FAST/GridCols not found
[ WARN] [1691695802.861452987]: rtabmap_viz: Parameter FAST/GridRows not found
[ WARN] [1691695802.861850300]: rtabmap_viz: Parameter FAST/MaxThreshold not found
[ WARN] [1691695802.862240583]: rtabmap_viz: Parameter FAST/MinThreshold not found
[ WARN] [1691695802.862685120]: rtabmap_viz: Parameter FAST/NonmaxSuppression not found
[ WARN] [1691695802.863081007]: rtabmap_viz: Parameter FAST/Threshold not found
[ WARN] [1691695802.863537508]: rtabmap_viz: Parameter FREAK/NOctaves not found
[ WARN] [1691695802.864060117]: rtabmap_viz: Parameter FREAK/OrientationNormalized not found
[ WARN] [1691695802.864591496]: rtabmap_viz: Parameter FREAK/PatternScale not found
[ WARN] [1691695802.865043092]: rtabmap_viz: Parameter FREAK/ScaleNormalized not found
[ WARN] [1691695802.865534049]: rtabmap_viz: Parameter GFTT/BlockSize not found
[ WARN] [1691695802.866070082]: rtabmap_viz: Parameter GFTT/K not found
[ WARN] [1691695802.866563677]: rtabmap_viz: Parameter GFTT/MinDistance not found
[ WARN] [1691695802.866988330]: rtabmap_viz: Parameter GFTT/QualityLevel not found
[ WARN] [1691695802.867417879]: rtabmap_viz: Parameter GFTT/UseHarrisDetector not found
[ WARN] [1691695802.867810125]: rtabmap_viz: Parameter GMS/ThresholdFactor not found
[ WARN] [1691695802.868306126]: rtabmap_viz: Parameter GMS/WithRotation not found
[ WARN] [1691695802.868729906]: rtabmap_viz: Parameter GMS/WithScale not found
[ WARN] [1691695802.869095657]: rtabmap_viz: Parameter GTSAM/Optimizer not found
[ WARN] [1691695802.869478042]: rtabmap_viz: Parameter Grid/3D not found
[ WARN] [1691695802.869871653]: rtabmap_viz: Parameter Grid/CellSize not found
[ WARN] [1691695802.870246548]: rtabmap_viz: Parameter Grid/ClusterRadius not found
[ WARN] [1691695802.870677939]: rtabmap_viz: Parameter Grid/DepthDecimation not found

some more in between ...

[ WARN] [1691695803.000032790]: rtabmap_viz: Parameter StereoBM/SpeckleWindowSize not found
[ WARN] [1691695803.000546184]: rtabmap_viz: Parameter StereoBM/TextureThreshold not found
[ WARN] [1691695803.000952335]: rtabmap_viz: Parameter StereoBM/UniquenessRatio not found
[ WARN] [1691695803.001342932]: rtabmap_viz: Parameter StereoSGBM/BlockSize not found
[ WARN] [1691695803.001720756]: rtabmap_viz: Parameter StereoSGBM/Disp12MaxDiff not found
[ WARN] [1691695803.002109353]: rtabmap_viz: Parameter StereoSGBM/MinDisparity not found
[ WARN] [1691695803.002520444]: rtabmap_viz: Parameter StereoSGBM/Mode not found
[ WARN] [1691695803.002901709]: rtabmap_viz: Parameter StereoSGBM/NumDisparities not found
[ WARN] [1691695803.003271786]: rtabmap_viz: Parameter StereoSGBM/P1 not found
[ WARN] [1691695803.003638837]: rtabmap_viz: Parameter StereoSGBM/P2 not found
[ WARN] [1691695803.004011312]: rtabmap_viz: Parameter StereoSGBM/PreFilterCap not found
[ WARN] [1691695803.004381934]: rtabmap_viz: Parameter StereoSGBM/SpeckleRange not found
[ WARN] [1691695803.004753171]: rtabmap_viz: Parameter StereoSGBM/SpeckleWindowSize not found
[ WARN] [1691695803.005147279]: rtabmap_viz: Parameter StereoSGBM/UniquenessRatio not found
[ WARN] [1691695803.005551650]: rtabmap_viz: Parameter SuperPoint/Cuda not found
[ WARN] [1691695803.005985942]: rtabmap_viz: Parameter SuperPoint/ModelPath not found
[ WARN] [1691695803.006427589]: rtabmap_viz: Parameter SuperPoint/NMS not found
[ WARN] [1691695803.006846714]: rtabmap_viz: Parameter SuperPoint/NMSRadius not found
[ WARN] [1691695803.007254885]: rtabmap_viz: Parameter SuperPoint/Threshold not found
[ WARN] [1691695803.007652237]: rtabmap_viz: Parameter VhEp/Enabled not found
[ WARN] [1691695803.008078500]: rtabmap_viz: Parameter VhEp/MatchCountMin not found
[ WARN] [1691695803.008579517]: rtabmap_viz: Parameter VhEp/RansacParam1 not found
[ WARN] [1691695803.009003508]: rtabmap_viz: Parameter VhEp/RansacParam2 not found
[ WARN] [1691695803.009423846]: rtabmap_viz: Parameter Vis/BundleAdjustment not found
[ WARN] [1691695803.009852271]: rtabmap_viz: Parameter Vis/CorFlowEps not found
[ WARN] [1691695803.010275363]: rtabmap_viz: Parameter Vis/CorFlowIterations not found
[ WARN] [1691695803.010689249]: rtabmap_viz: Parameter Vis/CorFlowMaxLevel not found
[ WARN] [1691695803.011099871]: rtabmap_viz: Parameter Vis/CorFlowWinSize not found
[ WARN] [1691695803.011597775]: rtabmap_viz: Parameter Vis/CorGuessMatchToProjection not found
[ WARN] [1691695803.012065286]: rtabmap_viz: Parameter Vis/CorGuessWinSize not found
[ WARN] [1691695803.013160287]: rtabmap_viz: Parameter Vis/CorNNDR not found
[ WARN] [1691695803.014060102]: rtabmap_viz: Parameter Vis/CorNNType not found
[ WARN] [1691695803.015046586]: rtabmap_viz: Parameter Vis/CorType not found
[ WARN] [1691695803.015756292]: rtabmap_viz: Parameter Vis/DepthAsMask not found
[ WARN] [1691695803.016455987]: rtabmap_viz: Parameter Vis/EpipolarGeometryVar not found
[ WARN] [1691695803.017060420]: rtabmap_viz: Parameter Vis/EstimationType not found
[ WARN] [1691695803.017625627]: rtabmap_viz: Parameter Vis/FeatureType not found
[ WARN] [1691695803.018166940]: rtabmap_viz: Parameter Vis/ForwardEstOnly not found
[ WARN] [1691695803.018726559]: rtabmap_viz: Parameter Vis/GridCols not found
[ WARN] [1691695803.019314975]: rtabmap_viz: Parameter Vis/GridRows not found
[ WARN] [1691695803.019924676]: rtabmap_viz: Parameter Vis/InlierDistance not found
[ WARN] [1691695803.020424896]: rtabmap_viz: Parameter Vis/Iterations not found
[ WARN] [1691695803.020879524]: rtabmap_viz: Parameter Vis/MaxDepth not found
[ WARN] [1691695803.021313140]: rtabmap_viz: Parameter Vis/MaxFeatures not found
[ WARN] [1691695803.021905690]: rtabmap_viz: Parameter Vis/MeanInliersDistance not found
[ WARN] [1691695803.022493736]: rtabmap_viz: Parameter Vis/MinDepth not found
[ WARN] [1691695803.023073789]: rtabmap_viz: Parameter Vis/MinInliers not found
[ WARN] [1691695803.023625872]: rtabmap_viz: Parameter Vis/MinInliersDistribution not found
[ WARN] [1691695803.024189871]: rtabmap_viz: Parameter Vis/PnPFlags not found
[ WARN] [1691695803.024804619]: rtabmap_viz: Parameter Vis/PnPMaxVariance not found
[ WARN] [1691695803.025396805]: rtabmap_viz: Parameter Vis/PnPRefineIterations not found
[ WARN] [1691695803.025948229]: rtabmap_viz: Parameter Vis/PnPReprojError not found
[ WARN] [1691695803.026429060]: rtabmap_viz: Parameter Vis/PnPSamplingPolicy not found
[ WARN] [1691695803.026900465]: rtabmap_viz: Parameter Vis/PnPVarianceMedianRatio not found
[ WARN] [1691695803.027312530]: rtabmap_viz: Parameter Vis/RefineIterations not found
[ WARN] [1691695803.027693219]: rtabmap_viz: Parameter Vis/RoiRatios not found
[ WARN] [1691695803.028126028]: rtabmap_viz: Parameter Vis/SubPixEps not found
[ WARN] [1691695803.028650258]: rtabmap_viz: Parameter Vis/SubPixIterations not found
[ WARN] [1691695803.029093538]: rtabmap_viz: Parameter Vis/SubPixWinSize not found
[ WARN] [1691695803.029548995]: rtabmap_viz: Parameter g2o/Baseline not found
[ WARN] [1691695803.029950926]: rtabmap_viz: Parameter g2o/Optimizer not found
[ WARN] [1691695803.030459879]: rtabmap_viz: Parameter g2o/PixelVariance not found
[ WARN] [1691695803.031053430]: rtabmap_viz: Parameter g2o/RobustKernelDelta not found
[ WARN] [1691695803.031617334]: rtabmap_viz: Parameter g2o/Solver not found
[ WARN] [1691695808.413664571]: /rtabmap_viz: 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_viz subscribed to:
   /odom

How can I rectify this?
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

matlabbe
Administrator
The warnings mean that rtabmap_viz could not read the parameters from rtabmap node. The rtabmap node may not be started yet or is in different namespace than rtabmap_viz has been started in. If rtabmap node is started later, rtabmap_viz can get the parameters when opening the Preferences dialog.

Note that rtabmap_viz is just for visualization (like rviz).
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

xantho
ok, so I modify my launch file as follows but when I launch it does not seem to read the correct launch file?

<?xml version="1.0"?>
<launch>

  <!-- This launch assumes that you have already
       started you preferred RGB-D sensor and your IMU.
       TF between frame_id and the sensors should already be set too. -->

  <arg name="frame_id"                default="base_link" />
  <arg name="rgb_topic"               default="/camera/color/image_raw" />
  <arg name="depth_topic"             default="/camera/aligned_depth_to_color/image_raw" />
  <arg name="camera_info_topic"       default="/camera/color/camera_info" />
  <arg name="imu_topic"               default="/imu/data" />
  <arg name="imu_ignore_acc"          default="true" />
  <arg name="imu_remove_gravitational_acceleration" default="true" />
  <h3><arg name="queue_size"              default="20"/></h3>
  
  <!-- Choose visualization -->
  <arg name="rtabmap_viz"             default="true" />

  <!-- Localization-only mode -->
  <arg name="localization"      default="false"/>
  <arg     if="$(arg localization)" name="rtabmap_args"  default=""/>
  <arg unless="$(arg localization)" name="rtabmap_args"  default="--delete_db_on_start"/>

  <group ns="rtabmap">
    <!-- Visual Odometry -->
    <node pkg="rtabmap_odom" type="rgbd_odometry" name="visual_odometry" output="screen" args="$(arg rtabmap_args)">
      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="odom"            to="/vo"/>

      <param name="frame_id"               type="string" value="$(arg frame_id)"/>
      <param name="publish_tf"             type="bool"   value="false"/>
      <param name="publish_null_when_lost" type="bool"   value="true"/>
      <param name="guess_from_tf"          type="bool"   value="true"/>

      <param name="Odom/FillInfoData"      type="string" value="true"/>
      <param name="Odom/ResetCountdown"    type="string" value="1"/>
      <param name="Vis/FeatureType"        type="string" value="6"/>
      <param name="OdomF2M/MaxSize"        type="string" value="1000"/>
    </node>

    <!-- SLAM -->
    <node name="rtabmap" pkg="rtabmap_slam" type="rtabmap" output="screen" args="$(arg rtabmap_args)">
      <param name="frame_id"        type="string" value="$(arg frame_id)"/>

      <remap from="rgb/image"       to="$(arg rgb_topic)"/>
      <remap from="depth/image"     to="$(arg depth_topic)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="odom"            to="/odometry/filtered"/>

      <param name="Kp/DetectorStrategy"    type="string" value="6"/> <!-- use same features as odom -->

      <!-- localization mode -->
      <param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/>
      <param     if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/>
      <param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/>

    </node>
  </group>

  <!-- Odometry fusion (EKF), refer to demo launch file in robot_localization for more info -->
  <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" clear_params="true" output="screen">

      <param name="frequency" value="50"/>
      <param name="sensor_timeout" value="0.1"/>
      <param name="two_d_mode" value="false"/>

      <param name="odom_frame" value="odom"/>
      <param name="base_link_frame" value="$(arg frame_id)"/>
      <param name="world_frame" value="odom"/>

      <param name="transform_time_offset" value="0.0"/>

      <param name="odom0" value="/vo"/>
      <param name="imu0" value="$(arg imu_topic)"/>

      <!-- The order of the values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. -->
      <rosparam param="odom0_config">[true, true, true,
                                      false, false, false,
                                      true, true, true,
                                      false, false, false,
                                      false, false, false]</rosparam>

      <rosparam     if="$(arg imu_ignore_acc)" param="imu0_config">[
                                     false, false, false,
                                     true,  true,  true,
                                     false, false, false,
                                     true,  true,  true,
                                     false,  false,  false] </rosparam>
      <rosparam unless="$(arg imu_ignore_acc)" param="imu0_config">[
                                     false, false, false,
                                     true,  true,  true,
                                     false, false, false,
                                     true,  true,  true,
                                     true,  true,  true] </rosparam>

      <param name="odom0_differential" value="false"/>
      <param name="imu0_differential" value="false"/>

      <param name="odom0_relative" value="true"/>
      <param name="imu0_relative" value="true"/>

      <param name="imu0_remove_gravitational_acceleration" value="$(arg imu_remove_gravitational_acceleration)"/>

      <param name="print_diagnostics" value="true"/>

      <!-- ======== ADVANCED PARAMETERS ======== -->
      <param name="odom0_queue_size" value="5"/>
      <param name="imu0_queue_size" value="50"/>

    </node>
</launch>


but in terminal it shows:

[ INFO] [1691696617.543206171]: /rtabmap/rtabmap: queue_size    = 10

Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

matlabbe
Administrator
You can launch an arbitrary launch file by calling it directly:
roslaunch test.launch
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

xantho
This post was updated on .
Hi,

I was actually meaning that by changing parameters in the launch file, they wouldn't reflect in the terminal.
But I solved that.

In any case, i decided to drop using the sensor_fusion.launch file and instead I will use with the robot_localization ekf_template.launch and the rtabmap.launch.

I am using my own launch files named ekf_template_ugv.launch and rtabmap_ugv.launch

I read in this link https://answers.ros.org/question/317419/realsense-d435-rtabmap-pixhawk-imu-robot_localization/

that you said the rtabmap.launch is tied to using visual odometry directly ignoring r_l odometry so I am now trying to change this by modifying the rtabmap_ugv.launch file.

The changes i made so far:

 <arg name="frame_id"  default="base_link"/>

 instead of camera_link

 <arg name="queue_size"       default="100"/> 

 instead of 10

 <arg name="wait_for_transform"   default="0.3"/>

 instead of 0.2

Then i changed my rgb, depth and camera info topics. (I am using a D435).

I also changed:
 

 <arg name="rgbd_sync"     default="true"/> 

 <arg name="vo_frame_id"  default="odom"/> 


I added this argument:

<arg name="r_l_odom"        default="/odometry/filtered/local"/>


which is used further down to the visual SLAM node as :

<remap from="odom"                   to="$(arg r_l_odom)"/>


I am also attaching the compete rtabmap_ugv.launch file:


<?xml version="1.0"?>
<!-- -->
<launch>
  <!-- Convenience launch file to launch odometry, rtabmap and rtabmap_viz nodes at once -->

  <!-- For stereo:=false
        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 -->

  <!-- For stereo:=true
        Your camera should be calibrated and publishing rectified left and right
        images + corresponding camera_info msgs. You can use stereo_image_proc for image rectification.
        Example:
           $ roslaunch rtabmap_examples bumblebee.launch -->

  <!-- Choose between depth and stereo, set both to false to do only scan -->
  <arg name="stereo"                    default="false"/>
  <arg     if="$(arg stereo)" name="depth"  default="false"/>
  <arg unless="$(arg stereo)" name="depth"  default="true"/>
  <arg name="subscribe_rgb"  default="$(arg depth)"/>

  <!-- Choose visualization -->
  <arg name="rtabmap_viz"             default="true" />
  <arg name="rviz"                    default="false" />

  <!-- Localization-only mode -->
  <arg name="localization"            default="false"/>
  <arg name="initial_pose"            default=""/>             <!-- Format: "x y z roll pitch yaw" or "x y z qx qy qz qw". Default: see "RGBD/StartAtOrigin" doc -->

  <!-- sim time for convenience, if playing a rosbag -->
  <arg name="use_sim_time"            default="false"/>
  <param if="$(arg use_sim_time)" name="use_sim_time" value="true"/>

  <!-- Corresponding config files -->
  <arg name="cfg"                     default="" /> <!-- To change RTAB-Map's parameters, set the path of config file (*.ini) generated by the standalone app -->
  <arg name="gui_cfg"                 default="~/.ros/rtabmap_gui.ini" />
  <arg name="rviz_cfg"                default="$(find rtabmap_launch)/launch/config/rgbd.rviz" />

  <arg name="frame_id"                default="base_link"/>     <!-- Fixed frame id, you may set "base_link" or "base_footprint" if they are published -->
  <arg name="odom_frame_id"           default=""/>                <!-- If set, TF is used to get odometry instead of the topic -->
  <arg name="odom_frame_id_init"      default=""/>                <!-- If set, TF map->odom is published even if no odometry topic has been received yet. The frame id should match the one in the topic. -->
  <arg name="map_frame_id"            default="map"/>
  <arg name="ground_truth_frame_id"   default=""/>     <!-- e.g., "world" -->
  <arg name="ground_truth_base_frame_id" default=""/>  <!-- e.g., "tracker", a fake frame matching the frame "frame_id" (but on different TF tree) -->
  <arg name="namespace"               default="rtabmap"/>
  <arg name="database_path"           default="~/.ros/rtabmap.db"/>
  <arg name="queue_size"              default="100"/>
  <arg name="wait_for_transform"      default="0.3"/>
  <arg name="args"                    default=""/>              <!-- delete_db_on_start, udebug -->
  <arg name="rtabmap_args"            default="$(arg args)"/>   <!-- deprecated, use "args" argument -->
  <arg name="gdb"                     default="false"/>         <!-- Launch nodes in gdb for debugging (apt install xterm gdb) -->
  <arg     if="$(arg gdb)" name="launch_prefix" default="xterm -e gdb -q -ex run --args"/>
  <arg unless="$(arg gdb)" name="launch_prefix" default=""/>
  <arg name="clear_params"            default="true"/>
  <arg name="output"                  default="screen"/>        <!-- Control node output (screen or log) -->
  <arg name="publish_tf_map"          default="true"/>

  <!-- if timestamps of the input topics are synchronized using approximate or exact time policy-->
  <arg     if="$(arg stereo)" name="approx_sync"  default="false"/>
  <arg unless="$(arg stereo)" name="approx_sync"  default="$(arg depth)"/>
  <arg name="approx_sync_max_interval"  default="0"/> <!-- (sec) 0 means infinite interval duration (used with approx_sync=true) -->

  <!-- RGB-D related topics -->
  <arg name="rgb_topic"               default="/camera/rgb/image_rect_color" />
  <arg name="depth_topic"             default="/camera/depth_registered/image_raw" />
  <arg name="camera_info_topic"       default="/camera/rgb/camera_info" />
  <arg name="depth_camera_info_topic" default="$(arg camera_info_topic)" />

  <!-- stereo related topics -->
  <arg name="stereo_namespace"        default="/stereo_camera"/>
  <arg name="left_image_topic"        default="$(arg stereo_namespace)/left/image_rect_color" />
  <arg name="right_image_topic"       default="$(arg stereo_namespace)/right/image_rect" />      <!-- using grayscale image for efficiency -->
  <arg name="left_camera_info_topic"  default="$(arg stereo_namespace)/left/camera_info" />
  <arg name="right_camera_info_topic" default="$(arg stereo_namespace)/right/camera_info" />

  <!-- Already synchronized RGB-D related topic, with rtabmap_sync/rgbd_sync nodelet -->
  <arg name="rgbd_sync"               default="true"/>         <!-- pre-sync rgb_topic, depth_topic, camera_info_topic -->
  <arg name="approx_rgbd_sync"        default="true"/>          <!-- false=exact synchronization -->
  <arg name="subscribe_rgbd"          default="$(arg rgbd_sync)"/>
  <arg name="rgbd_topic"              default="rgbd_image" />
  <arg name="depth_scale"             default="1.0" />         <!-- Deprecated, use rgbd_depth_scale instead -->
  <arg name="rgbd_depth_scale"        default="$(arg depth_scale)" />
  <arg name="rgbd_decimation"         default="1" />

  <arg name="compressed"              default="false"/>         <!-- If you want to subscribe to compressed image topics -->
  <arg name="rgb_image_transport"     default="compressed"/>    <!-- Common types: compressed, theora (see "rosrun image_transport list_transports") -->
  <arg name="depth_image_transport"   default="compressedDepth"/>  <!-- Depth compatible types: compressedDepth (see "rosrun image_transport list_transports") -->

  <arg name="gen_cloud"               default="false"/> <!-- only works with depth image and if not subscribing to scan_cloud topic-->
  <arg name="gen_cloud_decimation"    default="4"/>
  <arg name="gen_cloud_voxel"         default="0.05"/>

  <arg name="subscribe_scan"          default="false"/>
  <arg name="scan_topic"              default="/scan"/>
  <arg name="subscribe_scan_cloud"    default="$(arg gen_cloud)"/>
  <arg name="scan_cloud_topic"        default="/scan_cloud"/>
  <arg name="subscribe_scan_descriptor" default="false"/>
  <arg name="scan_descriptor_topic"   default="/scan_descriptor"/>
  <arg name="scan_deskewing"          default="false"/>
  <arg name="scan_deskewing_slerp"    default="false"/>
  <arg name="scan_cloud_max_points"   default="0"/>
  <arg name="scan_cloud_filtered"     default="$(arg scan_deskewing)"/> <!-- use filtered cloud from icp_odometry for mapping -->
  <arg name="gen_scan"                default="false"/> <!-- only works with depth image and if not subscribing to scan topic-->

  <arg name="gen_depth"                  default="false" /> <!-- Generate depth image from scan_cloud -->
  <arg name="gen_depth_decimation"       default="1" />
  <arg name="gen_depth_fill_holes_size"  default="0" />
  <arg name="gen_depth_fill_iterations"  default="1" />
  <arg name="gen_depth_fill_holes_error" default="0.1" />

  <arg name="visual_odometry"          default="true"/>          <!-- Launch rtabmap visual odometry node -->
  <arg name="icp_odometry"             default="false"/>         <!-- Launch rtabmap icp odometry node -->
  <arg name="odom_topic"               default="vo"/>          <!-- Odometry topic name -->
  <arg name="vo_frame_id"              default="odom"/> <!-- Visual/Icp odometry frame ID for TF -->
  <arg name="publish_tf_odom"          default="false"/>
  <arg name="odom_tf_angular_variance" default="0.001"/>         <!-- If TF is used to get odometry, this is the default angular variance -->
  <arg name="odom_tf_linear_variance"  default="0.001"/>         <!-- If TF is used to get odometry, this is the default linear variance -->
  <arg name="odom_args"                default=""/>              <!-- More arguments for odometry (overwrite same parameters in rtabmap_args) -->
  <arg name="odom_sensor_sync"         default="false"/>
  <arg name="odom_guess_frame_id"        default=""/>
  <arg name="odom_guess_min_translation" default="0"/>
  <arg name="odom_guess_min_rotation"    default="0"/>
  <arg name="odom_max_rate"            default="0"/>
  <arg name="odom_expected_rate"       default="0"/>
  <arg name="imu_topic"                default="/imu/data"/>          <!-- only used with VIO approaches -->
  <arg name="wait_imu_to_init"         default="false"/>
  <arg name="use_odom_features"        default="false"/>
  <arg name="r_l_odom"        default="/odometry/filtered/local"/>
  

  <arg name="scan_cloud_assembling"              default="false"/>
  <arg name="scan_cloud_assembling_time"         default="1"/>      <!-- max_clouds and time should not be set at the same time -->
  <arg name="scan_cloud_assembling_max_clouds"   default="0"/>      <!-- max_clouds and time should not be set at the same time -->
  <arg name="scan_cloud_assembling_fixed_frame"  default=""/>
  <arg name="scan_cloud_assembling_voxel_size"   default="0.05"/>
  <arg name="scan_cloud_assembling_range_min"    default="0.0"/>    <!-- 0=disabled -->
  <arg name="scan_cloud_assembling_range_max"    default="0.0"/>    <!-- 0=disabled -->
  <arg name="scan_cloud_assembling_noise_radius"   default="0.0"/>    <!-- 0=disabled -->
  <arg name="scan_cloud_assembling_noise_min_neighbors"   default="5"/>

  <arg name="subscribe_user_data"      default="false"/>             <!-- user data synchronized subscription -->
  <arg name="user_data_topic"          default="/user_data"/>
  <arg name="user_data_async_topic"    default="/user_data_async" /> <!-- user data async subscription (rate should be lower than map update rate) -->

  <arg name="gps_topic"                default="/gps/fix" />         <!-- gps async subscription -->

  <arg name="tag_topic"                default="/tag_detections" />  <!-- apriltags async subscription -->
  <arg name="tag_linear_variance"      default="0.0001" />
  <arg name="tag_angular_variance"     default="9999" />             <!-- >=9999 means ignore rotation in optimization, when rotation estimation of the tag is not reliable -->
  <arg name="fiducial_topic"           default="/fiducial_transforms" />  <!-- aruco_detect async subscription, use tag_linear_variance and tag_angular_variance to set covriance -->

  <!-- These arguments should not be modified directly, see referred topics without "_relay" suffix above -->
  <arg if="$(arg compressed)"     name="rgb_topic_relay"           default="$(arg rgb_topic)_relay"/>
  <arg unless="$(arg compressed)" name="rgb_topic_relay"           default="$(arg rgb_topic)"/>
  <arg if="$(arg compressed)"     name="depth_topic_relay"         default="$(arg depth_topic)_relay"/>
  <arg unless="$(arg compressed)" name="depth_topic_relay"         default="$(arg depth_topic)"/>
  <arg if="$(arg compressed)"     name="left_image_topic_relay"    default="$(arg left_image_topic)_relay"/>
  <arg unless="$(arg compressed)" name="left_image_topic_relay"    default="$(arg left_image_topic)"/>
  <arg if="$(arg compressed)"     name="right_image_topic_relay"   default="$(arg right_image_topic)_relay"/>
  <arg unless="$(arg compressed)" name="right_image_topic_relay"   default="$(arg right_image_topic)"/>
  <arg if="$(arg rgbd_sync)"      name="rgbd_topic_relay"          default="$(arg rgbd_topic)"/>
  <arg unless="$(arg rgbd_sync)"  name="rgbd_topic_relay"          default="$(arg rgbd_topic)_relay"/>

  <!-- Nodes -->
  <group ns="$(arg namespace)">

    <!-- relays -->
    <group if="$(arg depth)">
      <group unless="$(arg subscribe_rgbd)">
        <node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg rgb_topic) raw out:=$(arg rgb_topic_relay)" />
        <node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="$(arg depth_image_transport) in:=$(arg depth_topic) raw out:=$(arg depth_topic_relay)" />
      </group>
      <group if="$(arg rgbd_sync)">
        <node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg rgb_topic) raw out:=$(arg rgb_topic_relay)" />
        <node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="$(arg depth_image_transport) in:=$(arg depth_topic) raw out:=$(arg depth_topic_relay)" />
        <node pkg="nodelet" type="nodelet" name="rgbd_sync" args="standalone rtabmap_sync/rgbd_sync" clear_params="$(arg clear_params)" output="$(arg output)">
          <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
          <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
          <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
          <remap from="rgbd_image"      to="$(arg rgbd_topic_relay)"/>
          <param name="approx_sync"     type="bool"   value="$(arg approx_rgbd_sync)"/>
          <param name="approx_sync_max_interval" type="double" value="$(arg approx_sync_max_interval)"/>
          <param name="queue_size"      type="int"    value="$(arg queue_size)"/>
          <param name="depth_scale"     type="double" value="$(arg rgbd_depth_scale)"/>
          <param name="decimation"     type="double" value="$(arg rgbd_decimation)"/>
        </node>
      </group>
    </group>
    <group if="$(arg stereo)">
      <group unless="$(arg subscribe_rgbd)">
        <node if="$(arg compressed)" name="republish_left"  type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg left_image_topic) raw out:=$(arg left_image_topic_relay)" />
        <node if="$(arg compressed)" name="republish_right" type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg right_image_topic) raw out:=$(arg right_image_topic_relay)" />
      </group>
      <group if="$(arg rgbd_sync)">
        <node if="$(arg compressed)" name="republish_left"  type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg left_image_topic) raw out:=$(arg left_image_topic_relay)" />
        <node if="$(arg compressed)" name="republish_right" type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg right_image_topic) raw out:=$(arg right_image_topic_relay)" />
        <node pkg="nodelet" type="nodelet" name="stereo_sync" args="standalone rtabmap_sync/stereo_sync" clear_params="$(arg clear_params)" output="$(arg output)">
          <remap from="left/image_rect"   to="$(arg left_image_topic_relay)"/>
          <remap from="right/image_rect"  to="$(arg right_image_topic_relay)"/>
          <remap from="left/camera_info"  to="$(arg left_camera_info_topic)"/>
          <remap from="right/camera_info" to="$(arg right_camera_info_topic)"/>
          <remap from="rgbd_image"      to="$(arg rgbd_topic_relay)"/>
          <param name="approx_sync"     type="bool"   value="$(arg approx_rgbd_sync)"/>
          <param name="approx_sync_max_interval" type="double" value="$(arg approx_sync_max_interval)"/>
          <param name="queue_size"      type="int"    value="$(arg queue_size)"/>
        </node>
      </group>
    </group>

    <group unless="$(arg rgbd_sync)">
       <group if="$(arg subscribe_rgbd)">
         <node name="republish_rgbd_image"  type="rgbd_relay" pkg="rtabmap_util" clear_params="$(arg clear_params)">
           <remap     if="$(arg compressed)" from="rgbd_image" to="$(arg rgbd_topic)/compressed"/>
           <remap     if="$(arg compressed)" from="$(arg rgbd_topic)/compressed_relay" to="$(arg rgbd_topic_relay)"/>
           <remap unless="$(arg compressed)" from="rgbd_image" to="$(arg rgbd_topic)"/>
           <param if="$(arg compressed)" name="uncompress" value="true"/>
         </node>
      </group>
    </group>

    <node if="$(arg gen_cloud)" pkg="nodelet" type="nodelet" name="gen_cloud_from_depth" args="standalone rtabmap_util/point_cloud_xyz" clear_params="$(arg clear_params)" output="$(arg output)">
      <remap from="depth/image"       to="$(arg depth_topic_relay)"/>
      <remap from="depth/camera_info" to="$(arg camera_info_topic)"/>
      <remap from="cloud"             to="$(arg scan_cloud_topic)" />

      <param name="decimation"  type="double" value="$(arg gen_cloud_decimation)"/>
      <param name="voxel_size"  type="double" value="$(arg gen_cloud_voxel)"/>
      <param name="approx_sync" type="bool"   value="false"/>
      <param name="approx_sync_max_interval" type="double" value="$(arg approx_sync_max_interval)"/>
    </node>

    <!-- Visual odometry -->
    <group unless="$(arg icp_odometry)">
      <group if="$(arg visual_odometry)">
      
      <!-- ///////////////////////////////////////////////////////////************RGBD ODOM ODOMETRY ***************//////////////////////////////////////////////////////////////////////////////// -->

        <!-- RGB-D Odometry -->
        <node unless="$(arg stereo)" pkg="rtabmap_odom" type="rgbd_odometry" name="rgbd_odometry" clear_params="$(arg clear_params)" output="$(arg output)" args="$(arg rtabmap_args) $(arg odom_args)" launch-prefix="$(arg launch_prefix)">
          <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
          <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
          <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>
          <remap from="rgbd_image"      to="$(arg rgbd_topic_relay)"/>
          <remap from="odom"            to="$(arg odom_topic)"/>
          <remap from="imu"             to="$(arg imu_topic)"/>

          <param name="frame_id"                    type="string" value="$(arg frame_id)"/>
          <param name="odom_frame_id"               type="string" value="$(arg vo_frame_id)"/>
          <param name="publish_tf"                  type="bool"   value="$(arg publish_tf_odom)"/>
          <param name="ground_truth_frame_id"       type="string" value="$(arg ground_truth_frame_id)"/>
          <param name="ground_truth_base_frame_id"  type="string" value="$(arg ground_truth_base_frame_id)"/>
          <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
          <param name="wait_imu_to_init"            type="bool"   value="$(arg wait_imu_to_init)"/>
          <param name="approx_sync"                 type="bool"   value="$(arg approx_sync)"/>
          <param name="approx_sync_max_interval"    type="double" value="$(arg approx_sync_max_interval)"/>
          <param name="config_path"                 type="string" value="$(arg cfg)"/>
          <param name="queue_size"                  type="int"    value="$(arg queue_size)"/>
          <param name="subscribe_rgbd"              type="bool"   value="$(arg subscribe_rgbd)"/>
          <param name="guess_frame_id"              type="string" value="$(arg odom_guess_frame_id)"/>
          <param name="guess_min_translation"       type="double" value="$(arg odom_guess_min_translation)"/>
          <param name="guess_min_rotation"          type="double" value="$(arg odom_guess_min_rotation)"/>
          <param name="expected_update_rate"        type="double" value="$(arg odom_expected_rate)"/>
          <param name="max_update_rate"             type="double" value="$(arg odom_max_rate)"/>
          <param name="keep_color"                  type="bool"   value="$(arg use_odom_features)"/>
        </node>

        <!-- Stereo Odometry -->
        <node if="$(arg stereo)" pkg="rtabmap_odom" type="stereo_odometry" name="stereo_odometry" clear_params="$(arg clear_params)" output="$(arg output)" args="$(arg rtabmap_args) $(arg odom_args)" launch-prefix="$(arg launch_prefix)">
          <remap from="left/image_rect"        to="$(arg left_image_topic_relay)"/>
          <remap from="right/image_rect"       to="$(arg right_image_topic_relay)"/>
          <remap from="left/camera_info"       to="$(arg left_camera_info_topic)"/>
          <remap from="right/camera_info"      to="$(arg right_camera_info_topic)"/>
          <remap from="rgbd_image"             to="$(arg rgbd_topic_relay)"/>
          <remap from="odom"                   to="$(arg odom_topic)"/>
          <remap from="imu"                    to="$(arg imu_topic)"/>

          <param name="frame_id"                    type="string" value="$(arg frame_id)"/>
          <param name="odom_frame_id"               type="string" value="$(arg vo_frame_id)"/>
          <param name="publish_tf"                  type="bool"   value="$(arg publish_tf_odom)"/>
          <param name="ground_truth_frame_id"       type="string" value="$(arg ground_truth_frame_id)"/>
          <param name="ground_truth_base_frame_id"  type="string" value="$(arg ground_truth_base_frame_id)"/>
          <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
          <param name="wait_imu_to_init"            type="bool"   value="$(arg wait_imu_to_init)"/>
          <param name="approx_sync"                 type="bool"   value="$(arg approx_sync)"/>
          <param name="approx_sync_max_interval"    type="double" value="$(arg approx_sync_max_interval)"/>
          <param name="config_path"                 type="string" value="$(arg cfg)"/>
          <param name="queue_size"                  type="int"    value="$(arg queue_size)"/>
          <param name="subscribe_rgbd"              type="bool"   value="$(arg subscribe_rgbd)"/>
          <param name="guess_frame_id"              type="string" value="$(arg odom_guess_frame_id)"/>
          <param name="guess_min_translation"       type="double" value="$(arg odom_guess_min_translation)"/>
          <param name="guess_min_rotation"          type="double" value="$(arg odom_guess_min_rotation)"/>
          <param name="expected_update_rate"        type="double" value="$(arg odom_expected_rate)"/>
          <param name="max_update_rate"             type="double" value="$(arg odom_max_rate)"/>
          <param name="keep_color"                  type="bool"   value="$(arg use_odom_features)"/>
        </node>
      </group>
    </group>

    <!-- ICP Odometry -->
    <node if="$(arg icp_odometry)" pkg="rtabmap_odom" type="icp_odometry" name="icp_odometry" clear_params="$(arg clear_params)" output="$(arg output)" args="$(arg rtabmap_args) $(arg odom_args)" launch-prefix="$(arg launch_prefix)">
      <remap from="scan"                   to="$(arg scan_topic)"/>
      <remap from="scan_cloud"             to="$(arg scan_cloud_topic)"/>
      <remap from="odom"                   to="$(arg odom_topic)"/>
      <remap from="imu"                    to="$(arg imu_topic)"/>

      <param name="frame_id"                    type="string" value="$(arg frame_id)"/>
      <param name="odom_frame_id"               type="string" value="$(arg vo_frame_id)"/>
      <param name="publish_tf"                  type="bool"   value="$(arg publish_tf_odom)"/>
      <param name="ground_truth_frame_id"       type="string" value="$(arg ground_truth_frame_id)"/>
      <param name="ground_truth_base_frame_id"  type="string" value="$(arg ground_truth_base_frame_id)"/>
      <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
      <param name="wait_imu_to_init"            type="bool"   value="$(arg wait_imu_to_init)"/>
      <param name="config_path"                 type="string" value="$(arg cfg)"/>
      <param name="queue_size"                  type="int"    value="$(arg queue_size)"/>
      <param name="guess_frame_id"              type="string" value="$(arg odom_guess_frame_id)"/>
      <param name="guess_min_translation"       type="double" value="$(arg odom_guess_min_translation)"/>
      <param name="guess_min_rotation"          type="double" value="$(arg odom_guess_min_rotation)"/>
      <param name="scan_cloud_max_points"       type="int"    value="$(arg scan_cloud_max_points)"/>
      <param name="expected_update_rate"        type="double" value="$(arg odom_expected_rate)"/>
      <param name="max_update_rate"             type="double" value="$(arg odom_max_rate)"/>
      <param name="deskewing"                   type="bool"   value="$(arg scan_deskewing)"/>
      <param name="deskewing_slerp"             type="bool"   value="$(arg scan_deskewing_slerp)"/>
    </node>

    <node if="$(eval not icp_odometry and scan_deskewing and subscribe_scan_cloud)" pkg="rtabmap_util" type="lidar_deskewing" name="lidar_deskewing" clear_params="$(arg clear_params)" output="$(arg output)">
      <param name="wait_for_transform" value="$(arg wait_for_transform)"/>
      <param     if="$(arg visual_odometry)" name="fixed_frame_id" value="$(arg vo_frame_id)"/>
      <param unless="$(arg visual_odometry)" name="fixed_frame_id" value="$(arg odom_frame_id)"/>
      <param name="slerp" value="$(arg scan_deskewing_slerp)"/>
      <remap from="input_cloud" to="$(arg scan_cloud_topic)"/>
      <remap from="$(arg scan_cloud_topic)/deskewed" to="odom_filtered_input_scan"/>
    </node>

    <node if="$(arg scan_cloud_assembling)" pkg="rtabmap_util" type="point_cloud_assembler" name="point_cloud_assembler" clear_params="$(arg clear_params)" output="$(arg output)">
      <remap     if="$(arg scan_cloud_filtered)" from="cloud" to="odom_filtered_input_scan"/>
      <remap unless="$(arg scan_cloud_filtered)" from="cloud" to="$(arg scan_cloud_topic)"/>

      <remap from="odom"            to="$(arg odom_topic)"/>
      <param name="assembling_time" type="double" value="$(arg scan_cloud_assembling_time)"/>
      <param name="max_clouds"      type="int"    value="$(arg scan_cloud_assembling_max_clouds)"/>
      <param name="fixed_frame_id"  type="string" value="$(arg scan_cloud_assembling_fixed_frame)"/>
      <param name="voxel_size"      type="double" value="$(arg scan_cloud_assembling_voxel_size)"/>
      <param name="range_min"       type="double" value="$(arg scan_cloud_assembling_range_min)"/>
      <param name="range_max"       type="double" value="$(arg scan_cloud_assembling_range_max)"/>
      <param name="noise_radius"        type="double" value="$(arg scan_cloud_assembling_noise_radius)"/>
      <param name="noise_min_neighbors" type="int"    value="$(arg scan_cloud_assembling_noise_min_neighbors)"/>
      <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
    </node>

    <!-- Visual SLAM (robot side) -->
    <!-- args: "delete_db_on_start" and "udebug" -->
    <node name="rtabmap" pkg="rtabmap_slam" type="rtabmap" clear_params="$(arg clear_params)" output="$(arg output)" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)">
      <param     if="$(arg stereo)" name="subscribe_depth"  type="bool" value="false"/>
      <param unless="$(arg stereo)" name="subscribe_depth"  type="bool" value="$(arg depth)"/>
      <param name="subscribe_rgb"        type="bool"   value="$(arg subscribe_rgb)"/>
      <param name="subscribe_rgbd"       type="bool"   value="$(eval subscribe_rgbd or use_odom_features)"/>
      <param name="subscribe_stereo"     type="bool"   value="$(arg stereo)"/>
      <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_scan_descriptor" type="bool" value="$(arg subscribe_scan_descriptor)"/>
      <param name="subscribe_user_data"  type="bool"   value="$(arg subscribe_user_data)"/>
      <param if="$(arg visual_odometry)" name="subscribe_odom_info" type="bool" value="true"/>
      <param if="$(arg icp_odometry)"    name="subscribe_odom_info" type="bool" value="true"/>
      <param name="frame_id"             type="string" value="$(arg frame_id)"/>
      <param name="map_frame_id"         type="string" value="$(arg map_frame_id)"/>
      <param name="odom_frame_id"        type="string" value="$(arg odom_frame_id)"/>
      <param name="odom_frame_id_init"   type="string" value="$(arg odom_frame_id_init)"/>
      <param name="publish_tf"           type="bool"   value="$(arg publish_tf_map)"/>
      <param name="initial_pose"         type="string" value="$(arg initial_pose)"/>
      <param name="gen_scan"             type="bool"   value="$(arg gen_scan)"/>
      <param name="ground_truth_frame_id"       type="string" value="$(arg ground_truth_frame_id)"/>
      <param name="ground_truth_base_frame_id"  type="string" value="$(arg ground_truth_base_frame_id)"/>
      <param name="odom_tf_angular_variance" type="double" value="$(arg odom_tf_angular_variance)"/>
      <param name="odom_tf_linear_variance"  type="double" value="$(arg odom_tf_linear_variance)"/>
      <param name="odom_sensor_sync"         type="bool"   value="$(arg odom_sensor_sync)"/>
      <param name="wait_for_transform_duration"  type="double"   value="$(arg wait_for_transform)"/>
      <param name="database_path"        type="string" value="$(arg database_path)"/>
      <param name="approx_sync"          type="bool"   value="$(eval approx_sync and not use_odom_features)"/>
      <param name="config_path"          type="string" value="$(arg cfg)"/>
      <param name="queue_size"           type="int" value="$(arg queue_size)"/>
      <param if="$(eval not scan_cloud_filtered and not scan_cloud_assembling)" name="scan_cloud_max_points" type="int" value="$(arg scan_cloud_max_points)"/>
      <param name="landmark_linear_variance"   type="double" value="$(arg tag_linear_variance)"/>
      <param name="landmark_angular_variance"  type="double" value="$(arg tag_angular_variance)"/>
      <param name="gen_depth"                  type="bool"   value="$(arg gen_depth)" />
      <param name="gen_depth_decimation"       type="int"    value="$(arg gen_depth_decimation)" />
      <param name="gen_depth_fill_holes_size"  type="int"    value="$(arg gen_depth_fill_holes_size)" />
      <param name="gen_depth_fill_iterations"  type="int"    value="$(arg gen_depth_fill_iterations)" />
      <param name="gen_depth_fill_holes_error" type="double" value="$(arg gen_depth_fill_holes_error)" />

      <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
      <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

      <remap     if="$(arg use_odom_features)" from="rgbd_image" to="odom_rgbd_image"/>
      <remap unless="$(arg use_odom_features)" from="rgbd_image" to="$(arg rgbd_topic_relay)"/>

      <remap from="left/image_rect"        to="$(arg left_image_topic_relay)"/>
      <remap from="right/image_rect"       to="$(arg right_image_topic_relay)"/>
      <remap from="left/camera_info"       to="$(arg left_camera_info_topic)"/>
      <remap from="right/camera_info"      to="$(arg right_camera_info_topic)"/>

      <remap from="scan"                   to="$(arg scan_topic)"/>
      <remap if="$(eval scan_cloud_assembling)" from="scan_cloud" to="assembled_cloud"/>
      <remap if="$(eval scan_cloud_filtered and not scan_cloud_assembling)" from="scan_cloud" to="odom_filtered_input_scan"/>
      <remap if="$(eval not scan_cloud_filtered and not scan_cloud_assembling)" from="scan_cloud" to="$(arg scan_cloud_topic)"/>
      <remap from="scan_descriptor"        to="$(arg scan_descriptor_topic)"/>
      <remap from="user_data"              to="$(arg user_data_topic)"/>
      <remap from="user_data_async"        to="$(arg user_data_async_topic)"/>
      <remap from="gps/fix"                to="$(arg gps_topic)"/>
      <remap from="tag_detections"         to="$(arg tag_topic)"/>
      <remap from="fiducial_transforms"    to="$(arg fiducial_topic)"/>
      <remap from="odom"                   to="$(arg r_l_odom)"/>
      <remap from="imu"                    to="$(arg imu_topic)"/>

      <!-- 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>

    <!-- Visualisation RTAB-Map -->
    <node if="$(arg rtabmap_viz)" pkg="rtabmap_viz" type="rtabmap_viz" name="rtabmap_viz" args="-d $(arg gui_cfg)" clear_params="$(arg clear_params)" output="$(arg output)" launch-prefix="$(arg launch_prefix)">
      <param     if="$(arg stereo)" name="subscribe_depth"  type="bool" value="false"/>
      <param unless="$(arg stereo)" name="subscribe_depth"  type="bool" value="$(arg depth)"/>
      <param name="subscribe_rgb"        type="bool"   value="$(arg subscribe_rgb)"/>
      <param name="subscribe_rgbd"       type="bool"   value="$(eval subscribe_rgbd or use_odom_features)"/>
      <param name="subscribe_stereo"     type="bool"   value="$(arg stereo)"/>
      <param unless="$(arg icp_odometry)" name="subscribe_scan"       type="bool"   value="$(arg subscribe_scan)"/>
      <param     if="$(arg icp_odometry)" name="subscribe_scan_cloud" type="bool"   value="$(eval subscribe_scan or subscribe_scan_cloud)"/>
      <param unless="$(arg icp_odometry)" name="subscribe_scan_cloud" type="bool"   value="$(arg subscribe_scan_cloud)"/>
      <param name="subscribe_scan_descriptor" type="bool" value="$(arg subscribe_scan_descriptor)"/>
      <param if="$(arg visual_odometry)" name="subscribe_odom_info" type="bool" value="true"/>
      <param if="$(arg icp_odometry)"    name="subscribe_odom_info" type="bool" value="true"/>
      <param name="frame_id"             type="string" value="$(arg frame_id)"/>
      <param name="odom_frame_id"        type="string" value="$(arg odom_frame_id)"/>
      <param name="wait_for_transform_duration" type="double"   value="$(arg wait_for_transform)"/>
      <param name="queue_size"           type="int"    value="$(arg queue_size)"/>
      <param name="approx_sync"          type="bool"   value="$(eval approx_sync and not use_odom_features)"/>

      <remap from="rgb/image"       to="$(arg rgb_topic_relay)"/>
      <remap from="depth/image"     to="$(arg depth_topic_relay)"/>
      <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/>

      <remap     if="$(arg use_odom_features)" from="rgbd_image" to="odom_rgbd_image"/>
      <remap unless="$(arg use_odom_features)" from="rgbd_image" to="$(arg rgbd_topic_relay)"/>

      <remap from="left/image_rect"        to="$(arg left_image_topic_relay)"/>
      <remap from="right/image_rect"       to="$(arg right_image_topic_relay)"/>
      <remap from="left/camera_info"       to="$(arg left_camera_info_topic)"/>
      <remap from="right/camera_info"      to="$(arg right_camera_info_topic)"/>

      <remap unless="$(arg icp_odometry)" from="scan" to="$(arg scan_topic)"/>
      <remap     if="$(eval icp_odometry or scan_cloud_filtered)" from="scan_cloud" to="odom_filtered_input_scan"/>
      <remap unless="$(eval icp_odometry or scan_cloud_filtered)" from="scan_cloud" to="$(arg scan_cloud_topic)"/>
      <remap from="scan_descriptor"        to="$(arg scan_descriptor_topic)"/>
      <remap from="odom"                   to="$(arg odom_topic)"/>
    </node>

  </group>

  <!-- Visualization RVIZ -->
  <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(arg rviz_cfg)"/>
  <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="standalone rtabmap_util/point_cloud_xyzrgb" clear_params="$(arg clear_params)" output="$(arg output)">
    <remap if="$(arg stereo)" from="left/image"        to="$(arg left_image_topic_relay)"/>
    <remap if="$(arg stereo)" from="right/image"       to="$(arg right_image_topic_relay)"/>
    <remap if="$(arg stereo)" from="left/camera_info"  to="$(arg left_camera_info_topic)"/>
    <remap if="$(arg stereo)" from="right/camera_info" to="$(arg right_camera_info_topic)"/>
    <remap unless="$(arg subscribe_rgbd)" from="rgb/image"         to="$(arg rgb_topic_relay)"/>
    <remap unless="$(arg subscribe_rgbd)" from="depth/image"       to="$(arg depth_topic_relay)"/>
    <remap unless="$(arg subscribe_rgbd)" from="rgb/camera_info"   to="$(arg camera_info_topic)"/>
    <remap from="rgbd_image"        to="$(arg rgbd_topic_relay)"/>
    <remap from="cloud"             to="voxel_cloud" />

    <param name="decimation"  type="double" value="4"/>
    <param name="voxel_size"  type="double" value="0.0"/>
    <param name="approx_sync" type="bool"   value="$(arg approx_sync)"/>
    <param name="approx_sync_max_interval" type="double" value="$(arg approx_sync_max_interval)"/>
  </node>

</launch>

and some screenshots:





When the camera is static, I get:  The time difference between rgb and depth frames is high (diff=0.033357s, rgb=1692189046.376037s, depth=1692189046.409394s). You may want to set approx_sync_max_interval lower than 0.01s to reject spurious bad synchronizations or use approx_sync=false if streams have all the exact same timestamp.

When I tmove the ugv and try to take a turn the warnings are denser and the map is like this:



Its like the frames are sliding. I also launch the realsense rs_camera.launch with align_depth:=true

Can you help me rectify this?

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

xantho
I forgot to point out that I am feeding rtabmap/vo to robot_localization
and in the ekf launch file I remap /odometry/filtered to /odometry/filtered/local
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

matlabbe
Administrator
I would suggest to make your own launch file instead of modifying rtabmap.launch because it takes too long for reviewers to spot the differences.

The screenshots of previous post have been re-scaled, make it impossible to read the text.

I have difficulty to understand where is the problem coming from, is it rtabmap's vo? the actual fusion? I would try to compare with and without odometry fusion first, as right now I cannot say if it is coming from rtabmap's vo or from fusion.

Looks like the RGB/Depth frames are wrongly synchronized, I'll suggest to follow suggestions in the warning.

If you are interested on the maximum VO accuracy with D435, use stereo mode with left/right IR images (with IR emitter disabled).

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

xantho
This post was updated on .
Thanks for your reply. This is definitely a start.

So, I am using this launch file:

<launch>

<!-- This launch assumes that you have already
   started you preferred RGB-D sensor and your IMU.
   TF between frame_id and the sensors should already be set too. -->

<arg name="rviz"                    default="true" />
<arg name="frame_id"                default="base_link"/>
<arg name="vis_odom_topic"          default="/rtabmap/odom"/>
<arg name="imu_topic"               default="/imu/data" />
<arg name="imu_remove_gravitational_acceleration" default="false" />
<arg name="localization"            default="false"/>

<include file="$(find rtabmap_launch)/launch/rtabmap.launch">
    <arg unless="$(arg localization)" name="rtabmap_args" value="--delete_db_on_start"/>
    <arg name="frame_id" value="$(arg frame_id)"/>
    <arg name="stereo"         value="true"/>
    <arg name="subscribe_rgbd" value="false"/>
    <arg name="subscribe_scan" value="false"/>

    <!-- stereo related topics -->
    <arg name="left_image_topic"        default="/camera/infra1/image_rect_raw" />
    <arg name="right_image_topic"       default="/camera/infra2/image_rect_raw" />      <!-- using grayscale image for efficiency -->
    <arg name="left_camera_info_topic"  default="/camera/infra1/camera_info" />
    <arg name="right_camera_info_topic" default="/camera/infra2/camera_info" />
    
    <arg name="rgbd_topic"  value="/rgbd_image"/> 

    <arg name="visual_odometry" value="true"/>
    <arg name="queue_size"  value="30"/>
    <arg name="compressed"  value="true"/>
    <arg name="rviz"        value="$(arg rviz)"/>
    <arg if="$(arg rviz)" name="rtabmap_viz"  value="false"/>  
    
    <arg name="approx_sync" value="false"/> <!-- cannot use exact sync with external odom -->
    <arg name="publish_tf_odom" value="false"/> <!-- to avoid conflicts with robot_localization odom tf -->
    <!-- <arg name="subscribe_odom_info" value="false"/> external odom used -->

</include>

<!-- Odometry fusion (EKF), refer to demo launch file in robot_localization for more info -->
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" clear_params="true" output="screen">

    <param name="frequency" value="50"/>
    <param name="sensor_timeout" value="0.1"/>
    <param name="two_d_mode" value="true"/>

    <param name="odom_frame" value="odom"/>
    <param name="base_link_frame" value="$(arg frame_id)"/>
    <param name="world_frame" value="odom"/>

    <param name="transform_time_offset" value="0.0"/>
    
    <param name="odom0"  value="$(arg vis_odom_topic)"/>
    <param name="imu0" value="$(arg imu_topic)"/>

    <!-- The order of the values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. -->
    <rosparam param="odom0_config">[true, true, false,
                                    false, false, false,
                                    true, true, false,
                                    false, false, false,
                                    false, false, false]</rosparam>
    
    <rosparam param="imu0_config">[false, false, false,
                                    false,  false,  true,
                                    false, false, false,
                                    false,  false,  true,
                                    false,  false,  false]</rosparam>

    <param name="odom0_differential" value="false"/>
    <param name="imu0_differential" value="false"/>

    <param name="odom0_relative"  value="true"/>
    <param name="imu0_relative" value="true"/>

    <param name="odom0_queue_size" value="5"/>
    <param name="imu0_queue_size" value="50"/>

    <!-- The values are ordered as x, y, z, roll, pitch, yaw, vx, vy, vz,
       vroll, vpitch, vyaw, ax, ay, az. -->
    <rosparam param="process_noise_covariance">[0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0.06, 0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0.025, 0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0.025, 0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0.04, 0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0.01, 0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0.01, 0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0.02, 0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0.01, 0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0.01, 0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0.015]</rosparam>

    <!-- The values are ordered as x, y,
    z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. -->
    <rosparam param="initial_estimate_covariance">[1e-9, 0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                    0,    1e-9, 0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                    0,    0,    1e-9, 0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                    0,    0,    0,    1e-9, 0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,     0,     0,     0,    0,    0,
                                                    0,    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,     0,     0,     0,    0,    0,
                                                    0,    0,    0,    0,    0,    0,    0,    0,    1e-9, 0,     0,     0,     0,    0,    0,
                                                    0,    0,    0,    0,    0,    0,    0,    0,    0,    1e-9,  0,     0,     0,    0,    0,
                                                    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     1e-9,  0,     0,    0,    0,
                                                    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     1e-9,  0,    0,    0,
                                                    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     1e-9, 0,    0,
                                                    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    1e-9, 0,
                                                    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    1e-9]</rosparam>

</node>
</launch>

for the rtabmap.launch I am remapping as follows:
<arg name="r_l_odom"                 default="/odometry/filtered"/>
<remap from="odom"                   to="$(arg r_l_odom)"/>
But rtabmap does not provide me with a map and I get the following:

[ INFO] [1692625446.142334056]: Odom: quality=448, std dev=0.003291m|0.011465rad, update time=0.061720s
[ INFO] [1692625446.225222154]: Odom: quality=454, std dev=0.003636m|0.011465rad, update time=0.073603s
[ INFO] [1692625446.300038160]: Odom: quality=444, std dev=0.003038m|0.008712rad, update time=0.071599s
[ WARN] [1692625446.319219789]: /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"). Parameter "approx_sync" is false, which means that input topics should have all the exact timestamp for the callback to be called.
/rtabmap/rtabmap subscribed to (exact sync):
   /odometry/filtered \
   /camera/infra1/image_rect_raw_relay \
   /camera/infra2/image_rect_raw_relay \
   /camera/infra1/camera_info \
   /camera/infra2/camera_info \
   /rtabmap/odom_info
[ INFO] [1692625446.393891883]: Odom: quality=456, std dev=0.003119m|0.000173rad, update time=0.071331s
[ INFO] [1692625446.488615394]: Odom: quality=429, std dev=0.003235m|0.010360rad, update time=0.069431s
[ INFO] [1692625446.591836136]: Odom: quality=433, std dev=0.003581m|0.021486rad, update time=0.067578s
[ INFO] [1692625446.695476868]: Odom: quality=440, std dev=0.002802m|0.000173rad, update time=0.069887s
[ INFO] [1692625446.784578256]: Odom: quality=437, std dev=0.003176m|0.014651rad, update time=0.062510s
[ INFO] [1692625446.877034063]: Odom: quality=433, std dev=0.002919m|0.012320rad, update time=0.062300s
[ WARN] [1692625446.905675660]: Transform from imu_link to base_link was unavailable for the time requested. Using latest instead.
 
The camera topics are coming from my ugv and the rtabmap runs on my laptop. The 2 pc's are synchronized using ntpdate.
I also have a nodelet manager (running on the laptop):

NODES
  /
    nodelet_manager (nodelet/nodelet)
    stereo_sync (nodelet/nodelet)

ROS_MASTER_URI=http://localhost:11311/

process[nodelet_manager-1]: started with pid [1015491]
process[stereo_sync-2]: started with pid [1015492]
[ INFO] [1692617864.523122902]: Loading nodelet /stereo_sync of type rtabmap_sync/stereo_sync to manager nodelet_manager with the following remappings:
[ INFO] [1692617864.523657748]: /left/camera_info -> /camera/infra1/camera_info
[ INFO] [1692617864.523703523]: /left/image_rect -> /camera/infra1/image_rect_raw
[ INFO] [1692617864.523717080]: /rgbd_image -> /rgbd_image
[ INFO] [1692617864.523728656]: /right/camera_info -> /camera/infra2/camera_info
[ INFO] [1692617864.523739181]: /right/image_rect -> /camera/infra2/image_rect_raw
[ INFO] [1692617864.524612772]: waitForService: Service [/nodelet_manager/load_nodelet] has not been advertised, waiting...
[ INFO] [1692617864.566102953]: waitForService: Service [/nodelet_manager/load_nodelet] is now available.

Appreciate your input.
Reply | Threaded
Open this post in threaded view
|

Re: ros-noetic usage

matlabbe
Administrator
Hi,

I would add rgbd_sync:=true to pre-sync stereo images/camera_infos because the odometry topic generated from robot_localization won't have the exact stamp than the image topics. Set subscribe_odom_info:=false for rtabmap/rtabmap_viz nodes to avoid subscribing to odom info topic.

rtabmap would then subscribe only to a rgbd_image topic and the robot_localization's odom topic.

cheers,
Mathieu