ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

no map recived using slam gmapping

asked 2016-08-14 04:03:07 -0500

RSA_kustar gravatar image

updated 2016-08-14 04:03:26 -0500

I am trying to do slam gmapping using a quadrotor uses px4 as an autopilot in gazebo simulator. I am trying to follow the tutorial shown in the following link:

http://wilselby.herokuapp.com/sample-...

I didn’t use a fake laser since my quad is equipped with a laser scan that publishes a topic called \quad\scan

I have the following launch file:

<?xml version="1.0"?>
<launch>
<arg name="paused" default="false"/>
<arg name="debug" default="false"/>
<arg name="gui" default="true" />
<arg name="headless" default="false"/>
<arg name="enable_logging" default="false"/>
<arg name="enable_ground_truth" default="true"/>
<arg name="ns" default="quad"/>
<arg name="log_file" default="$(arg ns)"/>
<arg name="gazebo_arg" default=""/>
<arg name="world" default="sar_world1.world"/>

<include file="$(find my_pack)/launch/world.launch" >
<arg name="paused" default="$(arg paused)"/>
<arg name="debug" default="$(arg debug)"/>
<arg name="gui" value="$(arg gui)" />
<arg name="headless" default="$(arg headless)"/>
 </include>

  <group ns="quad">
  <include file="$(find rotors_gazebo)/launch/spawn_ardrone.launch">
  <arg name="model" value="$(find rotors_description)/urdf/drone_sensors.gazebo" />
  <arg name="enable_logging" value="$(arg enable_logging)" />
  <arg name="enable_ground_truth" value="$(arg enable_ground_truth)" />
  <arg name="log_file" value="$(arg log_file)"/>
  <arg name="x" value="-3.0"/>
  <arg name="y" value="-2.0"/>
  <arg name="Y" value="3.14"/> 
  <arg name="name" value="quad"/>
  </include>
  <arg name="fcu_url" default="udp://localhost:14560@localhost:14565" />
   <include file="$(find mavros)/launch/px4.launch">
  <arg name="fcu_url" value="$(arg fcu_url)" />
  </include>    
  </group>

<include file="$(find rotors_gazebo)/launch/ardrone.launch">
<arg name="ns" value="quad"/>
</include>

  <!-- Fake laser -->

 <!-- <node pkg="nodelet" type="nodelet" name="laserscan_nodelet_manager" args="manager"/>
       <node pkg="nodelet" type="nodelet" name="depthimage_to_laserscan"
        args="load depthimage_to_laserscan/DepthImageToLaserScanNodelet laserscan_nodelet_manager">
       <param name="scan_height" value="10"/> 
       <param name="scan_time" value="0.033"/>
       <param name="range_min" value="0.45"/>
       <param name="range_max" value="10.0"/>
       <param name="min_height" value=".10"/>
        <param name="max_height" value="2.0"/>
        <param name="output_frame_id" value="quad/depth_optical_frame"/>
        <remap from="image" to="depth/image_raw"/>
        <remap from="/scan" to="/sim_scan"/> 
        </node>
         -->
       <node name="slam_gmapping" pkg="gmapping" type="slam_gmapping">
       <remap from="scan" to="uav_1/scan"/>
       <param name="map_frame" value="map" />
       <param name="odom_frame" value="world" />
       <param name="base_frame_id" value="/quad/odometry_frame" />
       </node>
       <node pkg="tf" type="static_transform_publisher" name="link3_broadcaster" args="0 0 0 0 0 0 map world 500" />
       <node pkg="rviz" type="rviz" name="rviz" args="-d $(find my_pack)/config/sim_rviz.rviz" />

        </launch>

when I am trying to see the map in RVIZ, I added the map with topic map and it says that there is "no map received" ? I don't know where is the error ?

edit retag flag offensive close merge delete

Comments

Does the slam_gmapping node need to subsrcibe /tf and /scan? (same as gmapping?) If yes, I wonder whether the <remap from="scan" to="uav_1/scan"/> will cause the problem due to the "/scan" topic doesn't exist, no to mention any data in it. Maybe you can check this.

WeiShih gravatar image WeiShih  ( 2016-08-14 19:38:33 -0500 )edit

@WeiShih When I did Slam Gmaping using the command line it worked but using it here in the launch file it did not work. So what exactly are the tags that I should use in order for this code to work ?

RSA_kustar gravatar image RSA_kustar  ( 2016-08-15 00:07:50 -0500 )edit

I saw that you are using namespace "quad" in your launch file. Pay extra attention to the topic/service name. Maybe you can try to run rosnode info /slam_gmapping to make sure it subscribes to correct scan topic.

DavidN gravatar image DavidN  ( 2016-08-15 06:45:41 -0500 )edit

Sorry I'm not going to run this launch file. But just like @DavidN said, you have to check whether the topic names are correct. Make sure the slam_gmapping gets all the data it wants. You can also use $rostopic echo <topic_name> to show if there is any data in the topic.

WeiShih gravatar image WeiShih  ( 2016-08-18 03:19:25 -0500 )edit

@David and @WeiShih I fixed the name space but the error was not from the namespace, I removed the Gmapping and I run it from the command line and it worked. the error was from the parameters names I will post the solution now

RSA_kustar gravatar image RSA_kustar  ( 2016-09-06 05:34:37 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2016-09-06 05:36:44 -0500

RSA_kustar gravatar image

updated 2016-09-06 05:37:03 -0500

The problem is solved when using the following gmapping tags

  <node name="slam_gmapping" pkg="gmapping" type="slam_gmapping">   
     <param name="output_frame_id" value="/base_link"/>
     <remap from="/scan" to="/uav_1/scan"/> 
     <param name="map_frame" value="map" />
     <param name="_odom_frame" value="world" />
     <param name="_base_frame" value="/base_link" />
     <param name="_inverted_laser" value="false" />
 </node>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-08-14 04:03:07 -0500

Seen: 1,413 times

Last updated: Sep 06 '16