Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Isaac sim IsaacGymEnvs GenerateCuboids

From Leeroopedia
Revision as of 13:07, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Isaac_sim_IsaacGymEnvs_GenerateCuboids.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Asset_Generation, Simulation
Last Updated 2026-02-15 11:00 GMT

Overview

GenerateCuboids provides functions for procedurally generating URDF cuboid assets of varying dimensions using Jinja2 templates, enabling domain randomization over object shapes during training.

Description

This module contains a set of functions for programmatically generating URDF files that describe cuboid-shaped objects with different scale factors. The core generate_assets function iterates over all combinations of x, y, and z scale factors, filters them by volume constraints and custom filter functions, then renders a Jinja2 URDF template with the computed dimensions to produce individual URDF files in a specified output directory.

Several preset generation functions are provided for different categories of objects. generate_default_cube creates a single unit cube. generate_small_cuboids generates cuboids with volumes between 1.0 and 2.5 (relative units) across a range of scale factors. generate_big_cuboids produces larger cuboids (volume 2.5 to 15.0) with an additional filter that removes thin plate-like shapes. generate_sticks creates elongated stick-like objects (volume 2.5 to 6.0) using both a thin-plate filter and a non-elongated filter to ensure only stick-shaped objects are produced.

The filter functions filter_thin_plates and filter_non_elongated operate on sorted scale lists to determine whether a particular cuboid shape should be skipped. filter_thin_plates rejects shapes where the smallest dimension is less than one-third of the second dimension, while filter_non_elongated rejects shapes where the largest dimension is not at least three times the other two dimensions.

Usage

Use these functions when preparing varied object assets for training dexterous manipulation policies. Call the appropriate generation function before training begins to populate an asset directory with URDF files. The generated assets are then loaded by the Allegro-Kuka task environments to provide shape diversity during training, improving policy generalization.

Code Reference

Source Location

Signature

def generate_assets(
    scales, min_volume, max_volume, generated_assets_dir, base_mesh, base_cube_size_m, filter_funcs: List[FilterFunc]
):
    ...

def filter_thin_plates(scales: List[int]) -> bool:
    ...

def generate_default_cube(assets_dir, base_mesh, base_cube_size_m):
    ...

def generate_small_cuboids(assets_dir, base_mesh, base_cube_size_m):
    ...

def generate_big_cuboids(assets_dir, base_mesh, base_cube_size_m):
    ...

def filter_non_elongated(scales: List[int]) -> bool:
    ...

def generate_sticks(assets_dir, base_mesh, base_cube_size_m):
    ...

Import

from isaacgymenvs.tasks.allegro_kuka.generate_cuboids import generate_assets, generate_small_cuboids

I/O Contract

Inputs

Name Type Required Description
scales list Yes List of integer scale percentages to combine (e.g., [50, 75, 100, 150, 200])
min_volume float Yes Minimum volume threshold for generated cuboids (in relative units)
max_volume float Yes Maximum volume threshold for generated cuboids (in relative units)
generated_assets_dir str Yes Output directory path where generated URDF files will be written
base_mesh str Yes Path to the base mesh file used in the URDF template
base_cube_size_m float Yes Base cube edge length in meters, scaled by the percentage factors
filter_funcs List[FilterFunc] Yes List of filter callables; each takes sorted scale list and returns True to skip that shape

Outputs

Name Type Description
URDF files files Generated URDF files written to generated_assets_dir with naming pattern {idx:03d}_cube_{x}_{y}_{z}.urdf

Usage Examples

from isaacgymenvs.tasks.allegro_kuka.generate_cuboids import (
    generate_default_cube,
    generate_small_cuboids,
    generate_big_cuboids,
    generate_sticks,
)

# Generate a single default cube
generate_default_cube(
    assets_dir="/path/to/generated_assets",
    base_mesh="cube.obj",
    base_cube_size_m=0.05,
)

# Generate a variety of small cuboids for training
generate_small_cuboids(
    assets_dir="/path/to/generated_assets",
    base_mesh="cube.obj",
    base_cube_size_m=0.05,
)

# Generate larger cuboids (thin plates are filtered out)
generate_big_cuboids(
    assets_dir="/path/to/generated_assets",
    base_mesh="cube.obj",
    base_cube_size_m=0.05,
)

# Generate stick-shaped objects
generate_sticks(
    assets_dir="/path/to/generated_assets",
    base_mesh="cube.obj",
    base_cube_size_m=0.05,
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment