Fix NameError in Subsystem.getYawStiffness (undefined 'l')#68
Merged
shousner merged 1 commit intoJun 4, 2026
Merged
Conversation
getYawStiffness computed (tau0/l)*rad_fair**2 + tau0*rad_fair, but 'l' was never defined in the method, so every call raised 'NameError: name "l" is not defined'. The variable is a leftover from the rename of the line length to 'span' (commit 2f330c8, "Subsystem updates for span consistency") which missed this one site. Use self.span (the horizontal end-to-end distance) as intended, and add a regression test exercising the formula.
Collaborator
|
Note to self that Subsystem.getYawStiffness() is not used anywhere within MoorPy or FAD-Toolset (but LineDesign does have its own getYawStiffness method, which is not exactly the same) |
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.
Calling
Subsystem.getYawStiffness()always raisesNameError: name 'l' is not defined.The bug
lis never assigned in the method (no local, no attribute, no global), so every call fails.git blamepoints to commit2f330c8"Subsystem updates forspanconsistency" — the rename of the line length tospanmissed this one site, leaving the stalel.The fix
Use
self.span(the horizontal end-to-end distance, set in__init__), which is the length the formula intends:Dimensionally consistent:
[N]/[m]·[m²] + [N]·[m] = [N·m].Reproduction (before this PR)
Verification
tests/test_subsystem.py::test_getYawStiffness_runsasserts the call returns the documented value(tau0/span)*rad_fair**2 + tau0*rad_fair. It fails ondev(NameError) and passes with this fix.29 passed.