Problems to get self._cube.get_world_pose()


After a couple days I got stuck in my code writing. I have written a Python script which open USD.

def setup_scene(self):
    world = self.get_world()

    cube = omni.kit.commands.execute("CreatePayload",usd_context=omni.usd.get_context(),
                                     path_to=Sdf.Path("/World/testi"), # Prim path for where to create the payload
                                     asset_path=USD_folder, # The file path to payload asset. Relative paths are accepted too.
                                     instanceable=True # The instanceable metadata value for the `path_to` prim

And I have following primatives in the stage

I have no idea after multiple iterations how I could get the position and orientation data for the rod ? I have tried to modify the hello world example, but the Python complains that None has .get_world_pose(). Any ideas and how I should modify the following code ?

self._world = self.get_world()
self._cube = self._world.scene.get_object(“fancy_cube”)
position, orientation = self._cube.get_world_pose()
linear_velocity = self._cube.get_linear_velocity()
# will be shown on terminal
print("Cube position is : " + str(position))
print("Cube’s orientation is : " + str(orientation))
print("Cube’s linear velocity is : " + str(linear_velocity))

Hi @petri.seppanen - Someone from our team will review and respond to your question.

Hello! Can you post your full script? So we can help you on what’s missing

Hi. I have solved this. Forget to mention here

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.