Implementation:Haosulab ManiSkill GroundBuilder
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Scene Building |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete tool for procedurally generating a textured ground plane with collision geometry for simulation scenes.
Description
The ground.py module provides the build_ground() function, which procedurally creates a checkered floor plane for ManiSkill scenes. The ground consists of two components:
1. Collision plane -- A SAPIEN plane collision shape positioned at the specified altitude, providing infinite-extent collision for physics simulation. 2. Visual mesh -- A procedurally generated triangle mesh with UV-mapped grid texture, creating the visible floor surface.
The visual mesh generation:
- Creates a grid of vertices spanning
floor_width x floor_lengthmeters, centered at the specifiedxy_origin. - Generates triangle faces from the vertex grid.
- Applies UV coordinates for texture tiling based on
texture_square_len. - Uses a default grid texture shipped with the module, with configurable mipmap levels.
Special behaviors:
- When
parallel_in_single_sceneis True, only one ground visual is built (for scene index 0) to avoid redundancy. - Rendering is only added when
scene.can_render()is True. - The function typically takes less than 0.05 seconds.
Usage
Called during environment scene building (_build_scene()) to create the ground plane. Most manipulation environments call this function.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/utils/building/ground.py
Signature
def build_ground(
scene: ManiSkillScene,
floor_width: int = 100,
floor_length: int = None,
xy_origin: tuple = (0, 0),
altitude=0,
name="ground",
texture_file=...,
texture_square_len=4,
mipmap_levels=4,
add_collision=True,
) -> Actor: ...
Import
from mani_skill.utils.building.ground import build_ground
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| scene | ManiSkillScene | Yes | The scene to add the ground to |
| floor_width | int | No | Width of the floor in meters (default: 100) |
| floor_length | int | No | Length of the floor (defaults to floor_width if None) |
| altitude | float | No | Z-height of the ground plane (default: 0) |
| name | str | No | Name for the actor (default: "ground") |
| add_collision | bool | No | Whether to add collision geometry (default: True) |
Outputs
| Name | Type | Description |
|---|---|---|
| actor | Actor | The built static ground actor with collision and visual geometry |
Usage Examples
Basic Usage
from mani_skill.utils.building.ground import build_ground
# Build a default ground plane
ground = build_ground(scene, floor_width=10)
# Build an elevated ground without collision
platform = build_ground(scene, floor_width=2, altitude=0.5, add_collision=False, name="platform")