I am working on an autonomous mobile robot based on ROS. All the tutorials and examples requires a static map which need to be generated in order to do the localization and mapping. Do i need to scan the environment using stereo camera or lidar and generate a static map before doing the path planing and navigation of mobile robot? If so why? and for autonomous car did google and other companies mapped the whole city and generated map?
I think you're confused on a few points.
- Mapping is when you try to build a map, given a known location.
- Localizing is when you try to locate yourself, given a known map.
- SLAM is simultaneous localization and mapping, where you try to build a map and localize yourself in that map on-the-fly.
You mention "localization and mapping" in your question, but in your comment to Chris Charles you mention specifically the AMCL package.
The AMCL package is for localization only. It does not do localization and mapping so, per point (2) above, you need a known map.
There are SLAM packages available for ROS, but the one you're referencing doesn't do SLAM, it does L.