No sunstudy in isaacsim 4.5.0?

Isaac Sim Version

4.5.0

Operating System

Windows 11

Topic Description

We’ve been using sunstudy to randomize the time of day with dynamic sky in our data generation process. After downlaoding and setting up isaac sim 4.5.0 I cant find the sunstudy extention:

but in isaac sim 4.2.0:

how can i setup sunstudy in isaac sim 4.5.0?

Thank you

@danielle.sisserman i read on Discord from a mod that the sun study standalone extension was deprecated. the environment core and window you have enabled may offer similar control/capability. not sure if it’ll fit your specific use case for randomizing time of day programmatically through SDG, though. how have you been going about the randomization? i remember you had inquired about this a few years back.

@Simplychenable Yes thats right! So the way I do it is i enable the sunstudy extension and then in my code I use a wrapper i wrote for sunstudy:

import carb
from my_company.randomizer.usd_randomization.randomize import RandomizeUSD
from my_company.simulator.utils.singleton_base import SingletonBase
from my_company.sunstudy.wrapper import get_sunstudy_player
import random


class TimeRandomizer(RandomizeUSD, SingletonBase):

    def __init__(self, min_time = 6, max_time = 18, session_data_saver = None):
        if not hasattr(self, 'initialized'):
            self.sunstudy = get_sunstudy_player()
            self.min_time = min_time
            self.max_time = max_time
            self.initialized = True
            super().__init__(session_data_saver=session_data_saver)

    def randomize(self):
        random_float = random.uniform(self.min_time, self.max_time)
        #carb.log_error(f"Sunstudy time set to {random_float}")
        self.sunstudy.current_time = random_float
        self.save_random_value_selected(random_float)
        return random_float
    
    def save_random_value_selected(self, random_selected):
        if self.session_data_saver is not None:
            self.session_data_saver.add_time_stamp(random_selected)


    @staticmethod
    def get_current_time():
        instance = TimeRandomizer.get_instance()
        return instance.sunstudy.current_time

my wrapper is an extension with two scripts:

extension.py:

import omni.ext
import omni.ui as ui
from .custom_sunstudy import CustomSunstudyPlayer  
from typing import Any, Optional



_extension_instance = None

class MyCompanySunstudyWrapperExtension(omni.ext.IExt):
    def on_startup(self, ext_id):
        """Startup logic for our wrapper extension."""
        print("[MyCustomEnvironmentExtension] Custom extension started.")
        self._custom_sunstudy_player = None  # Initialize
            
        global _extension_instance
        _extension_instance = self

    def get_sunstudy_player(self):
        """Intercept and replace the built-in SunstudyPlayer with our custom version."""
        if self._custom_sunstudy_player is None:
            self._custom_sunstudy_player = CustomSunstudyPlayer()
        return self._custom_sunstudy_player

    def on_shutdown(self):
        """Cleanup logic when extension is disabled."""
        print("[MyCustomEnvironmentExtension] Custom extension shutting down.")
        self._custom_sunstudy_player = None  # Cleanup instance
        global _extension_instance
        _extension_instance = None


def get_instance() -> Optional[MyComapnySunstudyWrapperExtension]:
    return _extension_instance


def get_sunstudy_player() -> CustomSunstudyPlayer:
    instance = get_instance()
    if instance:
        return instance.get_sunstudy_player()
    else:
        return None

custom_sunstudy.py:

from omni.kit.environment.core.sunstudy_player.player import SunstudyPlayer
import carb

class CustomSunstudyPlayer(SunstudyPlayer):
    def _update_sky_data(self):
        if not (self._stage and self._sky_root):
            return
        
        carb.log_error("$$$$$$CustomSunstudyPlayer._update_sky_data()$$$$$$")
    
        prim = self._stage.GetPrimAtPath(self._sky_root)
        if prim.IsValid():
            sundata = self._get_sun_position(
                self._latitude_model.as_float,
                self._longitude_model.as_float,
                self._current_time_model.as_float,
                self._skydata["DayOfYear"],
                self._fixtimezone,
            )
            for k, v in sundata.items():
                self._skydata[k] = v
            self._write_sky_params()
            self._skysettings["SunIntensity"] = 1000
            self._update_fog()
1 Like

looks like we will have to wait for an official response from the devs/mods and see if there’s a workaround so you can still utilize your script.

@Simplychenable i agree. if sunstudy is no longer supported then the omniverse team would know of the new official tool to randomize time with dynamic sky