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

gmappping problem ( NO MAP RECEİVED )

asked 2015-06-12 06:21:17 -0600

osmancns gravatar image

updated 2015-06-12 06:24:02 -0600

Hello friends... I created required gmapping tree. But RVİZ dont display a map. I use RPLidar. I run this gmapping launch file . and ı get this error on console.

[ERROR] [1434099978.892736102]: Scan message must contain angles from -x to x, i.e. angle_min = -angle_max

And I run $roswtf , I get this error:

**WARNING The following node subscriptions are unconnected:

  • /rviz_1434092335500490690:
    • /tf_static
    • /map_updates
  • /slam_gmapping:
    • /tf_static**

On my rviz: fixed frame : /map

this is my tree : http://i57.tinypic.com/50001f.png

this is my rviz display: http://i61.tinypic.com/2nvzf5w.png

this is my gmapping launch file:

<launch> <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">

<rosparam>
  odom_frame: odom
  map_frame: map
  base_frame: base_link
  map_update_interval: 0.5
  maxUrange: 30.0
  maxRange: 60.0
  sigma: 0.05
  kernelSize: 1
  lstep: 0.05
  astep: 0.05
  iterations: 5
  lsigma: 0.075
  ogain: 3.0
  lskip: 0
  linearUpdate: 0.5
  angularUpdate: 0.436
  temporalUpdate: -1.0
  resampleThreshold: 0.5
  particles: 80
  xmin: -1.0
  ymin: -1.0
  xmax: 1.0
  ymax: 1.0
  delta: 0.025
  llsamplerange: 0.01
  llsamplestep: 0.01
  lasamplerange: 0.005
  lasamplestep: 0.005  
</rosparam>

</node> </launch>

$ rostopic echo /odom result :

**child_frame_id: base_link pose:

pose:

position: 
  x: 2.35970327619
  y: 0.419065232983
  z: 0.0
orientation: 
  x: 0.0
  y: -0.0
  z: -0.846968362724
  w: -0.53164329446**

please ı need a hepl please help me friens.

edit retag flag offensive close merge delete

Comments

Are you sure the output of rplidar is correct?

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-13 23:23:42 -0600 )edit

oh I am also not sure that . how can I correct that I dont know ? you think my static tf 's is correct ?

osmancns gravatar image osmancns  ( 2015-06-14 02:37:53 -0600 )edit

I am not sure, just feel not right with your error message. Since the scan message is incorrect, map may not be able to update. As a result, /map_updates cannot be published. I haven't met this problem before, so I'm just providing some opinion for you to debug.

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-15 01:51:53 -0600 )edit

there is a solved problem this link. ı cloned new node for rplidar but no result. ı think problem is on rplidar. http://geduino.blogspot.com.tr/2015/0...

osmancns gravatar image osmancns  ( 2015-06-15 03:21:09 -0600 )edit

Hi, I used rpliar+gmapping for mapping. I made rplidar as one part of the virtual robot and bring up the virtual robot in Gazebo for sending TF information out. Then call slam_gmapping node, it seem there is no error to pass the code. However, the generated map is too bad. Something wrong?

rosRabbit gravatar image rosRabbit  ( 2015-08-21 00:35:44 -0600 )edit

you need to change gmapping parameters. default parameters not good for every lidar. example : http://geduino.blogspot.com.tr/2015/0... and if you will work with real rplidar you must do that : https://github.com/robopeak/rplidar_r...

osmancns gravatar image osmancns  ( 2015-08-21 01:06:12 -0600 )edit

I use the parameters from http://geduino.blogspot.com.tr/2015/0... . But have no idea about how to set the rplidar reference frame. Can you tell me how? The map is received but it seems there is no space occupied. Something must be wrong. Thanks!

rosRabbit gravatar image rosRabbit  ( 2015-08-21 01:42:20 -0600 )edit

The RPLidar node with fixes it is available on https://github.com/afrancescon/rplida... (with rplidar referance frame) you dont need to change referance frame. And gmapping need to odometry for a good mapping. But hector_mapping not like this. But if you work on gazebo this not a problem.

osmancns gravatar image osmancns  ( 2015-08-21 02:07:55 -0600 )edit

3 Answers

Sort by » oldest newest most voted
3

answered 2015-06-15 09:54:42 -0600

updated 2015-06-16 05:25:28 -0600

I guess you didn't change the port in rplidar.launch.

