Skip to content

Commit

Permalink
Merge pull request #318 from ami-iit/flferretti-patch-2
Browse files Browse the repository at this point in the history
Inherit integrator attribute when reducing a `JaxSimModel`
  • Loading branch information
flferretti authored Dec 12, 2024
2 parents c896b48 + 329163b commit 87417c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/jaxsim/api/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def reduce(
time_step=model.time_step,
terrain=model.terrain,
contact_model=model.contact_model,
integrator=model.integrator,
)

# Store the origin of the model, in case downstream logic needs it.
Expand Down
9 changes: 9 additions & 0 deletions tests/test_api_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ def test_model_creation_and_reduction(
# Check that the reduced model maintains the same terrain of the full model.
assert model_full.terrain == model_reduced.terrain

# Check that the reduced model maintains the same contact model of the full model.
assert model_full.contact_model == model_reduced.contact_model

# Check that the reduced model maintains the same integration step of the full model.
assert model_full.time_step == model_reduced.time_step

# Check that the reduced model maintains the same integrator of the full model.
assert model_full.integrator == model_reduced.integrator

# Build the data of the reduced model.
data_reduced = js.data.JaxSimModelData.build(
model=model_reduced,
Expand Down

0 comments on commit 87417c9

Please sign in to comment.