I am working on Rosject (follow wall) of ROS2 Basics in 5 Days: Course Project. I managed to get the first simple code for the robot to just follow the wall in simulation. It works quite well in there. But when working with the real robot, something with the LaserScan sensor doesnt seem right.
In the first image I attached, you can see the readings of the real robot. They correspond to the robot moving mostly forwards and getting closer to a wall, while it maintains a tiny distance with another wall to its right.
The second image shows the part of the code where I read those values from the /scan topic and show them in the terminal. Even though the front part of the robot is getting closer to a wall, the scan tells that the distance increases. On the other hand, the scan of the back of the robot always tells that it is close to something (while actually it is getting away from another wall!)
These values are too different from the ones I get in the simulation. Even worse, the apparently dont make sense. This makes my code not work at all and make the robot behave in unpredictable ways.
Can someone tell me if they have had the same problem? Is there any advice that you could give me?