How to fix locations of objects in between environment resets? #87
-
Hi, In order to further simplify the tasks provided in Safety Gymnasium, I'd like to fix the locations of the objects that are sampled upon each reset. I looked into the source code, but it seems that there is no easy way to do this without either building a new placements dict (which are generated in full during running) or changing the Underlying object source code to not repeatedly sample a new layout upon each reset. Is there a way to fix the locations of objects so that they do not change after resetting the environment? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Please refer to the provided code. We've organized several boolean flags using dataclasses. You can find the relevant classes in the code, particularly this one: class MechanismConf:
r"""Mechanism options.
Starting position distribution.
Attributes:
randomize_layout (bool): If false, set the random seed before layout to constant.
continue_goal (bool): If true, draw a new goal after achievement.
terminate_resample_failure (bool): If true, end episode when resampling fails,
otherwise, raise a python exception.
"""
randomize_layout: bool = True
continue_goal: bool = True
terminate_resample_failure: bool = True This configuration is an attribute |
Beta Was this translation helpful? Give feedback.
If you're looking to add walls to an environment, please refer to the implementation in this class. Note that the walls implemented by this class are penetrable by default. To make them solid, you should remove the following lines:
By doing so, the walls will have a physical presence. You'll just need to reimplement a class according to your needs and integrate it into your specific task like so:
Since walls are immovable objects, they fall under the 'geom' category. For more information on the categorization of objects, please refer to the documentation here.
If you wish to directly change the position of an ob…