-
Notifications
You must be signed in to change notification settings - Fork 857
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
Fixes the rigid body tests #1345
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with a few minor comments.
Thanks again for pushing these back in and finding the weird bug!
cfg = sim_utils.GroundPlaneCfg( | ||
physics_material=materials.RigidBodyMaterialCfg( | ||
static_friction=static_friction_coefficient, | ||
dynamic_friction=static_friction_coefficient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a small comment on why this is necessary?
dynamic_friction=static_friction_coefficient, | |
dynamic_friction=static_friction_coefficient, # This shouldn't be required but is due to a bug in PhysX |
# Play sim | ||
sim.reset() | ||
|
||
# Set static friction to be non-zero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Set static friction to be non-zero | |
# Set static friction to be non-zero | |
# Dynamic friction also needs to be zero due to a bug in PhysX |
cube_object.write_root_velocity_to_sim(torch.zeros((num_cubes, 6), device=sim.device)) | ||
cube_mass = cube_object.root_physx_view.get_masses() | ||
gravity_magnitude = abs(sim.cfg.gravity[2]) | ||
# friction static condition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Can we add back in the comment regarding the test cases (might be too basic 😄)
# friction static condition | |
# 2 cases: force applied is below and above mu | |
# below mu: block should not move as the force applied is <= mu | |
# above mu: block should move as the force applied is > mu |
# let everything settle | ||
for _ in range(100): | ||
sim.step() | ||
cube_object.update(sim.cfg.dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious: Is this needed? What happens if we don't have these lines?
if force == "above_mu": | ||
self.assertTrue( | ||
(cube_object.data.root_state_w[..., 0] - initial_root_pos[..., 0] > 0.02).all() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Why check this only after the fact? Also, why not use assert_close?
|
||
cube_object_materials = torch.cat([static_friction, dynamic_friction, restitution], dim=-1) | ||
|
||
# Add friction to cube |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Add friction to cube | |
# Add restitution to cube |
Description
Fixes the commented out tests in the rigid body test
Type of change
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there