Upgrade step and reset pipelines to proper pipelines with named functions - #66
Closed
amacati wants to merge 5 commits into
Closed
Upgrade step and reset pipelines to proper pipelines with named functions#66amacati wants to merge 5 commits into
amacati wants to merge 5 commits into
Conversation
ratheron
approved these changes
Jun 15, 2026
ratheron
left a comment
Collaborator
There was a problem hiding this comment.
Looks very nice! I have two comments on the implementation
| sim = Sim(control=Control.attitude, physics=Physics.first_principles, attitude_freq=50) | ||
| # Remove clipping floor function which kills gradients | ||
| sim.step_pipeline = sim.step_pipeline[:-1] | ||
| sim.step_pipeline.remove("clip_floor_pos") |
Collaborator
There was a problem hiding this comment.
The controller has clippings as well. Maybe we should add a note that either we remove the clipping or we start at a certain height.
|
|
||
| @jax.jit | ||
| def reset(data: SimData, default_data: SimData, mask: Array | None = None) -> SimData: | ||
| data = pytree_replace(data, default_data, mask) # Does not overwrite rng_key |
Collaborator
There was a problem hiding this comment.
Maybe this should be a separate reset step, in case we want to remove it? Right now, the reset pipeline appears to be empty, even though the data is reset to the default data.
Merged
Collaborator
Author
|
Closed in favor of #68 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Named, ordered simulation pipelines
Replaces the ad-hoc tuples of functions in
sim.step_pipeline/sim.reset_pipelinewith aPipelinetype: an ordered collection of named functions. Stages are addressed by name instead of by position, so you can splice in disturbances, randomization etc at a precise point without counting indices.Stage names default to
fn.__name__and must be unique. Passname=for anonymous callables (e.g.functools.partial). Iterating a pipeline yields the functions in order.Usage
Pipelines are easier to inspect:
Inserting new functions also becomes easier with named access:
We also allow some syntactic sugar to make common operations like appending easier
Pipelines also expose
append/keys()/values()/items()and__repr__for nicer prints.Notes:
+and construction accept functions or pipelines only. Useappend/insert_*withname=for explicit names.replace/removeraise on unknown names. Duplicate names raise on insert.Closes #64