Failing to register rigid body

I’m trying to move a simple box with the Dynamic Control Api, but I’m getting this error when trying to get the rigid body of it using the Script Editor

2022-06-08 10:24:22 [1,380,483ms] [Error] [omni.isaac.dynamic_control.plugin] Failed to register rigid body at '/World/drone/body'

This is my stage with the box on it and with Rigid Body applied to it.

This is my snippet:

import omni
from omni.isaac.dynamic_control import _dynamic_control
import omni.appwindow
import carb

omni.timeline.get_timeline_interface().play()


dc = _dynamic_control.acquire_dynamic_control_interface()
drone = dc.get_rigid_body("World/drone/body")


def _sub_keyboard_event(event, *args, **kwargs):
    global _command
    if (event.type == carb.input.KeyboardEventType.KEY_PRESS
        or event.type == carb.input.KeyboardEventType.KEY_REPEAT):
        if event.input == carb.input.KeyboardInput.W:
            print("W pressed")
        if event.input == carb.input.KeyboardInput.S:
            print("S pressed")
        if event.input == carb.input.KeyboardInput.A:
            print("A pressed")
        if event.input == carb.input.KeyboardInput.D:
            dc.apply_body_force(drone, [0 ,1000000 , 0],[1,0,0],False)
    if event.type == carb.input.KeyboardEventType.KEY_RELEASE:
        dc.apply_body_force(drone, [0 ,0 , 0],[1,0,0],False)
        

appwindow = omni.appwindow.get_default_app_window()
keyboard = appwindow.get_keyboard()
input = carb.input.acquire_input_interface()
sub_keyboard = input.subscribe_to_keyboard_events(keyboard, _sub_keyboard_event)
1 Like

For anyone landing here in the future:
So my problem was that I was getting the rigid body before an initial physic step, even so I started the sim through code. At least this is what I deducted by pressing play manually and after that running the script.

2 Likes

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