<launch>
  <node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
  <param name="serial_port"         type="string" value="/dev/ttyUSB0"/>  
  <param name="serial_baudrate"     type="int"    value="115200"/>
  <param name="frame_id"            type="string" value="laser"/>
  <param name="inverted"            type="bool"   value="false"/>
  <param name="angle_compensate"    type="bool"   value="true"/>
  </node>
</launch>

You should use ls /dev/ttyUSB* to check what's the port of your lidar. And make sure the line below is correct.

<param name="serial_port"         type="string" value="/dev/ttyUSB0"/>

Also, check if your user is in the linux group dialout to get access to the lidar.

============================================================

Update:

I think you should first take a look at the message in your /scan topic to confirm if angle_min != -angle_max. http://docs.ros.org/api/sensor_msgs/h...

Although in http://geduino.blogspot.com.tr/2015/0... , it mentioned that

First issue regards the LaserScan expected by GMapping. Unfortunately this is not documented anywhere and I found it only checking out source code: on latest commits (not yet released) a new check was added to make sure LaserScan message min angle and max angle are opposite:

maxAngle = - minAngle

This condition is not satisfied by RPLidar node but, since released version of GMapping does not include this check, is not easy to notice.

I guess your gmapping does include this check, and since the driver didn't handle this issue, your gmapping console would complain about that.

You might need to modify the rplidar_ros/src/node.cpp to let angle_min == -angle_max and see if it works.

edit flag offensive delete link more

Comments

thank you . But I can see rplidar /scan topic on rviz display. also rviz show my lidar lines on display .

osmancns gravatar image osmancns  ( 2015-06-15 14:08:56 -0600 )edit

Weird. So the error of "Scan message must contain angles from -x to x" still exist? Also, have you modified the gmapping.launch to meet the configuration in http://geduino.blogspot.com.tr/2015/0...

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-16 00:05:44 -0600 )edit

sorry I couldnt understand. what will I do on node.cpp. there are angle links. How can ı modify.

on node.cpp : scan_msg.angle_min = M_PI - angle_min; scan_msg.angle_max = M_PI - angle_max;

What will ı do this links. ?

osmancns gravatar image osmancns  ( 2015-06-16 06:56:17 -0600 )edit

this my rplidar_ros/src/node.cpp : https://github.com/afrancescon/rplida...

osmancns gravatar image osmancns  ( 2015-06-16 07:50:11 -0600 )edit

I thought you are using https://github.com/robopeak/rplidar_r... , I don't get why you use this one ( https://github.com/afrancescon/rplida... ) instead.

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-16 10:18:27 -0600 )edit
1

Anyway, I've traced the code. You can use scan_msg.angle_max = -1*(M_PI - angle_min); to replace the original scan_msg.angle_max = M_PI - angle_max;. Check if this fix the error. (Although it's a little bit weird that angle_min as the input of publish_scan() is actually 0)

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-16 10:26:07 -0600 )edit

oh Thank you so much your fixing is solved the problem. I can see mapping on rviz . but map so so bad.I use your link gmapping parameters. and my odom tf and base_link tf that on rviz moving so not stable . you think what can ı do my friend

osmancns gravatar image osmancns  ( 2015-06-16 11:24:01 -0600 )edit

Show me your map (by http://imgur.com/ ). Have you checked if the laser scan is accurate? For example, you can put the lplidar in front of a wall and see if a line is displayed in Rviz.

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-17 01:24:09 -0600 )edit

this my $roswtf result: http://i58.tinypic.com/23m7dqx.png and this is my rviz display. I can see obstacles made by boxes. http://i61.tinypic.com/34i1p9h.png ı need a little help more.

osmancns gravatar image osmancns  ( 2015-06-19 02:11:16 -0600 )edit

and ı added my gmapping launch file following answer on this page. can you look it.

osmancns gravatar image osmancns  ( 2015-06-19 02:13:36 -0600 )edit

no enough info was presented. how do the obstacles looks in real scene? Why you think that map is bad?

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-19 07:58:57 -0600 )edit

map that displaying on the rviz is good and same with real box obstacles. But mapping work is so so slow ( rplidar is 5 hz) and you see like this my rviz display http://i.imgur.com/7ff9jYO.png , the tf between /map and /odom is not static ? ı cant understand ? roswtf : http://i.imgur.com/oXEPO37.png

osmancns gravatar image osmancns  ( 2015-06-20 04:20:48 -0600 )edit
1

