src.plangym.control.box_2d#
Implement the plangym API for Box2D environments.
Classes#
Extract state information from Box2D environments. |
|
Common interface for working with Box2D environments released by gym. |
Module Contents#
- class src.plangym.control.box_2d.Box2DState[source]#
Extract state information from Box2D environments.
This class implements basic functionalities to get the necessary elements to construct a Box2D state.
- static get_body_attributes(body)[source]#
Return a dictionary containing the attributes of a given body.
Given a
Env.world.bodyelement, this method constructs a dictionary whose entries describe all body attributes.- Return type:
dict
- classmethod serialize_body_state(state_dict)[source]#
Serialize the state of the target body data.
This method takes as argument the result given by the method
self.get_body_attributes, the latter consisting in a dictionary containing all attribute elements of a body. The method returns a dictionary whose values are the serialized attributes of the body.
- classmethod set_body_state(body, state)[source]#
Set the state to the target body.
The method defines the corresponding body attribute to the value selected by the user.
- classmethod serialize_world_state(world)[source]#
Serialize the state of all the bodies in world.
The method serializes all body elements contained within the given
Env.worldobject.
- class src.plangym.control.box_2d.Box2DEnv(name, frameskip=1, autoreset=True, wrappers=None, delay_setup=False, remove_time_limit=True, render_mode='rgb_array', episodic_life=False, obs_type=None, return_image=False, **kwargs)[source]#
Bases:
plangym.core.PlangymEnvCommon interface for working with Box2D environments released by gym.
- Parameters:
name (str)
frameskip (int)
autoreset (bool)
wrappers (Iterable[wrap_callable] | None)
delay_setup (bool)
remove_time_limit (bool)
render_mode (str | None)