[Question] Is there a tutorial for creating subterrains using the terrain importer class ? #3175
Unanswered
Dafodilrat
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Thank you for posting this. While there isn’t a single “tutorial” page dedicated only to subterrains with TerrainImporter, the official API docs show how to configure and generate sub-terrains with TerrainGenerator and then import them via TerrainImporter, and the Tutorials section has end-to-end examples that use this pipeline. The workflow is: define sub-terrain configs in TerrainGeneratorCfg, generate the mesh and sub-terrain origins, and feed that into TerrainImporter to place them in-sim and derive env origins. I'll move this post to our Discussions for the team and others to follow up. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
I want to create multiple sub terrains separated by a gap with each sub terrain having its own prim. Currently I am able to create a grid with multiple sub-terrains but they are not separated and are all part of a single mesh ie. show up as a single plane.
figure illustrates 4 sub terrains combined to create 1 sub terrain. What I want is for the 4 subterrains to be its own thing with its own prims and all separated by a gap.
`import random
import math
from omni.isaac.kit import SimulationApp
Initialize SimulationApp
app = SimulationApp({
"headless": False,
"hide_ui": False,
"window_width": 1280,
"window_height": 720,
})
from isaacsim.core.api import World
from isaacsim.core.utils.prims import is_prim_path_valid, get_prim_at_path, create_prim
from isaaclab.terrains import TerrainImporter, TerrainImporterCfg, TerrainGeneratorCfg
from isaaclab.terrains.height_field import HfRandomUniformTerrainCfg
from pxr import UsdGeom, Gf
import logging
Set up logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(name)
Initialize World
world = World(stage_units_in_meters=1.0, set_defaults=True, device="cuda")
world.reset() # Initialize the simulation context
Ensure /World prim exists
if not is_prim_path_valid("/World"):
create_prim("/World", "Xform")
logger.debug("Created /World prim")
class TrainingGroundGenerator:
@staticmethod
def spawn_grid(n=1, cell_size=15.0, sub_terrain_types=None, prim_path="/World/TerrainGrid", gap_factor=3.0):
logger.debug(f"Spawning grid with n={n}, cell_size={cell_size}, gap_factor={gap_factor}, prim_path={prim_path}")
num_rows = math.ceil(math.sqrt(n))
num_cols = math.ceil(n / num_rows)
logger.debug(f"Computed grid: {num_rows}x{num_cols}")
Beta Was this translation helpful? Give feedback.
All reactions