How to set map resolution properly with ROS2 cartographer?

Hi,

I have fixed this issue myself !

Solution:
I had to change the resolution parameter of occupancy_grid_node in cartographer.launch.py.

Node(package="cartographer_ros",
     executable="occupancy_grid_node",
     name="occupancy_grid_node",
     output="screen",
     parameters=[{"use_sim_time": True}],
     arguments=["-resolution", "0.010",   <--- change this parameter here!
                "-publish_period_sec", "1.0"],
     emulate_tty=True),

Now everything works as expected !

~~~ Update: ~~~
DO NOT USE the following line in the cartographer.lua config file.

TRAJECTORY_BUILDER_2D.submaps.grid_options_2d.resolution = 0.010

The above line has no effect when the resolution parameter is set in the occupancy_grid_node and priority is given to this value in the launch file.
~~~ End of Update ~~~

– Girish