# /scan data being all over the place when displayed in RViz

Hello, good morning!

Recently, I've been trying to understand a Neato XV-11 LIDAR that I have with me and get into the navigation stack, trying to learn how to work with laser data, scans, gmapping, amcl, move_base and all that - though, I'm still fairly new at... everything, so I've been stumbling and doing incorrect stuff in a lot of things.

I've managed to make, somehow, the data from the /scan appear in rviz and generate a map with it, but when trying to work with the AMCL modules, some strange stuff happens.

One thing that's striking me as really odd and that I don't know how to fix is that the scan from the laser data and the map are in completely opposite sides. I've seen examples of the laser data following the map as the robot moves, but I can't do that by any means, and I don't really know what's going wrong. When I start up AMCL, what I get is this:

That striked me as odd, but I decided to keep going. I used the 2D Pose Estimate button to estimate where my robot really was - that is, not outside the map -, and when that happened, the reading from the laser sensor decided to go even more wrong, kind of like it was glitching through the map, constantly tilting itself back and forth, like trying to get itself close from the real place where it should be.

I didn't find a solution for this, but the PoseArray worked as it should when I positioned it with the Pose Estimate - as I moved my robot around, the lots of arrows that were in the RViz slowly disappeared and got together into something my precise. As I drove the robot around, it followed close to where it should be in the map.

I tried to ignore the scan data glitching around and execute the move_base node to generate a global costmap, but then the generated costmap decided to... include the scan data into the map, for some reason. That's one of the most strange things that has happened between all of this.

I've tried to alter some parameters of the AMCL launch, like the max range, max/min particles, kld error, but to no avail - it keeps "glitching" through the map like this. Can anybody give me some light on how to proceed with this?

edit retag close merge delete

It is quite common for the scan to be out of alignment with the map when first launched. amcl will try to start at (0, 0) of the map.

Could you run rosrun tf view_frames with the issue occurring to see what the TF relationship is in the post? I think you can see where you are running /scan based on.

I'm also curious if you are also running gmapping together. The amcl and map_server have been known to have unintended behavior when running at the same time as the gmapping, so I'm wondering if you're running the gmapping at the same time.

( 2020-11-28 01:36:15 -0600 )edit
1

Did you solve this?

( 2021-11-23 07:09:29 -0600 )edit

Yes! I won't exactly remember how I did it, but it was something about I was publishing the position data twice - I was publishing, alongside the data read by the XV-11, a [0,0,0] position in the middle of the code.

That's what caused the data to be all over the place - it was always changing between the actual position and the [0,0,0] coordinate.

( 2021-11-23 08:35:25 -0600 )edit