Refactor dynamics parameters to use numba typed dict#168
Open
dhruvildarji wants to merge 1 commit intof1tenth:mainfrom
Open
Refactor dynamics parameters to use numba typed dict#168dhruvildarji wants to merge 1 commit intof1tenth:mainfrom
dhruvildarji wants to merge 1 commit intof1tenth:mainfrom
Conversation
Replace individual float parameters in vehicle dynamics functions with a single numba.typed.Dict parameter. This simplifies function signatures, reduces the boilerplate of unpacking 16+ parameters at every call site, and makes it easier to add new parameters in the future. Closes f1tenth#157 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
vehicle_dynamics_ks,vehicle_dynamics_st,accl_constraints,steering_constraint) with a singlenumba.typed.Dictparametercreate_numba_params()helper to convert plain Python dicts to numba typed dictsbase_classes.pyby passingself.numba_paramsinstead of unpacking 16 individualself.params[...]values per call (5 call sites in RK4 + Euler integrator)Motivation
As noted in #157, the current approach of passing 16+ individual float parameters through every dynamics function call is verbose and error-prone. Using a numba typed dict:
Test plan
DynamicsTestunit tests pass (derivatives, zero-init roll/dec/acc/rollleft)Closes #157