You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Incorrect vector rotation in GenericSurface.compute_forces_and_moments #932
Incorrect vector rotation in GenericSurface.compute_forces_and_moments().
Here, we want to represent the black L, D, Q vectors in the blue body frame.
The M_BA matrix should be direction cosine matrix (DCM), however it is given in vector rotation matrices. Vector rotation matrices rotate the vector without changing/rotating reference frame.
Current implementation rotates the force vectors to match body axis, but results are however presented in aero frame.
If it is intended to use rotation matrix instead of DCM, the rotation should be:
Start with the Q, L, D vectors matching +X, -Y, -Z in body frame (i.e. Vector([side, -lift, -drag]) )
Rotate the vector by -alpha on X axis and beta on Y axis.
The results will match the black Q, L, D vectors and presented in body frame
Another POV:
Only focus on blue Zb axis and body frame.
Rotate the Zb axis by -alpha on X axis and beta on Y axis.
the result will match the black V vector
To Reproduce & Expected behavior & Screenshots
If applicable, add screenshots to help explain your problem.
I reduced this to three unit force vectors at alpha = 0.2 rad and beta = 0.1 rad. Current develop is cb6106a717207dd8fc2dfe1446d80ff75022f21b.
For the aerodynamic vector [Q, -L, -D], the current code applies the positive-alpha/negative-beta rotation. Applying the direction-cosine mapping Rx(-alpha) @ Ry(+beta) gives:
Unit coefficient
Current body result
DCM body result
side (Q=1)
[0.995004165, -0.019833838, 0.097843395]
[0.995004165, -0.019833838, -0.097843395]
lift (L=1)
[0, -0.980066578, -0.198669331]
[0, -0.980066578, 0.198669331]
drag (D=1)
[0.099833417, 0.197676812, -0.975170327]
[-0.099833417, -0.197676812, -0.975170327]
Draft PR #1064, head 84d3b6a9f0b4a8074d764130dc3d189bdc402036, produces the DCM column for all three cases through its wind-to-body coefficient conversion. That makes it an implementation candidate for this issue, although #1064 contains a much broader aerodynamic refactor.
Would you prefer to keep this fix and its three basis-vector regression cases in #1064, or split the rotation correction into a smaller PR against develop? I have not opened a duplicate while #932 is assigned and #1064 is active.
Activity
ting-hong-shieh commentedon Aug 14, 2026
I reduced this to three unit force vectors at
alpha = 0.2 radandbeta = 0.1 rad. Currentdevelopiscb6106a717207dd8fc2dfe1446d80ff75022f21b.For the aerodynamic vector
[Q, -L, -D], the current code applies the positive-alpha/negative-beta rotation. Applying the direction-cosine mappingRx(-alpha) @ Ry(+beta)gives:Q=1)[0.995004165, -0.019833838, 0.097843395][0.995004165, -0.019833838, -0.097843395]L=1)[0, -0.980066578, -0.198669331][0, -0.980066578, 0.198669331]D=1)[0.099833417, 0.197676812, -0.975170327][-0.099833417, -0.197676812, -0.975170327]Draft PR #1064, head
84d3b6a9f0b4a8074d764130dc3d189bdc402036, produces the DCM column for all three cases through its wind-to-body coefficient conversion. That makes it an implementation candidate for this issue, although #1064 contains a much broader aerodynamic refactor.Would you prefer to keep this fix and its three basis-vector regression cases in #1064, or split the rotation correction into a smaller PR against
develop? I have not opened a duplicate while #932 is assigned and #1064 is active.Environment: Python 3.12.6; NumPy 2.5.2; macOS 26.5.2 arm64.
Gui-FernandesBR commentedon Aug 14, 2026
@ting-hong-shieh let's wait until #1064 is merged please
stephanLouw commentedon Sep 17, 2026
@ting-hong-shieh Does this bug mean that using Generic surface in the current PyPi version (1.13.0), will lead to a wrong flight prediction?