0
$\begingroup$

Rosanswers logo

Hello!

I'm trying to do 3D mapping and navigation with ROS using Raspberry Pi 3 and XBOX Kinect 360 camera on Pioneer robot and laptop as a workstation from where I will be able to visualize and send commands to RPi3. On my laptop, I am running Ubuntu 14.04 LTS 32-bit with ROS Kinetic, and on RPi3 Ubuntu Mate with ROS Kinetic also.

I had some success when launching RTABMap on RPi3, and using laptop for visualization only, but now I want to do it remotely, so for start I modified these two launch files:

https://github.com/introlab/rtabmap_ros/blob/master/launch/azimut3/az3_remote_mapping_robot.launch https://github.com/introlab/rtabmap_ros/blob/master/launch/azimut3/az3_remote_mapping_rviz.launch

I'm providing the content of modified launch files below:

remote_robot.launch

    <launch>

    <arg name="rate"        default="25"/>
    <arg name="decimation"  default="1"/>
    <arg name="approx_sync" default="true"/>


<!--  PLATFORM SPECIFIC -->

   <!-- Base Controller -->
   <!-- Starting ROSARIA driver for motors and encoders -->
   <node pkg ="rosaria" type ="RosAria" name="RosAria">
    <param name="port" value="/dev/ttyUSB0" type="string"/>
   </node>
    <!-- Remapping -->
    <!--<remap from="/cmd_vel" to="/cmd_vel"/> -->
    <!--<remap from="/rosaria/cmd_vel" to="/cmd_vel" /> -->
    <!--<remap from="/rosaria/pose" to="/pose" /> -->
   
   
   <!-- RosAria client -->
   <!-- <include file="$(find rosaria_client)/launch/rosaria_client_launcher.launch" /> -->
   <!-- <node pkg="rosaria_client" type="interface" name="RosAria_interface" output="screen"/> -->

   <!-- TRANSFORMS -->
   <!-- static_transform_publisher x y z yaw pitch roll  frame_id   child_frame_id   period (ms) -->
   <node pkg="tf" type="static_transform_publisher" name="Pioneer3AT_tf" args="0.2 0.0 0.12 0 0 0 base_link camera_link 100" />
   

   <!-- SENSORS INFORMATION - Kinect driver, fakse scaner -->
   <!-- <include file="$(find pioneer_3at_nav)/myKinect.launch" /> -->
   <include file="$(find freenect_launch)/launch/freenect.launch">
      <arg name="depth_registration" value="true"/>
   </include>

  <!-- Fake laser -->
  <node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan">
    <remap from="image"         to="/camera/depth_registered/image_raw"/>
    <remap from="camera_info"   to="/camera/depth_registered/camera_info"/>
    <!--<remap from="scan"      to="/scan"/>-->
    <param name="range_max" type="double" value="4"/>
  </node>   
    
    
  <!-- Throttling messages -->
  <group ns="camera">
    <node pkg="nodelet" type="nodelet" name="data_throttle" args="load rtabmap_ros/data_throttle camera_nodelet_manager" output="screen">
     <!-- <param name="rate" type="double" value="5.0"/> -->
     <!-- <param name="approx_sync" type="bool" value="true"/> -->
      
      <param name="rate" type="double" value="$(arg rate)"/>
      <param name="decimation" type="int" value="$(arg decimation)"/>
      <param name="approx_sync" type="bool" value="$(arg approx_sync)"/>
      
      <remap from="rgb/image_in"       to="/camera/rgb/image_rect_color"/>
      <remap from="depth/image_in"     to="/camera/depth_registered/image_raw"/>
      <remap from="rgb/camera_info_in" to="/camera/depth_registered/camera_info"/>
    
      <remap from="rgb/image_out"       to="/camera/data_throttled_image"/>
      <remap from="depth/image_out"     to="/camera/data_throttled_image_depth"/>
      <remap from="rgb/camera_info_out" to="/camera/data_throttled_camera_info"/>
    </node>  
  </group>


   <!-- SLAM is done on client side...-->
</launch>

remote_mapping_rviz.launch

