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

Scan message must contain angles from -x to x

asked 2015-06-08 21:30:06 -0500

Leejamin gravatar image

updated 2015-07-16 08:50:33 -0500

mgruhler gravatar image

I follow the tutorial turtlebot_simulator to make a map in a simulated world.But when I run

roslaunch turtlebot_gazebo gmapping_demo.launch

a error that scan message must contain angles from -x to x occurs, as show below. How to deal with it.

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

edit retag flag offensive close merge delete

Comments

I am facing the same issue, any possible solution?

tosandip gravatar image tosandip  ( 2015-07-10 14:59:51 -0500 )edit

me too , do you have any possible solution

forinkzan gravatar image forinkzan  ( 2015-07-14 22:12:06 -0500 )edit

No i have not found any.. starting looking at jackal robot.

tosandip gravatar image tosandip  ( 2015-07-15 08:30:58 -0500 )edit

I have the same problem. This is the new behaviour in the latest ros-indigo-gmapping-1.3.7 package. CHANGELOG.rst says: .... * Added cfloat include * Change arbitrary constant to FLT_EPSILON * Added check that scan goes from -x to x .......

chuong gravatar image chuong  ( 2015-07-15 19:40:34 -0500 )edit

6 Answers

Sort by ยป oldest newest most voted
3

answered 2015-07-31 02:11:57 -0500

Vincent Rabaud gravatar image

Hi all, thank you for sharing the data. A fix was merged upstream in 1.3.8: it just reached shadow fixed so please test. The fix centers the scan before sending them to gmapping, whether they're slightly / completely off-centered or even upside-down.

edit flag offensive delete link more
4

answered 2015-07-15 22:32:04 -0500

chuong gravatar image

updated 2015-07-15 22:43:44 -0500

This error is due to recent change in gmapping package. This can be fixed by modifying and recompiling the gmapping package as follows:

$ wget http://packages.ros.org/ros/ubuntu/pool/main/r/ros-indigo-gmapping/ros-indigo-gmapping_1.3.7.orig.tar.gz
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
$ tar xvf ../../ros-indigo-gmapping_1.3.7.orig.tar.gz
$ mv ros-indigo-gmapping-1.3.7/ gmapping
$ gedit gmapping/src/slam_gmapping.cpp
Change line 409 from:
  if (fabs(fabs(scan.angle_min) - fabs(scan.angle_max)) > FLT_EPSILON)
to:
  if (fabs(fabs(scan.angle_min) - fabs(scan.angle_max)) > 0.003) // this is the value for Kinect
Save and close the file. Go back to commandline:

$ cd ..
$ catkin_make
$ sudo cp devel/lib/gmapping/slam_gmapping* /opt/ros/indigo/lib/gmapping/
This works for me.

edit flag offensive delete link more

Comments

+1 only as a temporary workaround for the particular usecase (turtlebot_gazebo in this case). Since gmapping is a package that's fundamental enough, we need a permanent solution. I've opened a related PR.

130s gravatar image 130s  ( 2015-07-16 00:03:22 -0500 )edit

why is this only working for turtlebot_gazebo?

Salocin808 gravatar image Salocin808  ( 2015-07-16 09:16:23 -0500 )edit
2

This is not working for me. Followed the instructions but still getting same error. Any ideas? (I'm using Ubuntu 14.04.2 LTS and Turtlebot 2)

Salocin808 gravatar image Salocin808  ( 2015-07-16 09:50:56 -0500 )edit

@Salocin808 Instant workaround (not a "solution") can be to play with FLT_EPSILON value that works for you. Once you find the smallest working value sharing it with us would be beneficial.

130s gravatar image 130s  ( 2015-07-16 09:56:51 -0500 )edit

@130s Ok thanks for your help! I am already at home but will try it tomorrow morning.

Salocin808 gravatar image Salocin808  ( 2015-07-16 10:23:31 -0500 )edit

@130s I changed the error message so that it prints out the difference between the angles:

[ERROR] [1437121911.683298899]: Edited: Scan message must contain angles from -x to x, i.e. angle_min (0.513185) = -angle_max (0.499907). min-max = 0.013278

Maybe EPSILON should be 0.03?

Salocin808 gravatar image Salocin808  ( 2015-07-17 03:40:01 -0500 )edit

please guys, don't try to find workarounds: report the bug at least; better, help fixing it :)

Vincent Rabaud gravatar image Vincent Rabaud  ( 2015-07-18 05:07:42 -0500 )edit
1

well, after changing the value to 0.03 I never had problems.. where should I report the bug?

Salocin808 gravatar image Salocin808  ( 2015-07-21 02:48:10 -0500 )edit
0

answered 2015-08-13 13:00:39 -0500

stevenwaslander gravatar image

updated 2015-08-13 13:01:21 -0500

Combining two answers, this now works, assuming you have a catkin workspace set up already:

wget http://packages.ros.org/ros/ubuntu/pool/main/r/ros-indigo-gmapping/ros-indigo-gmapping_1.3.8.orig.tar.gz
cd ~/catkin_ws/src
tar xvf ../../ros-indigo-gmapping_1.3.8.orig.tar.gz   
mv ros-indigo-gmapping-1.3.8/ gmapping
catkin_make
sudo cp devel/lib/gmapping/slam_gmapping* /opt/ros/indigo/lib/gmapping/
edit flag offensive delete link more

Comments

but I could not find gmapping directory after I run 'catkin_make' command. my machine environment is raspberry Pi 3

Oakafka gravatar image Oakafka  ( 2016-05-27 10:02:23 -0500 )edit
0

answered 2016-05-27 09:59:09 -0500

Oakafka gravatar image

but I can not find gmapping/ in devel/lib after I run 'catkin_make'

edit flag offensive delete link more
0

answered 2015-07-16 10:05:01 -0500

130s gravatar image

updated 2015-07-17 12:55:28 -0500

While @chuong's answer can be referenced as a temporary workaround, I filed a discussion ticket in gmapping community for the permanent solution.


UPDATE @Vincent Rabaud opened a pull request that can be the permanent solution for this issue. Try it out, and give feedback in the ticket.

edit flag offensive delete link more

Comments

can anybody please send me a failing rosbag ? My personal email is https://github.com/ros-perception/sla...

Vincent Rabaud gravatar image Vincent Rabaud  ( 2015-07-16 11:55:06 -0500 )edit
130s gravatar image 130s  ( 2015-07-16 12:42:02 -0500 )edit

@Salocin808 Permanent, general solution is discussed in this ticket. And I've already did debug print hack haha

130s gravatar image 130s  ( 2015-07-17 08:44:33 -0500 )edit

I tested @Vincent Rabaud's patch and found gmapping didn't run as expected. It printed "Registering First Scan" then stopped updating. There was no other output until being killed.

chuong gravatar image chuong  ( 2015-07-19 19:51:25 -0500 )edit

For a pull request, let's keep discussing in the pull request page instead of distributing info at multiple places.

130s gravatar image 130s  ( 2015-07-23 21:55:54 -0500 )edit
0

answered 2016-03-05 01:45:45 -0500

updated 2016-03-05 01:49:34 -0500

Now you just need to download the latest version of gmapping(1.3.8), extract it into your catkin_ws/src.

Then

$ catkin_make

Finally:

$ sudo cp devel/lib/gmapping/slam_gmapping* /opt/ros/indigo/lib/gmapping/

Hope this works for you :)

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-06-08 21:30:06 -0500

Seen: 2,126 times

Last updated: Mar 05 '16