pushkalkatara / Gen2Sim

Scaling up Robot Learning in Simulation with Generative Models
31 stars 1 forks source link

how to Generate URDF? #1

Open wccisagoodman opened 5 months ago

wccisagoodman commented 5 months ago

This is Asset Generation Pipeline:

preprocess input image

this will to the directory containing the input image.

python preprocess_image.py .png python preprocess_image.py .png --border_ratio 0.4 # increase border_ratio if the center object appears too large and results are unsatisfying.

Coarse NeRF Generation

python main.py -O --image _rgba.png --workspace asset --iters 5000

Mesh Fine-tuning

python main.py -O --image _rgba.png --workspace asset_dmtet --dmtet --init_with asset/checkpoints/df.pth

Extract Mesh

python main.py --workspace asset_dmtet -O --test --save_mesh

Generate URDF

python generate_urdf.py

I have run through the code except the last line ,but i don't know how to run the generate_urdf.py

if name == 'main': if len(sys.argv) != 3: print("Usage: python generate_urdf.py , Using default paths") assets_path = "/projects/gen2sim/output/" dest = "/projects/gen2sim/assets/" else: assets_path = sys.argv[1] dest = sys.argv[2]

asset_to_urdf = AssetToURDF()
for name in os.listdir(assets_path):
    print("Processing:", name)
    if not name.endswith("dmtet"):
        continue
    asset_category = name[:-6]
    asset_to_urdf.generate_urdf(asset_category, os.path.join(assets_path, name))
    asset_to_urdf.copy_asset(asset_category, os.path.join(assets_path, name), os.path.join(dest, asset_category))

when i run this code , the assets_path with name.endswith("dmtet") is a empty,how can i get the assets_path with name.endswith("dmtet") so that i can run though this code?

pushkalkatara commented 4 months ago

Hi @wccisagoodman ,

Once image-2-3d generation is complete, you would get an _dmtet as the output. In order to export URDF, ensure that this folder exists.