Hi Team,
I am working on ROS 2 Navigation in which i am trying to generate synthetic data.
In the Isaac Sim application my camera is modifying it pose and reading the images.
But as sson as I open the folder of save images
same images are being generated.
import omni.replicator.core as rep
with rep.new_layer():
def camera():
Camera = rep.get.prims(path_pattern = ‘/World/Carter_v2_4_ROS/Carter_V24/chassis_link/back_hawk/right/camera_right’, prim_types = ‘Camera’)
with Camera :
rep.modify.semantics([(‘class’, ‘Camera’)])
rep.modify.pose(
position = rep.distribution.uniform((0,0,0),(1,10,1))
)
return Camera.node
render_product = rep.create.render_product(rep.create.camera(), resolution=(1024, 1024))
rep.randomizer.register(camera)
writer = rep.WriterRegistry.get(“KittiWriter”)
writer.initialize(
output_dir = f"~/replicator_examples/kitti_writer",
bbox_height_threshold = 5,
fully_visible_threshold = .75,
omit_semantic_type = True
)
writer.attach([render_product])
with rep.trigger.on_frame(num_frames=100):
rep.randomizer.camera()
#rep.orchestrator.run()
I am using Isaac sim 2023 hotfix version with ubuntu 22.04 and ROS2 humble
Hi @arjun.mangal we chatted on discord, but I will post here so others can see if they have similar issues.
Off the top of my head, it looks like the issue is that you’re trying to use replicator modify functions on a camera that isn’t a replicator object. I’ll check with the devs on what the best way to handle this is, since you clearly have predefined cameras and positions that you want to manipulate. I’ll circle back when I have some suggestions.
Hi @pcallender .
Thanks for the reply.
Let me as soon as you can
Hi @arjun.mangal
I’ve looked through your script and corrected a few things with notes in the comments.
The below script modifies the pose of a camera that pre-exists in the scene.
import omni.replicator.core as rep
with rep.new_layer():
# I've named the randomizer something a bit more explicit, for clarity's sake
def move_camera(cam):
with cam :
rep.modify.pose(position = rep.distribution.uniform((0,0,0),(1,10,1)))
return cam.node
rep.randomizer.register(move_camera)
# I'm using basic writer for the purposes of quick tests on the camera, swap it back to the settings you need.
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize(output_dir="_camera_test", rgb=True)
Camera = rep.get.prims(path_pattern = '/World/Camera', prim_types = 'Camera')
# If you only need to apply these once, then do this here, and not in the randomizer each frame
with Camera:
rep.modify.semantics([('class', 'Camera')])
# Before, you were trying to create a camera in this line, you can just reference the camera directly
render_product = rep.create.render_product(Camera, resolution=(1024, 1024))
writer.attach([render_product])
with rep.trigger.on_frame(num_frames=10):
rep.randomizer.move_camera(Camera)