Skip to content

fix: FDyn outputs a zero qdd before its first derivative call - #935

Open
petercorke wants to merge 1 commit into
mainfrom
fix/fdyn-initial-qdd
Open

petercorke wants to merge 1 commit into
mainfrom
fix/fdyn-initial-qdd

Conversation

@petercorke

Copy link
Copy Markdown
Owner

FDyn held self._qdd = None until deriv() had run once, so its third output (qdd) was None on the first evaluation. bdsim records the type of each block output at compile time and checks it at run time (check=True by default), so a diagram containing FDyn failed on the first step:

AssertionError: output 2 changed signature: was NoneType, now ndarray(6,) float64

Found running the computed-torque model (computed-torque.bd) in bdsim's ICRA 2026 tutorial notebook.

Change. qdd starts as np.zeros(robot.n), which is what the other dynamics block in arm.py already does. Nothing changes once deriv() has run; the only visible difference is the first output, None before and zeros now.

Tested. New test_fdyn_qdd_before_deriv fails without the change and passes with it; tests/test_blocks.py passes (30 passed, 6 skipped). With the fix, bdsim's icra2026 notebook runs end to end, including the computed-torque cell. Not run: the rest of the RTB suite.

AI assistance: written with Claude Code (Claude Sonnet 5.5), reviewed by the maintainer. Changes a block's initial output only; no numerical results change.

🤖 Generated with Claude Code

FDyn.qdd was None until deriv() had run once. bdsim records the type of every
block output when it compiles a diagram and checks it at run time, so the
first evaluation failed with 'output 2 changed signature: was NoneType, now
ndarray'. Start from zeros, as the other dynamics block in this file does.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@petercorke petercorke self-assigned this Nov 8, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant