I am working on a simple SLAM simulation for a project. Here's the problem:
For the simulation, I will be using a mobile robot moving in a room. The robot has laser distance sensors so he can detect the detect the distances from itself to the wall from inside an angle, as shown in the first figure:
The MATLAB code I've implemented for the simulation is to simply calculate the angles from each wall point to the the robot's pose and return all the points whose angle is inside, for example, [-60°,+60°].
For more complex room configurations it can't be used though, since walls that shouldn't be detected (walls from other rooms) will be detected as well, as seen in the second figure:
I need a better way of implementing this detection inside the simulation so I can use it for any kind of rooms like this one, producing results like this: