upkie 6.1.0
Open-source wheeled biped robots
|
Model lag by applying a low-pass filter to the action of an environment. More...
Public Member Functions | |
def | __init__ (self, env, Union[float, gym.spaces.Box] time_constant) |
Initialize wrapper. More... | |
def | reset (self, **kwargs) |
Reset the environment. More... | |
Tuple[np.ndarray, float, bool, bool, dict] | step (self, np.ndarray action) |
Step the environment. More... | |
Model lag by applying a low-pass filter to the action of an environment.
Note that there is a difference between "delay" and "lag":
output(t + delay) = input(t)
.d/dt{output}(t) = lag * (input(t) - output(t))
.In this wrapper, we model lag where the output (action forward to the wrapped environment) is a low-pass filtered version of the input (action passed to step
).
def upkie.envs.wrappers.add_lag_to_action.AddLagToAction.__init__ | ( | self, | |
env, | |||
Union[float, gym.spaces.Box] | time_constant | ||
) |
Initialize wrapper.
env | Environment to wrap. |
time_constant | Cutoff period in seconds of the low-pass filter applied to the action. If a Box is provided, couple of lower and upper bounds for the action: a new time constant is sampled uniformly at random between these bounds at every reset of the environment. |
def upkie.envs.wrappers.add_lag_to_action.AddLagToAction.reset | ( | self, | |
** | kwargs | ||
) |
Reset the environment.
kwargs | Keyword arguments forwarded to the wrapped environment. |
Tuple[np.ndarray, float, bool, bool, dict] upkie.envs.wrappers.add_lag_to_action.AddLagToAction.step | ( | self, | |
np.ndarray | action | ||
) |
Step the environment.
action | Action from the agent. |