Field cannot be reset

Hi,
When I start the program as standalone and execute clear_stage(), the program is forced to exit. Is this the default?

However, I was able to start the simulation with isaac-sim.sh and run clear_stage() in the script editor.

This is my program.

from omni.isaac.kit import SimulationApp
simulation_app = SimulationApp({"renderer": "RayTracedLighting", "headless": False})

from omni.isaac.core.utils.extensions import enable_extension
#ros_bridge on
enable_extension("omni.isaac.ros_bridge")

from omni.isaac.core import World
from omni.isaac.core.utils.nucleus import get_server_path
from omni.isaac.core.utils.stage import open_stage, clear_stage
import rospy
from std_msgs.msg import Bool
        
server_path = get_server_path()
asset_path = server_path + "/Users/base_world.usd"
open_stage(asset_path)
my_world = World()
my_world.reset()

finish_flag = False
pre_finish_flag = False

def CB_get_finish_flag(msg):
    global finish_flag
    finish_flag = msg.data
            
if __name__=="__main__":
    rospy.init_node("test", anonymous=True, disable_signals=True, log_level=rospy.ERROR)

    while simulation_app.is_running():
        my_world.step(render=True)
        rospy.Subscriber("finish_flag", Bool, CB_get_finish_flag)
        
        if (finish_flag == True) & (pre_finish_flag == False):
            clear_stage()
            open_stage(asset_path)
            print("ok")
        pre_finish_flag = finish_flag
        
    simulation_app.close()

Thank you

Can you try and reinitialize the world after opening a stage in the if condition, that should solve the issue

clear_stage()
open_stage(asset_path)
my_world = World()
my_world.reset()
print("ok")

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