habitat_sim.attributes_managers.PhysicsAttributesManager class

Manages PhysicsManagerAttributes which define global Simulation parameters such as timestep. Can import .physics_config.json files.

Methods

def create_new_template(self, handle: str, register_template: bool = False) -> attributes.PhysicsManagerAttributes
Creates a PhysicsAttributes template built with default values, and registers it in the library if register_template is True.
def create_template(self, handle: str, register_template: bool = True) -> attributes.PhysicsManagerAttributes
Creates a PhysicsAttributes template based on passed handle, and registers it in the library if register_template is True.
def filter_filepaths(self, attributes: attributes.PhysicsManagerAttributes) -> None
This attempts to filter any filenames in the passed PhysicsAttributes template so that the fields that would be saved to file would only contain relative paths.
def get_first_matching_template_by_handle(self, handle_substr: str) -> attributes.PhysicsManagerAttributes
This returns a copy of the first PhysicsAttributes template containing the passed handle substring if any exist, and NULL if none could be found.
def get_library_has_handle(self, handle: str) -> bool
Returns whether the passed handle describes an existing PhysicsAttributes template in the library.
def get_library_has_id(self, template_id: int) -> bool
Returns whether the passed template ID describes an existing PhysicsAttributes template in the library.
def get_num_templates(self, /) -> int
Returns the number of existing PhysicsAttributes templates being managed.
def get_random_template_handle(self, /) -> str
Returns the handle for a random PhysicsAttributes template chosen from the existing PhysicsAttributes templates being managed.
def get_template_by_handle(self, handle: str) -> attributes.PhysicsManagerAttributes
This returns a copy of the PhysicsAttributes template specified by the passed handle if it exists, and NULL if it does not.
def get_template_by_id(self, template_id: int) -> attributes.PhysicsManagerAttributes
This returns a copy of the PhysicsAttributes template specified by the passed ID if it exists, and NULL if it does not.
def get_template_handle_by_id(self, template_id: int) -> str
Returns string handle for the PhysicsAttributes template corresponding to passed ID.
def get_template_handles(self, search_str: str = '', contains: bool = True, sorted: bool = True) -> typing.List[str]
Returns a potentially sorted list of PhysicsAttributes template handles that either contain or explicitly do not contain the passed search_str, based on the value of boolean contains.
def get_template_id_by_handle(self, handle: str) -> int
Returns integer ID for the PhysicsAttributes template with the passed handle.
def get_templates_CSV_info(self, search_str: str = '', contains: bool = True) -> str
Returns a comma-separated string describing each PhysicsAttributes template whose handles either contain or explicitly do not contain the passed search_str, based on the value of boolean contains. Each template’s info is separated by a newline.
def get_templates_by_handle_substring(self, search_str: str = '', contains: bool = True) -> typing.Dict[str, attributes.PhysicsManagerAttributes]
Returns a dictionary of PhysicsAttributes templates, keyed by their handles, for all handles that either contain or explicitly do not contain the passed search_str, based on the value of boolean contains.
def get_templates_info(self, search_str: str = '', contains: bool = True) -> typing.List[str]
Returns a list of CSV strings describing each PhysicsAttributes template whose handles either contain or explicitly do not contain the passed search_str, based on the value of boolean contains.
def get_undeletable_handles(self, /) -> typing.List[str]
Returns a list of PhysicsAttributes template handles for PhysicsAttributes templates that have been marked undeletable by the system. These PhysicsAttributes templates can still be edited.
def get_user_locked_handles(self, /) -> typing.List[str]
Returns a list of PhysicsAttributes template handles for PhysicsAttributes templates that have been marked locked by the user. These will be undeletable until unlocked by the user. These PhysicsAttributes templates can still be edited.
def is_valid_filename(self, handle: str) -> bool
Returns whether the passed handle is a valid, existing file.
def load_configs(self, path: str, save_as_defaults: bool = False) -> typing.List[int]
Build PhysicsAttributes templates for all JSON files with appropriate extension that exist in the provided file or directory path. If save_as_defaults is true, then these PhysicsAttributes templates will be unable to be deleted
def register_template(self, template: attributes.PhysicsManagerAttributes, specified_handle: str = '', force_registration: bool = False) -> int
This registers a copy of the passed PhysicsAttributes template in the library, and returns the template’s integer ID.
def remove_all_templates(self, /) -> typing.List[attributes.PhysicsManagerAttributes]
This removes, and returns, a list of all the PhysicsAttributes templates referenced in the library that have not been marked undeletable by the system or read-only by the user.
def remove_template_by_handle(self, handle: str) -> attributes.PhysicsManagerAttributes
This removes, and returns the PhysicsAttributes template referenced by the passed handle from the library.
def remove_template_by_id(self, template_id: int) -> attributes.PhysicsManagerAttributes
This removes, and returns the PhysicsAttributes template referenced by the passed ID from the library.
def remove_templates_by_str(self, search_str: str = '', contains: bool = True) -> typing.List[attributes.PhysicsManagerAttributes]
This removes, and returns, a list of all the PhysicsAttributes templates referenced in the library that have not been marked undeletable by the system or read-only by the user and whose handles either contain or explicitly do not contain the passed search_str.
def save_template_by_handle(self, handle: str, overwrite: bool) -> bool
Saves the PhysicsAttributes template referenced by the passed handle to its source location if overwrite is true, will create a new incremented filename if overwrite is false. Returns whether was successful or not.
def save_template_by_handle_to_filepath(self, handle: str, filepath: str) -> bool
Saves the PhysicsAttributes template referenced by the passed handle to the passed path, creating subdirectories if they do not exist. Returns whether was successful or not.
def save_template_to_filepath(self, handle: attributes.PhysicsManagerAttributes, filepath: str, create_subdir: bool) -> bool
Saves the passed PhysicsAttributes template to the passed filepath. If only a filename is passed, it will save this template in its original source directory, otherwise if path + filename is passed it will save the template to the specified filepath, creating any necessary subdirectories only if create_subdir is true. If create_subdir is false, it will fail with a message if any subdirectories in the requested filepath do not exist.
def save_template_to_filepath(self, handle: attributes.PhysicsManagerAttributes, filepath: str, filename: str, create_subdir: bool) -> bool
Saves the passed PhysicsAttributes template to the passed filepath + filename, creating any necessary subdirectories only if create_subdir is true. If create_subdir is false, it will fail with a message if any subdirectories in the requested filepath subdirectories do not exist.
def set_lock_by_substring(self, lock: bool, search_str: str = '', contains: bool = True) -> typing.List[str]
This sets the lock state for all PhysicsAttributes templates whose handles either contain or explicitly do not contain the passed search_str. Returns a list of handles for PhysicsAttributes templates locked by this function call. Lock == True makes the PhysicsAttributes template unable to be deleted. Note : Locked PhysicsAttributes templates can still be edited.
def set_template_list_lock(self, handles: typing.List[str], lock: bool) -> typing.List[str]
This sets the lock state for all PhysicsAttributes templates whose handles are passed in list. Returns a list of handles for templates locked by this function call. Lock == True makes the PhysicsAttributes template unable to be deleted. Note : Locked PhysicsAttributes templates can still be edited.
def set_template_lock(self, handle: str, lock: bool) -> bool
This sets the lock state for the PhysicsAttributes template that has the passed name. Lock == True makes the PhysicsAttributes template unable to be deleted. Note : Locked PhysicsAttributes templates can still be edited.