Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Initialization Velocities Scale with Distance from the Origin #1

Open
zalo opened this issue Aug 30, 2022 · 3 comments
Open

[BUG] Initialization Velocities Scale with Distance from the Origin #1

zalo opened this issue Aug 30, 2022 · 3 comments

Comments

@zalo
Copy link

zalo commented Aug 30, 2022

@ViktorM

While writing a MuJoCo-Viewer Renderer for DiffRL, I noticed that initialization velocities appear to scale the farther out an actor is from the origin.

This behavior appears to occur in the original .usd's as well, so I don't believe it's an artifact of the visualization.

ExplodingVelocities.mp4

The early termination threshold also seems more sensitive far away from the origin.

I tested setting the stochastic initialization velocity to a constant and the velocities were still amplified far away from the origin, so I believe this is something deeper within the fundaments of dflex...

@ViktorM
Copy link
Collaborator

ViktorM commented Sep 20, 2022

Hi @zalo,

Sorry for the late response. Great job with Mujoco viewer! It looks very nice. As a workaround, I can propose placing all the ants at the same start pose and render with displacement only their visual meshes.

@mmacklin could it be because of the way in dflex joint_qd are not in the center of mass in a world frame, but in a twist representation?

# convert the linear velocity of the torso from twist representation to the velocity of the center of mass in world frame
lin_vel = lin_vel - torch.cross(torso_pos, ang_vel, dim = -1)

@zalo
Copy link
Author

zalo commented Sep 24, 2022

Ah, interesting! That does indeed seem to fix the issue.

I also note that the separation of the agents is disabled when not visualizing:
https://github.com/NVlabs/DiffRL/blob/main/envs/ant.py#L94-L97

Perhaps this behavior is a known issue?

@zalo
Copy link
Author

zalo commented Sep 25, 2022

Dividing initial velocities by their distance from the origin appears to normalize the velocities across the spread, even in visualization.

I tested this by appending :

/ torch.clamp_min(self.start_pos[env_ids, 2:3], 1.0)

to the end of this line, but using the magnitude is probably preferable. 👍

imgeorgiev pushed a commit to imgeorgiev/DiffRL that referenced this issue Feb 28, 2024
Warp envs syntax and added doubleqcritic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants