[Isaac 2022.2] Generalize the example for adding noise to sensors

Hi!

I have been following the tutorial for adding noise to camera.

Now, I am missing some more information about the general case. For instance, I was trying to add the same noise also for the BasicWriter class, so that I can choose to publish the image via ROS or save directly to a folder. However, I have run into issues trying to extend the approach, I cannot get the noise to apply to the BasicWriter.

For instance, in the example, we substitute the annotator before calling writer.initialize(). However, in the case of BasicWriter this is not possible, as the annotators array gets filled only after it is initialized. So I try to replace it after initialization, but I don’t get any output.

This is the code I added to the example:

.
.
.
basic_writer = rep.writers.get("BasicWriter")
basic_writer.initialize(
        output_dir="/tmp/att",
        rgb=True,
        bounding_box_2d_tight=True,
        semantic_segmentation=True,
        instance_segmentation=True,
        distance_to_image_plane=True,
        bounding_box_3d=True,
        occlusion=True,
        normals=True,
)
basic_writer.annotators[0] = basic_writer.annotators[0].augment(
    rep.Augmentation.from_function(image_gaussian_noise_np, kernel_seed=1234, sigma=25))

basic_writer.attach([render_product_path])

simulation_app.update()
.
.
.

When I add prints to the function, I see that it is being invoked and no errors are printed. However, I do not get the images saved in the directory. What am I doing wrong here? Is there any documentation on the annotators used in different writers and the data being passed through there?

Thanks!