Skip to content

Commit

Permalink
Merge pull request #168 from xela-95/fix/reduce-model-terrain
Browse files Browse the repository at this point in the history
Maintain same terrain when reducing a model
  • Loading branch information
diegoferigo authored Jun 4, 2024
2 parents a689cb5 + 2f47dad commit fbd1f08
Show file tree
Hide file tree
Showing 2 changed files with 4 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 @@ -338,6 +338,7 @@ def reduce(
reduced_model = JaxSimModel.build(
model_description=reduced_intermediate_description,
model_name=model.name(),
terrain=model.terrain,
)

# Store the origin of the model, in case downstream logic needs it
Expand Down
3 changes: 3 additions & 0 deletions tests/test_api_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def test_model_creation_and_reduction(
# Check that all non-fixed joints are in the reduced model.
assert set(reduced_joints) == set(model_reduced.joint_names())

# Check that the reduce model maintain the same terrain of the full model.
assert model_full.terrain == model_reduced.terrain

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

0 comments on commit fbd1f08

Please sign in to comment.