Skip to content

[Bug Report] Robot arm penetrates objects in the Pusher-v5 environmen #1576

@thanhminh97

Description

@thanhminh97

Describe the bug

During the simulation, the robot arm exhibits object penetration, passing through objects instead of interacting with them correctly through physical collisions (e.g., pushing or making contact as expected

num_up_409600_pt_-60.85.mp4

Code example

import os
import gymnasium as gym

os.environ["MUJOCO_GL"] = "egl"
env = gym.make('Pusher-v5', render_mode="rgb_array", width=1280, height=720)

 
observation,_ = env.reset()
obs = observation
k = 0
frames = []
for _ in range(1000):
        with torch.no_grad():
            obs_array = np.array(obs)
            obs_tensor = torch.tensor(obs_array, dtype=torch.float32).unsqueeze(0).to(device)
            action, logprob, _, value = agent.get_action_and_value(obs_tensor)
            next_obs, reward, terminated,ter , info = env.step(action[0].cpu().numpy())
            k+=reward
            obs=next_obs
            img = env.render()
            frames.append(img)
            # Fix for multi-env outputs
            if terminated or ter :
                break
video= f"num_up_{tong_ptv}_pt_{round(k, 2)}.mp4"

imageio.mimsave(video, frames, fps=30)

System info

!pip install gymnasium_robotics[mujoco-py]

gym.version == '1.2.0'

https://www.kaggle.com/

python --version == Python 3.12.12

Additional context

No response

Checklist

  • I have checked that there is no similar issue in the repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions