Modify.pose_camera_relative not working

Hey guys, I really need your help… trying to figure it out why I get this error, when I’m using a YAML and trying to get an object to be positioned inside the camera frustum.

2024-04-11 19:54:05 [3,250,229ms] [Error] [omni.kit.app.plugin] [py stderr]: IndexError: list index out of range

this is the YAML that give me an error:

# Create the camera and render product
camera:
  create.camera:
    position: [5, -1, 4]
    rotation: [0, -30, -27]

render_product:
  create.render_product:
    camera: camera
    resolution: [1024, 1024]


objs:
   randomizer.instantiate:
    paths:
      utils.get_usd_files:
        path: "omniverse://localhost/Users/stefano/handle.usd"
    size: 1


modify_objs:
   with_objs:
      inherit: general_modification

general_modification:
   modify.pose_camera_relative:
      distance:
            distribution.uniform:
               lower: 4
               upper: 20
      camera: camera
      render_product: render_products
      horizontal_location:
            distribution.uniform:
               lower: -1
               upper: 1
      vertical_location:
            distribution.uniform:
               lower: -0.7
               upper: 1


# Create the writer and initialize
writer:
  writers.get:
    name: "BasicWriter"
    init_params:
      output_dir: "_output_yaml/TutorialBasicFunctionality/"
      rgb: True
      bounding_box_2d_tight: True

writer_attach:
  writer.attach:
    render_products: render_product

# Set the trigger as on_frame
trigger:
  trigger.on_frame:
    max_execs: 10

@jiehanw @Turowicz

thanks!

@jiehanw I have updated the YAML with some corrections. don’t get any errors, BUT cubes does not receive any position modification based on camera… any ideas? does modify.pose_camera_relative is supposed to work like this in YAML?

camera:
  create.camera:
    position: [5, -1, 4]
    rotation: [0, -30, -27]

render_product:
  create.render_product:
    camera: camera
    resolution: [1024, 1024]

objs:
  create.cube:
    position: [5, -1, 4]
    count: 10
  modify.pose_camera_relative:
      distance: 500
      camera: camera
      render_product: render_products
      horizontal_location: 1
      vertical_location: 1

You should have a with statement and then you can modify your cube. After modification it should look like:

camera:
  create.camera:
    position: [5, -1, 4]
    rotation: [0, -30, -27]

render_product:
  create.render_product:
    camera: camera
    resolution: [1024, 1024]

objs:
  create.cube:
    position: [5, -1, 4]
    count: 10

modify_objs:
    with.objs:
      modify.pose_camera_relative:
          distance: 500
          camera: camera
          render_product: render_products
          horizontal_location: 1
          vertical_location: 1