Skip to content

fix(blocks): correct multirotor initial states and body-frame loads - #971

Open
Afloat16 wants to merge 5 commits into
petercorke:mainfrom
Afloat16:fix/multirotor-initial-heading
Open

Afloat16 wants to merge 5 commits into
petercorke:mainfrom
Afloat16:fix/multirotor-initial-heading

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Batch the related MultiRotor fixes from #971, #972 and #973 in response to the request to consolidate fixes within the same module. The original commits remain parents of the integration commit, and all component regressions are retained.

A four-value initial state currently turns requested yaw into roll; inflow combines world-frame translation with body-frame rotation; and load arrays assume four rotors even when the configured model has more. These defects change simulated accelerations or raise IndexError for supported rotor counts.

Changes and numerical behavior

  • Expand [x, y, z, yaw] into the existing yaw/pitch/roll state order in the constructor and parameter update path. Six-value poses and twelve-value states retain their existing layout.
  • Transform translational velocity into body coordinates once before computing rotor inflow. Retain world-frame translational velocity for the position derivative.
  • Allocate thrust, drag-torque and thrust-moment arrays for self.nrotors, matching the existing geometry, input validation and rotor loop.

Public numerical behavior changes for short-state initialization and moving, rotated multirotors. Six- and eight-rotor models can evaluate their dynamics without the previous four-column indexing error. The existing force and moment equations are retained.

Validation

Revalidated after merging upstream main at bceb42c18877840280037539dac036f21d4fefe5 in commit fae5e497aa400b239645aae1c952cf3e974546c7. The contribution source and regression files are unchanged by this update.

PYTHONPATH=src python -m pytest \
  tests/test_multirotor_initial_heading.py \
  tests/test_multirotor_inflow_frame.py tests/test_multirotor_rotor_count.py \
  tests/test_blocks.py::MultirotorBlockTest \
  --timeout=50 --timeout_method=thread -q

Result: 69 targeted tests passed, 2 existing graphics tests skipped. Coverage includes hover initialization, heading-rotation invariance and larger rotor configurations.

An earlier wider run of tests/test_blocks.py timed out after 50 seconds in the existing arm test RobotBlockTest::test_fdyn_runs_twice while using the Python dynamics fallback. The full blocks module is not claimed as passing, and that arm test was not changed.

Validation used Linux, Python 3.12.14, NumPy 2.5.5, SciPy 1.18.1 and Matplotlib 3.11.2, with the source tree on PYTHONPATH=src. The Python kinematics/dynamics fallbacks were used. The compiled extension, other operating systems and the complete repository/platform matrix were not run locally.

python -m mypy passed for all 166 source files using upstream main's Python 3.11 target. git diff --check passed. The regression files are unchanged from the integration revision, where Ruff lint and format checks passed.

Contribution

Primary contributor: @Afloat16.

Prepared with ChatGPT (GPT-6 Astra Pro) assistance.

Afloat16 and others added 3 commits November 18, 2026 18:37
Put the fourth initial-state value in the yaw coordinate so a requested heading does not tilt the rotor thrust. Cover constructor and parameter paths with physical hover checks and real bdsim diagrams.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
Rotate world translational velocity into body axes before combining it with rotor hub velocity. Verify world-yaw covariance and closed-form thrust and pitching moments.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
Allocate thrust, drag and moment arrays from the configured rotor count. Validate balanced flight and individual rotor moments for two, four, six and eight rotors.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
@codacy-production

codacy-production Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 13 complexity · 0 duplication

Metric Results
Complexity 13
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.

Combine the related fixes from PRs petercorke#971, petercorke#972 and petercorke#973 for one MultiRotor review. Preserve each original commit as a parent and all component regressions.

Retain yaw in four-value initial states, express rotor inflow in body coordinates, and size thrust and torque arrays for the configured rotor count.

Validation: 69 targeted tests passed and 2 existing graphics tests were skipped; mypy passed for all 166 source files. Regression-test Ruff lint/format and git diff --check passed. The wider blocks run timed out in the existing arm FDyn repeat-run test under the Python dynamics fallback; it is not claimed as passing. Compiled/platform CI was not run locally.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
@Afloat16 Afloat16 changed the title fix(blocks): preserve yaw in short multirotor initial states fix(blocks): correct multirotor initial states and body-frame loads Nov 19, 2026
Integrate upstream main bceb42c without changing the contribution files.
Revalidate the related regression suites and mypy against Python 3.11
configuration while retaining the existing commit history.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>

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