Creating and Saving a world in Gazebo

Use the below tutorial to understand how to create a world using gazebo

Gazebo Tutorial

Your world will be saved in a SDF` format like test_world.sdf. You can rename the world file to test_world.world.

Add this file to the wordls` folder in your project package.

Make sure the worlds folder is added to CMakeLists.txt`

install(DIRECTORY
    urdf
    meshes
    launch
    worlds
    config
    DESTINATION share/${PROJECT_NAME}/
    )

Now for your robot to spawn in the new world edit the gazebo.launch.py` file. Change the line in below code with name of your world file.

# Get the location for empty world
world = os.path.join(
    get_package_share_directory('quadruped_robot'),
    'worlds',
    'test_world.world'
)

Build and run your project and the robot will spawn in new environment.