I am trying to test the functionality of scatter_2D and when I use Omniverse Code, scatters are not collision free. Does check_for_collison=True
work in Omniverse Code? I even added collider() to plane but it didn’t work.
As you see scattered pallets dived into the inside of the plane.
import omni.replicator.core as rep
from datetime import datetime
import omni.usd
# import omni.isaac.core.utils.bounds as bounds_utils
# import omni.isaac.core.utils.prims as prims_utils
with rep.new_layer():
# Define paths for the character, the props, the environment and the surface where the assets will be scattered in.
PALLET_URL = "omniverse://localhost/NVIDIA/Assets/ArchVis/Industrial/Pallets/Pallet_B1.usd"
plane = rep.create.plane(scale=25, visible=True, semantics=[("class", "plane")])
with plane:
rep.physics.collider()
print('type of plane: ', print(plane))
def scatter_pallets():
pallets = rep.create.from_usd(PALLET_URL, semantics=[('class', 'pallet')], count=10)
with pallets:
#rep.physics.collider()
rep.randomizer.scatter_2d(surface_prims=plane, check_for_collisions=True)
return pallets
# Register randomization
rep.randomizer.register(scatter_pallets)
# Setup camera and attach it to render product
camera = rep.create.camera(
focus_distance=800,
f_stop=0.5
)
render_product = rep.create.render_product(camera, resolution=(1024, 1024))
timestamp = datetime.now().strftime("%Y_%m_%d-%I_%M_%S_%p")
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(output_dir="/home/mona/Desktop/Isaac_Sim_Dummy_Out/pallet/" + timestamp , rgb=True, bounding_box_2d_tight=True)
writer.attach([render_product])
with rep.trigger.on_frame(num_frames=100):
pallets = rep.randomizer.scatter_pallets()
with camera:
rep.modify.pose(position=rep.distribution.uniform((-1000, 200, 1500), (1000, 400, 2000)), look_at=pallets)
When I try the code in Isaac Sim, dimensions are messed up hence I cannot test it. If you can tell me how I can can test this code in Isaac Sim Script Editor it would be really great.