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

Fixes the rigid body tests #1345

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fixes the rigid body tests #1345

wants to merge 1 commit into from

Conversation

Dhoeller19
Copy link
Collaborator

Description

Fixes the commented out tests in the rigid body test

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Copy link
Collaborator

@jsmith-bdai jsmith-bdai left a 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,
Copy link
Collaborator

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?

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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
Copy link
Collaborator

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 😄)

Suggested change
# 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

Comment on lines +470 to +473
# let everything settle
for _ in range(100):
sim.step()
cube_object.update(sim.cfg.dt)
Copy link
Collaborator

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?

Comment on lines +512 to +515
if force == "above_mu":
self.assertTrue(
(cube_object.data.root_state_w[..., 0] - initial_root_pos[..., 0] > 0.02).all()
)
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Add friction to cube
# Add restitution to cube

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

Successfully merging this pull request may close these issues.

2 participants