Import omni.isaac.imu_sensor fail

useing python api: import omni.isaac.imu_sensor fail , i am sure the extension/imu_sensor is on, and i found imu.issac.imu_sensor under isaac_sim-2021.2.1/exts folder . here are the logs:

narwal@sz-0203062590:~/.local/share/ov/pkg/isaac_sim-2021.2.1$ ./python.sh
Python 3.7.12 (default, Sep 17 2021, 23:13:24)
[GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import omni.isaac.imu_sensor
terminate called after throwing an instance of ‘pybind11::error_already_set’
what(): SystemError: <built-in method contains of dict object at 0x7f5515439910> returned a result with an error set
./python.sh: line 43: 792857 Aborted (core dumped) $python_exe $@ $args

narwal@sz-0203062590:~/.local/share/ov/pkg/isaac_sim-2021.2.1$ ./python.sh
Python 3.7.12 (default, Sep 17 2021, 23:13:24)
[GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

_is = _imu_sensor.acquire_imu_sensor_interface()
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘_imu_sensor’ is not defined
from omni.isaac.imu_sensor import _imu_sensor
_is = _imu_sensor.acquire_imu_sensor_interface()
Traceback (most recent call last):
File “”, line 1, in
RuntimeError: Failed to acquire interface: omni::isaac::imu_sensor::struct IMUSensor (pluginName: nullptr)

can not acquire the imu interface

Hi @fzg7919

Please, check this post:

You can import it as follow:

from omni.isaac.kit import SimulationApp
kit = SimulationApp({"headless": True})

from omni.isaac.imu_sensor import _imu_sensor
_is = _imu_sensor.acquire_imu_sensor_interface()

Also, check the SimulationApp doc:

https://docs.omniverse.nvidia.com/py/isaacsim/source/extensions/omni.isaac.kit/docs/index.html

I have run the isaacsim from omniver_launcher and start the simulation, do i need the code ‘from omni.isaac.kit import SimulationApp
kit = SimulationApp({“headless”: True})’ ?

yes, i works ! thanks ! it will launch a isaacsim from pure python , but can i run isaacsim from omniverse manually and use python api such as omni.isaac.imu_sensor to get imu msg from the isaacsim ?

Yes, you can use the imu_sensor API from the Script Editor or from a user extension in a running Isaac Sim… Just make sure the extension is enabled

can you tell me more details about ’ imu_sensor API from the Script Editor or from a user extension in a running Isaac Sim’ ?? I run isaacsim from omniverse , and use python.exe from kit to run the python scripts of 'from omni.isaac.imu_sensor import _imu_sensor
_is = _imu_sensor.acquire_imu_sensor_interface() ’ it show the erros : ‘Traceback (most recent call last):
File “”, line 1, in
RuntimeError: Failed to acquire interface: omni::isaac::imu_sensor::struct IMUSensor (pluginName: nullptr)’ ; maybe the problem is in the external python scripts , it can not find the kit application of the running isaacsim , so it fails

Hi @fzg7919

If you want to run Python scripts (in pure Python mode)… as described in 4. Python Environment Installation — Omniverse Robotics documentation (./python.sh path/to/script.py) you need to instantiate the SimulationApp class to “load various plugins at runtime which cannot be imported unless the Toolkit is already running” (Simulation Application [omni.isaac.kit] — isaac_sim 2022.1.1-release.1 documentation and Python Environment — Omniverse Robotics documentation)

If you are running an Omniverse Isaac Sim GUI environment (from Omniverse Launcher or docker container) you can use the https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/tutorial_gui_script_editor.html#script-editor for debugging and experimenting with the Python code. In this case, you don’t need to create a SimulationApp object, the application is already managing the plugins and extensions. Then, to use the IMU extension, it must be enabled (from the Extensions Manager — Omniverse Create documentation for example), which is done by default…

Also, you can create a user extension and use the IMU sensor from there…
Learn more about extensions here:

okay !!! Thank you very much !! Your answer solved my confuse !! Thanks again!!!