-
Notifications
You must be signed in to change notification settings - Fork 14
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
Reintroduce alternative contact models and streamline changes to the new API #360
Open
flferretti
wants to merge
36
commits into
main
Choose a base branch
from
sprint/reintroduce_contact_models
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
bbf8f83
Create configuration for GPU benchmarks on local runner
flferretti 23aada9
Restore `api.model.forward_kinematics` for benchmarking
flferretti f791f91
Explicitly set `SoftContacts` in benchmarks
flferretti 071b249
Refactor workflow to improve performance result handling and caching
flferretti 6538907
Add benchmark for full simulation step
flferretti 3494ff7
Update benchmark command
flferretti a6aac9e
Increase ulimit stack size and use host IPC namespace
flferretti 9aedc95
Install Gazebo SDF
flferretti 662c08e
Skip soft and rigid contacts model tests
flferretti 9e37572
Pass API token for commenting PRs
flferretti 66b8c70
Ensure GPU utilization and benchmark vectorized computations
flferretti 33628bb
Always comment PRs and add permissions for GH pages
flferretti 05111af
Reintroduce soft, viscoelastic and rigid contact models
flferretti 29f9c61
Streamline new API changes to alternative contact models
flferretti 8eef5a2
Remove viscoelastic contact model
flferretti 65ac30c
Convert base post impact velocity to inertial before setting
flferretti 1d0b47c
Use polymorphism for estimating good contact parameters
flferretti 8822416
Use polymorphism to update the contact state during the step
flferretti e008f0d
Refactor initialization of `contact_state`
flferretti 8e6c3b5
Use polymorphism to update the post impact velocity
flferretti d3b8404
Make `build_default_from_jaxsim_model` compatible with all models
flferretti 6853fe3
Unify `api.contact_model` in `api.contact`
flferretti 39f9989
Rename `aux_dict` to `old_contact_state`
flferretti 6716a41
Make static methods functions in `RigidContacts`
flferretti f3ee2b6
Make `system_acceleration` return the contact state derivative
flferretti 4683e81
Parametrize contact tests on integrators
flferretti 71235cc
Allow replacing the contact state in `JaxSimModelData`
flferretti 4f0b7df
Clarify that the gravity should be passed as positive constant
flferretti 510a20d
Remove JIT compilation from inequality bounds function
flferretti 2f6c231
Remove unused methods in soft contacts
flferretti 49f062e
Speed up rigid contact model
flferretti 383a15b
Prevent recompilation on enabled collidable points
flferretti c853c4f
Remove duplicated Hunt-Crossley model
flferretti 1dd113d
Fix link forces representation in rigid contacts
flferretti ee5d8c8
Move `test_collidable_point_jacobians` to `test_api_contact`
flferretti 59a2a7b
Lint code and remove duplications
flferretti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: GPU Benchmarks | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * 1" # Run At 00:00 on Monday | ||
|
||
permissions: | ||
pull-requests: write | ||
deployments: write | ||
contents: write | ||
|
||
jobs: | ||
benchmark: | ||
runs-on: self-hosted | ||
container: | ||
image: ghcr.io/nvidia/jax:jax | ||
options: --rm --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
run: | | ||
pip install .[all] | ||
|
||
- name: Install Gazebo SDF | ||
run: | | ||
apt update && apt install -y lsb-release wget | ||
sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' | ||
wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - | ||
apt-get update | ||
apt install -y libsdformat14-dev libsdformat14 | ||
|
||
- name: Performance regression check | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run benchmark and store result | ||
run: | | ||
pytest tests/test_benchmark.py -k 'not test_rigid_contact_model and not test_soft_contact_model' --gpu-only --batch-size 128 --benchmark-only --benchmark-json output.json | ||
|
||
- name: Download previous benchmark data | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
|
||
- name: Store benchmark result | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
tool: 'pytest' | ||
output-file-path: output.json | ||
external-data-json-path: ./cache/benchmark-data.json | ||
fail-on-alert: true | ||
summary-always: true | ||
comment-always: true | ||
alert-threshold: 150% | ||
auto-push: false | ||
gh-pages-branch: gh-pages | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push benchmark result | ||
if: github.event_name != 'pull_request' | ||
run: git push 'https://ami-iit:${{ secrets.GITHUB_TOKEN }}@github.com/ami-iit/jaxsim.git' gh-pages:gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
actuation_model, | ||
com, | ||
contact, | ||
contact_model, | ||
frame, | ||
integrators, | ||
joint, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should pay attention to this change of representation for PR #359 in which the property returns data in the active representation (not always inertial)
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.
I'm accessing the attributes, not the property, so I believe it should always return the quantity in inertial representation, right?
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.
Yes, I agree, it should be equivalent
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.
yep true. Coming from other languages I don't like to access directly the "private" attributes of a class, is like coupling to the inner implementation of it. If in a next PR we change the representation in which they are stored it will be difficult to backtrace errors here, while if we use the class API we are relying on the class contract.
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.
Good point, we should see them as protected rather than private
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.
Leaving unresolved for now, thanks for pointing this out