answered 2015-08-21 04:41:52 -0600

rosRabbit gravatar image

Hi, I account a problem when I want to generate the map using rplidar+slam_gmapping. I post the launch file here and hope you could do me a favor to see where is wrong. I am new to ros. Thanks! By the way, I describe a virtual robot in a file with a real rplidar on it. I just want to get tf data from the virtual robot and get the real data from rplidar for the finally generating map. I am not sure whether this method is right or not. If not, how to generate tf and add tf for mapping? Thanks!

<launch>

<include file="$(find gazebo_ros)/launch/empty_world.launch"/> <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" &gt;<="" node=""> <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen" &gt;="" <param="" name="publish_frequency" type="double" value="50.0"/> </node>

<node name="spawn_robot" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -z 0.1 -model robot_model" respawn="false" output="screen"/>

<arg name="model"/>

<node name="rplidarNode" pkg="rplidar_ros" type="rplidarNode">
</node>

<node pkg="tf" type="static_transform_publisher" name="odom_map_broadcaster" args="0 0 0 0 0 0 /odom /map 100"/>

<node name="slam_gmapping" pkg="gmapping" type="slam_gmapping">


<remap from="scan" to="base_scan"/> </node>

</launch>

edit flag offensive delete link more

Comments

1

you cannot use real lidar with gazebo. lidar and robot must move together. you can move the with your hand without gazebo. Or you can use this simulator. it is has a virtual lidar on robot: http://wiki.ros.org/turtlebot_simulat...

osmancns gravatar image osmancns  ( 2015-08-24 01:55:14 -0600 )edit
1

this is basic gmapping launch file : https://yadi.sk/d/9uup1mXnicpuc Note: it has fake odometry so it has just a tf.

osmancns gravatar image osmancns  ( 2015-08-24 01:58:50 -0600 )edit

Hi, Thanks! What you show above is very helpful. The gmapping launch file you given could generate the map. Thanks very much. :)

rosRabbit gravatar image rosRabbit  ( 2015-08-25 04:37:07 -0600 )edit

but it has not a odometry data. you can use " laser_scan_matcher " package for good odometry.

osmancns gravatar image osmancns  ( 2015-08-25 05:37:25 -0600 )edit

Thanks very much! I use "laser_scan_matcher" to get better odometry as your suggestion. Now I could get better map. Thanks again for your great help!

rosRabbit gravatar image rosRabbit  ( 2015-08-26 02:48:19 -0600 )edit

glad to be of help :)

osmancns gravatar image osmancns  ( 2015-08-26 03:13:29 -0600 )edit

Hi, sorry to bother you again. I have a question about the virtual sensor. As you know, it has a virtual kinect here http://wiki.ros.org/turtlebot_simulat... . My question is : is there a virtual rplidar? where to find it? Thanks!

rosRabbit gravatar image rosRabbit  ( 2015-08-27 00:42:35 -0600 )edit
1

there is a virtual sensor with kinect. also you can review this links : http://gazebosim.org/tutorials/?tut=a...https://www.youtube.com/watch?v=z9Pzm... there is just hokuyo gazebo models but you can edit it like rplidar parameters in sdf or xacro file.

osmancns gravatar image osmancns  ( 2015-08-27 01:01:36 -0600 )edit
1

answered 2015-06-16 02:02:39 -0600

osmancns gravatar image

updated 2015-06-16 06:54:02 -0600

You think , my launch is correct ? this is my gmapping launch file:

<launch> <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen"> <rosparam>

  odom_frame: odom
  map_frame: map
  base_frame: base_link
  map_update_interval: 0.5
  maxUrange: 5.5
  maxRange: 5.5
  minimumScore: 50
  sigma: 0.05
  kernelSize: 1
  lstep: 0.05
  astep: 0.05
  iterations: 5
  lsigma: 0.075
  ogain: 3.0
  lskip: 0
  linearUpdate: 0.2
  angularUpdate: 0.25
  temporalUpdate: 5.0
  resampleThreshold: 0.5
  particles: 80
  xmin: -1.0
  ymin: -1.0
  xmax: 1.0
  ymax: 1.0
  delta: 0.025
  llsamplerange: 0.01
  llsamplestep: 0.01
  lasamplerange: 0.005
  lasamplestep: 0.005

</rosparam>

</node> </launch>

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-06-12 06:21:17 -0600

Seen: 3,919 times

Last updated: Aug 21 '15