I was running perturbation experiments on FetchReach and noticed that noise_factor="state" has no visible effect on what the agent observes. After digging into the code, I think there's a bug in robot_env.py.
The step() function applies noise to obs["achieved_goal"] (line 178), but then returns obs["observation"] on line 200. For all Fetch environments, _get_obs() in gymnasium-robotics creates achieved_goal as grip_pos.copy() — a completely separate array — so adding noise there doesn't touch observation at all.
# line 178: noise goes here
obs["achieved_goal"] = obs["achieved_goal"] + random.gauss(args.noise_mu, args.noise_sigma)
# line 200: but this is what gets returned
return obs["observation"], reward, terminated, truncated, info
I compared with adroit_door.py (line 335) and kitchen_env.py (line 443)d directly to the returned observation — those work correctly because get_obs() returns a flat ndarray or they modify obs["observation"] directly.
The fix I'd expect is to change line 178 to obs["observation"] = obs["observation"] + noise instead of targeting achieved_goal. This would affect FetchReach/Push/Slide/PickAndPlace and Shadow Hand (anything using robot_env.py's step function).
Let me know if I'm misreading the intent — maybe state noise was supposed to only perturb the goal-achievement signal? But even then, the noisy achieved_goal isn't returned either, so it has no observable effect anywhere.
Also, do you have any plans to add perturbation on dynamics for other tasks? It seems dynamics perturb is only implemented on the locomotion tasks.
I was running perturbation experiments on FetchReach and noticed that
noise_factor="state"has no visible effect on what the agent observes. After digging into the code, I think there's a bug in robot_env.py.The
step()function applies noise toobs["achieved_goal"](line 178), but then returnsobs["observation"]on line 200. For all Fetch environments,_get_obs()in gymnasium-robotics creates achieved_goal asgrip_pos.copy()— a completely separate array — so adding noise there doesn't touch observation at all.I compared with adroit_door.py (line 335) and kitchen_env.py (line 443)d directly to the returned observation — those work correctly because
get_obs()returns a flat ndarray or they modifyobs["observation"]directly.The fix I'd expect is to change line 178 to
obs["observation"] = obs["observation"] + noiseinstead of targeting achieved_goal. This would affect FetchReach/Push/Slide/PickAndPlace and Shadow Hand (anything using robot_env.py's step function).Let me know if I'm misreading the intent — maybe state noise was supposed to only perturb the goal-achievement signal? But even then, the noisy achieved_goal isn't returned either, so it has no observable effect anywhere.
Also, do you have any plans to add perturbation on dynamics for other tasks? It seems dynamics perturb is only implemented on the locomotion tasks.