ROSbot2 Pro lidar angular resolution vs Gazebo sim

Hi,

I notice that on the physical robot the ROS Laserscan message contains 1,440 ranges, but in Gazebo simulator, the Laserscan message has 400 ranges. This due to the lidar have different angular resolution on physical vs virtual.
Question 1) Is this finding correct?
Question 2) How can we change lidar configuration so that physical and virtual have same number of ranges?

Thank you for your help, it is greatly appreciated.

Regards,
Jon.

Hi,

Also it seems that the lidar range data in Gazebo ROSbot model is 180 degrees opposite, e.g. range element 200 is forward, whereas on physical ROSbot range element 0 is forward. How to change GAzebo model so that element 0 is forward?

Thank you and kind regards,
Jon.

Hi,

Okay, I solve it. The solution is to modify the rosbot.sdf model file.

<sensor type="ray" name="rp_lidar">
        <pose>0 0 0.015 0 0 3.1415</pose>
        <visualize>false</visualize>
        <update_rate>10</update_rate>
        <ray>
          <scan>
            <horizontal>
              <samples>1440</samples>

We change pose yaw value from 0 to 3.1415 (180 degrees). Now the lidar range element 0 is pointing forward. Second, we change the horizontal samples from 400 to 1440. We have 1440 elements for every 360 degree rotation.
These two changes make the ROSbot Gazebo model lidar is the same as the physical ROSbot2 Pro lidar.

Regards,
Jon.

Hi Jon,

I’m really sorry for late response. Thank you for sharing solution. Right now we are working on an improved simulation model of rosbot and we will try to include as many of your notes as possible.

In terms of reduced number of lidar rays we did it for performance reasons. Too many rays can cause issues with real time simulation. Also since simulated lidar is much more precise than real one, mapping can work nearly as well with less rays than on real robot.

Best regards,
Krzysztof Wojciechowski.

Hi,
Thank you for the details. I understand the issue regarding performance. The reason we require similar configuration between gazebo and real robot is to make it easier for our students to test their code in gazebo and then on the robot without having to make any changes to their code.
The other way is to reduce the real robot lidar angular resolution. How can we do this? Is there a yaml config in the rp_lidar package?
Thank you for your continued support,
Jon.

So I checked possibilities that came across my mind and neither rplidar nodes allow reducing scan count nor there aren’t any pre existing nodes that are reducing laser scans. You can either write your own lightweight node that will be removing some scans or modify the URDF file.

Personally I find modifying URDF simpler. Our URDF was created a few years ago and since then computing capabilities of regular PCs have increased so my guess is that there should be no problem with more laser scans right now.

Best regards,
Krzysztof Wojciechowski.

Thank you Krzysztof. We will adopt the increased laser scans in gazebo and test how performance is affected.
Kind regards,
Jon.