SensorNoise Wrapper
To learn and evaluate control policies to noisy sensors, FluidGym provides the
SensorNoise wrapper, which adds noise to the observations returned by the
environment. This is particularly useful for simulating real-world scenarios where
sensors may not perform perfectly.
FluidGym wrappers can be used by importing them from the fluidgym.wrappers module
and wrapping the environment instance.
Here is a simple example from examples/wrappers/sensor_noise.py:
import fluidgym
from fluidgym.wrappers import SensorNoise
env = fluidgym.make(
"CylinderJet2D-easy-v0",
)
# Now, we add action noise to the environment's actions
env = SensorNoise(env, sigma=0.1, seed=42)
obs, info = env.reset(seed=42)
action = env.sample_action()
# Now, if we take a step, the observation will have noise added to it
obs, reward, terminated, truncated, info = env.step(action)