<launch>
  <arg name="rtabmap_args" default="" />    

  <!-- Remote teleop - RosAria -->
  <node pkg="rosaria_client" type="teleop" name="RosAria_interface" output="screen"/>
    <group ns="teleop">
       <remap from="~cmd_vel" to="/cmd_vel"/>
        </group>
      
  <!-- Visualization and SLAM nodes use same data, so just subscribe once and relay messages -->
  <node name="mapData_relay" type="relay" pkg="topic_tools" args="/rtabmap/mapData /rtabmap/mapData_relay"/>
  <node name="odom_relay" type="relay" pkg="topic_tools" args="/odom /odom_relay"/>
  <node name="scan_relay" type="relay" pkg="topic_tools" args="/scan /scan_relay"/>
  <node name="camera_info_relay" type="relay" pkg="topic_tools" args="/camera/data_throttled_camera_info /camera/data_throttled_camera_info_relay"/>
  <node name="republish_rgb" type="republish" pkg="image_transport" args="theora in:=/camera/data_throttled_image raw out:=/camera/data_throttled_image_relay" />
  <node name="republish_depth" type="republish" pkg="image_transport" args="compressedDepth in:=/camera/data_throttled_image_depth raw out:=/camera/data_throttled_image_depth_relay" />


  <!-- SLAM - client side -->
  <!-- args: "delete_db_on_start" and "udebug" -->
  <group ns="rtabmap">
    <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)">
      
      <param name="frame_id"        type="string" value="base_link"/>
      <param name="odom_frame_id"   type="string" value="odom"/>
    
      <param name="subscribe_depth" type="bool" value="true"/>
      <param name="subscribe_scan"  type="bool" value="true"/>
    
      <!-- Remapping RTAB-Map inputs -->
      <!-- <remap from="odom" to="/odom"/> -->
      <!-- <remap from="scan" to="/scan"/> -->
      <remap from="rgb/image" to="/camera/data_throttled_image"/>
      <remap from="depth/image" to="/camera/data_throttled_image_depth"/>
      <remap from="rgb/camera_info" to="/camera/data_throttled_camera_info"/>
      
       <!-- Remapping RTAB-Map outputs -->
      <!--<remap from="grid_map" to="/map"/> -->
      <!--<remap from="goal_out"  to="/rtabmap/goal_out"/>  -->
      <!--<remap from="move_base" to="/planner/move_base"/> -->
          
      
      <param name="queue_size" type="int" value="30"/>
    
      <!-- 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"/>
          <param name="RGBD/AngularUpdate"        type="string" value="0.01"/>
          <param name="RGBD/LinearUpdate"         type="string" value="0.01"/>
          <param name="RGBD/OptimizeFromGraphEnd" type="string" value="false"/>
     <!-- <param name="Optimizer/Slam2D"          type="string" value="true"/> -->
          <param name="Reg/Strategy"              type="string" value="1"/> <!-- 1=ICP -->
          <param name="Reg/Force3DoF"             type="string" value="true"/>
          <param name="Vis/MaxDepth"              type="string" value="4.0"/>
          <param name="Vis/MinInliers"            type="string" value="5"/> <!-- Vis/EstimationType 1 -->
          <param name="Vis/InlierDistance"        type="string" value="0.05"/>
          <param name="Rtabmap/TimeThr"           type="string" value="700"/>
          <param name="Mem/RehearsalSimilarity"   type="string" value="0.45"/>
          <param name="Icp/CorrespondenceRatio"   type="string" value="0.5"/>
          <param name="Grid/FromDepth"            type="string" value="true" />
    </node>
    
   
    <!-- Grid map assembler for rviz | Can't locate grid_map_assembler inside rtabmap_ros package, only map_assembler -->
     <!-- <node pkg="rtabmap_ros" type="grid_map_assembler" name="grid_map_assembler" output="screen" /> -->
    <node pkg="rtabmap_ros" type="map_assembler" name="map_assembler" output="screen"/>
  </group>
   
  <!-- RViz  --> 
    <node pkg="rviz" type="rviz" name="rviz"/>

  <!-- Construct and voxelize the point cloud (for fast visualization in rviz) -->
  <node pkg="nodelet" type="nodelet" name="points_xyzrgb" args="standalone rtabmap_ros/point_cloud_xyzrgb">
    <remap from="rgb/image"       to="/camera/data_throttled_image"/>
    <remap from="depth/image"     to="/camera/data_throttled_image_depth"/>
    <remap from="rgb/camera_info" to="/camera/data_throttled_camera_info"/>
    <remap from="cloud"           to="voxel_cloud" />

    <param name="/camera/rgb/image_transport" type="string" value="theora"/>
    <param name="/camera/depth/image_transport" type="string" value="compressedDepth"/>

    <param name="queue_size" type="int" value="10"/>
    <param name="voxel_size" type="double" value="0.01"/>
  </node>
</launch>

After launching the second launch file I get the warning that "/rtabmap/rtabmap: Did not receive data since 5 seconds! Make sure the input topics are published ..." but I can still visualize the fake laser scan, camera data and mapData with some lag (I suspect the warning is because of throttled messages). The problem is when I drive the robot around the environment (using RosAria client), the map is not building. I can only see that part of environment at which robot camera (Kinect) is facing. The map display in Rviz states warning message is "No map recieved". I suspect this has to do something with map_assembler node. I would greatly appreciate if someone could help me out.


Originally posted by Dox on ROS Answers with karma: 36 on 2018-03-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The az3_* files use the old code and map_assembler is not required. I recommend to follow the Remote Mapping tutorial instead. To use robot odometry with this tutorial, the remote computer could launch:

$ roslaunch rtabmap_ros rtabmap.launch \
  rgb_topic:=/camera/data_throttled_image \
  depth_topic:=/camera/data_throttled_image_depth \
  camera_info_topic:=/camera/data_throttled_camera_info \
  compressed:=true \
  rtabmap_args:="--delete_db_on_start" \
  visual_odometry:=false \
  odom_topic:=/odom \
  queue_size:=10

While you are receiving all topics separately, lags on network and different frame rates can affect the ability to remote nodes (e.g., rtabmap) to correctly synchronize the topics. You may check the rate of the topics that rtabmap is subscribed to with rostopic hz. If some topics are at 50 Hz while other are at 3 Hz, rtabmap won't be able to synchronize them by default. The queue_size parameter should be increased (default 10). You can also throttle the topics on robot side so they are all published at the same rate (this can save network bandwidth at the same time).

cheers


Originally posted by matlabbe with karma: 6409 on 2018-03-27

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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