Always forward to the integrator the model
and data
passed to jaxsim.api.model.step
#183
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.
This modification is necessary to re-use the same jit-compiled
jaxsim.api.model.step
function and the same integrator (closed over an initial model) on a modified model having the same structure of the initial model.It enables running simulations with parametric models having constant pytree structure without incurring in jit recompilations.
For more details, refer to the following logic:
jaxsim.api.model.step
.jaxsim.integrators.common.Integrator.step
callingjaxsim.integrators.common.Integrator.__call__
. For example, our fixed-step integrators pass thekwargs
to the system dynamics here.jaxsim.api.ode.wrap_system_dynamics_for_integration
. By default the integrator operating on this dynamics considers themodel
anddata
(mainly, the parameters stored in data that are notdata.state
) that are passed during the initialization of the integrator. This PR always overridesmodel
anddata
with those passed tojaxsim.api.model.step
.Note: furthermore, if, for any reason, the user wants to pass to the integrator a different
model
ordata
, they can do it as follows:Related to #101 and #120.
📚 Documentation preview 📚: https://jaxsim--183.org.readthedocs.build//183/