RocketLander#

class do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander(args, render_mode=None)[source]#

Bases: Env

Gymnasum environment which models a Falcon 9 barge landing

Methods#

adjust_dynamics#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.adjust_dynamics(self, body, **kwargs)#

Adjust dynamic parameters of a body

close#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.close(self)#

After the user has finished using the environment, close contains the code necessary to “clean up” the environment.

This is critical for closing rendering windows, database or HTTP connections. Calling close on an already closed environment has no effect and won’t raise an error.

get_dimensional_properties#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.get_dimensional_properties(self)#

Get the l1 and l2 dimensions of the rocket - l1: longitudinal distance from rocket center to where the nozzle force is applied - l2: longitudinal distance from rocket center to height at which the side engine force is applied

l1 and l2 are measured along the centerline of the rocket

Returns:

l1, l2

Return type:

Tuple[float, float]

get_landing_position#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.get_landing_position(self)#

Get the landing point at the center of the barge, including tilt

Returns:

x, y, theta position of the barge

Return type:

Tuple[float, float, float]

get_mass_properties#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.get_mass_properties(self)#

Get approximate mass and inertia of rocket body We assume that most of the inertia is in the main body (rectangle) and neglect contributions of the lander legs and nozzle

Returns:

mass, inertia

Return type:

Tuple[float, float]

get_wrapper_attr#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.get_wrapper_attr(self, name)#

Gets the attribute name from the environment.

Return type:

Any

has_wrapper_attr#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.has_wrapper_attr(self, name)#

Checks if the attribute name exists in the environment.

Return type:

bool

render#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.render(self)#

Compute the render frames as specified by render_mode during the initialization of the environment.

The environment’s metadata render modes (env.metadata[“render_modes”]) should contain the possible ways to implement the render modes. In addition, list versions for most render modes is achieved through gymnasium.make which automatically applies a wrapper to collect rendered frames.

Note

As the render_mode is known during __init__, the objects used to render the environment state should be initialised in __init__.

By convention, if the render_mode is:

  • None (default): no render is computed.

  • “human”: The environment is continuously rendered in the current display or terminal, usually for human consumption. This rendering should occur during step() and render() doesn’t need to be called. Returns None.

  • “rgb_array”: Return a single frame representing the current state of the environment. A frame is a np.ndarray with shape (x, y, 3) representing RGB values for an x-by-y pixel image.

  • “ansi”: Return a strings (str) or StringIO.StringIO containing a terminal-style text representation for each time step. The text can include newlines and ANSI escape sequences (e.g. for colors).

  • “rgb_array_list” and “ansi_list”: List based version of render modes are possible (except Human) through the wrapper, gymnasium.wrappers.RenderCollection that is automatically applied during gymnasium.make(..., render_mode="rgb_array_list"). The frames collected are popped after render() is called or reset().

Note

Make sure that your class’s metadata "render_modes" key includes the list of supported modes.

Changed in version 0.25.0: The render function was changed to no longer accept parameters, rather these parameters should be specified in the environment initialised, i.e., gymnasium.make("CartPole-v1", render_mode="human")

reset#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.reset(self, seed=None, options=None)#

Reset the environment

set_wrapper_attr#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.set_wrapper_attr(self, name, value, *, force=True)#

Sets the attribute name on the environment with value, see Wrapper.set_wrapper_attr for more info.

Return type:

bool

step#

do_dpc.environments.legacy_coco_rocket.rocketlander.RocketLander.step(self, action)#

Simulate the environment forward by one step

Parameters:

action (np.ndarray) – actions to apply

Returns:

observation, reward, done, _, info

Return type:

Tuple[np.ndarray, float, bool, bool, dict]

Attributes#

metadata#

RocketLander.metadata: dict[str, Any] = {'render_fps': 60, 'render_modes': ['human', 'rgb_array']}#

np_random#

RocketLander.np_random#

Returns the environment’s internal _np_random that if not set will initialise with a random seed.

Returns:

Instances of np.random.Generator

np_random_seed#

RocketLander.np_random_seed#

Returns the environment’s internal _np_random_seed that if not set will first initialise with a random int as seed.

If np_random_seed was set directly instead of through reset() or set_np_random_through_seed(), the seed will take the value -1.

Returns:

the seed of the current np_random or -1, if the seed of the rng is unknown

Return type:

int

render_mode#

RocketLander.render_mode: str | None = None#

spec#

RocketLander.spec: EnvSpec | None = None#

unwrapped#

RocketLander.unwrapped#

Returns the base non-wrapped environment.

Returns:

The base non-wrapped gymnasium.Env instance

Return type:

Env

action_space#

RocketLander.action_space: spaces.Space[ActType]#

observation_space#

RocketLander.observation_space: spaces.Space[ObsType]#