RocketEnvFacade#

class do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade(env_args, video_name_prefix='dpc-ctrl', record_video=True, use_virtual_actuators=False, seed=0)[source]#

Bases: object

A high-level interface for interacting with the rocket environment.

This class manages the environment setup, resets, simulation steps, and provides relevant system outputs, including references and bounds.

env#

The rocket environment instance.

Type:

gym.Env

lin_sys#

Linearized system model of the rocket.

Type:

StateSpaceModel

landed_successfully#

Tracks whether the rocket has landed successfully.

Type:

bool

done#

Indicates if the episode has ended.

Type:

bool

use_virtual_actuators#

Whether virtual actuators are used.

Type:

bool

y#

The current system output.

Type:

np.ndarray

Parameters:
  • env_args (RocketEnvironmentArguments) – Arguments for configuring the environment.

  • video_name_prefix (str, optional) – Prefix for recorded video files. Defaults to “dpc-ctrl”.

  • record_video (bool, optional) – Whether to record videos of the environment. Defaults to True.

  • use_virtual_actuators (bool, optional) – Whether to use virtual actuators. Defaults to False.

  • seed (int, optional) – Random seed for environment initialization. Defaults to 0.

Methods#

close#

do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade.close(self)#

Closes the environment.

get_dims#

do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade.get_dims()#

Returns m, p

Return type:

Tuple[int, int]

get_input_bounds#

do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade.get_input_bounds(self)#

Retrieves the bounds for valid input values.

Returns:

The upper and lower input limits.

Return type:

Bounds

get_output#

do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade.get_output(self)#

Retrieves the current system output.

Returns:

The system output y.

Return type:

np.ndarray

get_y_u_reference#

do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade.get_y_u_reference(self, set_theta_ref_to_zero=True)#

Computes the reference output and input for landing.

Parameters:

set_theta_ref_to_zero (bool, optional) – Whether to set the reference angle to zero. Defaults to True.

Returns:

Reference output y_r and reference input u_r.

Return type:

tuple[np.ndarray, np.ndarray]

reset#

do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade.reset(self, seed=0)#

Resets the environment and returns the initial system output.

Parameters:

seed (int, optional) – The random seed for environment reset. Defaults to 0.

Returns:

The initial system output y.

Return type:

np.ndarray

step#

do_dpc.environments.rocket_env.rocket_env_facade.RocketEnvFacade.step(self, u_next)#

Takes a step in the environment with the given input.

Parameters:

u_next (np.ndarray) – The next input action.

Returns:

The updated system output y.

Return type:

np.ndarray