Replicator Writer does not work for randomization

Hi everyone, I tried to randomize cars in my scenery, trigger the randomization and save the frame image. The problem was the randomization worked but there was no frame saved in my folder. The below is my code

import omni.replicator.core as rep

with rep.new_layer():
camera = rep.create.camera(position = (-4212, 1047, 4522), rotation = (0, -65, -5))
render_product= rep.create.render_product(camera, (1024, 1024))

def cars_move():
	cars = rep.get.prims(semantics=[('class','SD'),('class','CP'),('class','SUV'),('class','MV')])
	
	with cars:
		rep.modify.pose(
			position=rep.distribution.uniform((-4000,0,-4000),(0,0,000)),
			rotation=rep.distribution.uniform((-90,0,0),(-90,180,0)),
		)
		rep.modify.visibility(rep.distribution.choice([True, False]))
		
	MTs = rep.get.prims(semantics=[('class','MT')])
	
	with MTs:
		rep.modify.pose(
			position=rep.distribution.uniform((-2500,0,-1000),(1000,0,2000)),
			rotation=rep.distribution.uniform((0,0,0),(0,180,0)),
		)
		rep.modify.visibility(rep.distribution.choice([True, False]))
		
	return cars.node, MTs.node


#Randomization Register
rep.randomizer.register(cars_move)

result_path = "C:/Users/VOTRANDANGKHOA/Downloads/Result"

with rep.trigger.on_frame(num_frames=500):
	rep.randomizer.cars_move()
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(
	output_dir=result_path, rgb=True, 
	semantic_segmentation=True, 
	)
writer.attach([render_product])

rep.orchestrator.run()

Hi @dangkhoa Sorry for the late reply. First, check your console for errors on run, or grab the log and put it up here and we can get a much clearer idea why things aren’t generating.

Taking a quick look at the script a few things jump out at me.

You’re missing a camera and renderproduct. Try adding these:

#Create the replicator camera
camera = rep.create.camera(position=(1347,825,1440), look_at=(0,100,0))

# Create the render product
render_product  = rep.create.render_product(camera, (1920, 1080))

Secondly, I’m unsure whether you can define multiple node outputs on your randomizer. Try sticking with just one and see it if works, then try two to see if that might be it.

return cars.node, MTs.node

Dropping your log here is likely to be the best way to narrow the issue down, but see if the above suggestions help.