Sensor Reading On Real Robot Is Off


I am working on Checkpoint 3 of Introduction to ROS2. I managed to get the code to work in simulation (avoiding obstacles and moving to the correct position). However, on the real robot, it does not work because the sensor readings are off.

I have attached two images to show the sensor readings I am receiving on the real robot. I printed the ranges (L90: left 90 deg; L45: left 45 deg; F: front; R45: right 45 deg; R90: right 90 deg) from the topic /scan and pose (x: x pos; y: y pos) from the topic /odom. From the images you can see that the x and y deviations are more than 0.5m. The same goes for the distances measured between the robot and obstacle. Even if this is not a simulation, the deviation is too huge for any proper obstacle avoidance.

I am not sure if I am missing something when reading the sensor values on the real robot. Can someone please advise?

Hi ,

Welcome to this Community!

You are a MasterClass student - you could have posted this on the Discord Channel!

Anyways, I think you have wrong indexes for the range values of the laser scanner.

Could you please post the ray indexes that you are using for L90, L45, F, R45, R90 ?

The odometry in the real robot situation WILL NOT BE THE SAME as in simulation.


Thanks for the reply.

I found out that I forgot to close the gazebo simulation.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.