0
$\begingroup$

Rosanswers logo

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:

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

$ 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.


Originally posted by osmancns on ROS Answers with karma: 153 on 2015-06-12

Post score: 1


Original comments

Comment by Po-Jen Lai on 2015-06-13:
Are you sure the output of rplidar is correct?

Comment by osmancns on 2015-06-14:
oh I am also not sure that . how can I correct that I dont know ? you think my static tf 's is correct ?

Comment by Po-Jen Lai on 2015-06-15:
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.

Comment by osmancns on 2015-06-15:
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/04/gmapping-and-rplidar.html

Comment by rosRabbit on 2015-08-21:
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?

Comment by osmancns on 2015-08-21:
you need to change gmapping parameters. default parameters not good for every lidar. example : http://geduino.blogspot.com.tr/2015/04/gmapping-and-rplidar.html and if you will work with real rplidar you must do that : https://github.com/robopeak/rplidar_ros/pull/13

Comment by rosRabbit on 2015-08-21:
I use the parameters from http://geduino.blogspot.com.tr/2015/04/gmapping-and-rplidar.html. 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!

Comment by osmancns on 2015-08-21:
The RPLidar node with fixes it is available on https://github.com/afrancescon/rplidar_ros (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.

Comment by rosRabbit on 2015-08-21:
I clone the rplidar package into my workspace and call my launch file. Still could not get the map. I describe a virtual robot with a real rplidar in it. The map is generated using real rplidar data and fake tf info. Is it the right way to add odometry information?

Comment by osmancns on 2015-08-21:
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_simulator/Tutorials/hydro/Make%20a%20map%20and%20navigate%20with%20it

Comment by rosRabbit on 2015-08-25:
Hi, I used turtlebot_simulator you posed above and it could successfully generate the map and use it. But how to use the real rplidar data (without a robot) & gmapping to generate a map? Gmapping needs odometry info. How to do it? Thanks!

Comment by osmancns on 2015-08-25:
I added a comment under your question for launch file link . you dont see ? Note : if answer is correct for you, you mark it as correct answer

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

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/html/msg/LaserScan.html

Although in http://geduino.blogspot.com.tr/2015/04/gmapping-and-rplidar.html, 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.


Originally posted by Po-Jen Lai with karma: 1371 on 2015-06-15

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by osmancns on 2015-06-15:
thank you . But I can see rplidar /scan topic on rviz display. also rviz show my lidar lines on display .

Comment by Po-Jen Lai on 2015-06-16:
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/04/gmapping-and-rplidar.html?

Comment by osmancns on 2015-06-16:
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. ?

Comment by osmancns on 2015-06-16:
this my rplidar_ros/src/node.cpp : https://github.com/afrancescon/rplidar_ros/blob/master/src/node.cpp

Comment by Po-Jen Lai on 2015-06-16:
I thought you are using https://github.com/robopeak/rplidar_ros/blob/master/src/node.cpp, I don't get why you use this one (https://github.com/afrancescon/rplidar_ros/blob/master/src/node.cpp) instead.

Comment by Po-Jen Lai on 2015-06-16:
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)

Comment by osmancns on 2015-06-16:
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

Comment by Po-Jen Lai on 2015-06-17:
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.

Comment by osmancns on 2015-06-19:
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.

Comment by osmancns on 2015-06-19:
and ı added my gmapping launch file following answer on this page. can you look it.

Comment by Po-Jen Lai on 2015-06-19:
no enough info was presented. how do the obstacles looks in real scene? Why you think that map is bad?

Comment by osmancns on 2015-06-20:
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

Comment by Po-Jen Lai on 2015-06-22:
Have no idea about your problem. It doesn't seem like a bug, the issue now is the speed is slow? how slow it is?

Comment by osmancns on 2015-07-02:
hello @Ricky. I have no problem about gmapping. But after your fixing for rplidar node , laser_scan_matcher throw this error : http://i.imgur.com/4SyDnIW.jpg here is origin error : https://github.com/AndreaCensi/csm/blob/master/sm/csm/laser_data.c

Comment by osmancns on 2015-07-02:
But when I delete these lines on rplidar node, laser_scan_matcher is working. I added this lines : scan_msg.angle_min = angle_min; --- scan_msg.angle_max = angle_max; https://github.com/robopeak/rplidar_ros/commit/3821d95a6e7c4979733ab24a262bb11709591f8c Can you help me for this.

Comment by Po-Jen Lai on 2015-07-02:
I am not familiar with this package, try this. https://gist.github.com/Po-Jen/104348485ae224ff4f72

Comment by osmancns on 2015-07-03:
You are perfect @Ricky. your fix is working with both gmapping and laser_scan_matcher package. Thank you so much for your helps.

Comment by Po-Jen Lai on 2015-07-03:
Good to hear that. I already create the PR to fix this issue. Thanks for reporting. https://github.com/robopeak/rplidar_ros/pull/13

$\endgroup$
0
$\begingroup$

Rosanswers logo

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

  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>

Originally posted by osmancns with karma: 153 on 2015-06-16

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

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!

<include file="$(find gazebo_ros)/launch/empty_world.launch"/> <!--include file="$(find chapter7_tutorials)/launch/crd_world.launch"/-->


Originally posted by rosRabbit with karma: 21 on 2015-08-21

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by osmancns on 2015-08-24:
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_simulator/Tutorials/hydro/Make%20a%20map%20and%20navigate%20with%20it

Comment by osmancns on 2015-08-24:
this is basic gmapping launch file : https://yadi.sk/d/9uup1mXnicpuc Note: it has fake odometry so it has just a tf.

Comment by rosRabbit on 2015-08-25:
Hi, Thanks! What you show above is very helpful. The gmapping launch file you given could generate the map. Thanks very much. :)

Comment by osmancns on 2015-08-25:
but it has not a odometry data. you can use " laser_scan_matcher " package for good odometry.

Comment by rosRabbit on 2015-08-26:
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!

Comment by osmancns on 2015-08-26:
glad to be of help :)

Comment by rosRabbit on 2015-08-27:
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_simulator/Tutorials/hydro/Make%20a%20map%20and%20navigate%20with%20it. My question is : is there a virtual rplidar? where to find it? Thanks!

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

Comment by rosRabbit on 2015-08-27:
You are always helpful. Thanks very much!

$\endgroup$

Your Answer

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