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

Preserve the original terrain in reduced models #168

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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