Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7b34022
ENH: addition of bella lui based 3 dof and 6 dof comparison notebook
aZira371 Nov 27, 2025
3e4423f
ENH: addition of weathercocking model to flight.py
aZira371 Nov 27, 2025
ef1d003
ENH: added tests for weathercocking to test_flight_3dof.py
aZira371 Nov 27, 2025
194943a
DOC: updating 3 dof documentation and corresponding index.rst
aZira371 Nov 27, 2025
7cd0050
MNT: corrections to test_flight_3dof.py
aZira371 Nov 27, 2025
5ff03cd
MNT: docstring corrections to flight.py around new weathercocking imp…
aZira371 Nov 27, 2025
14d199d
BUG: correction of singularity bug during align on vectors in weather…
aZira371 Nov 27, 2025
fc4228c
MNT: updating location of 3 dof doc in users index.rst
aZira371 Nov 27, 2025
a564397
DOC: three_dof_simulation.rst update to add explanation of weather co…
aZira371 Nov 30, 2025
174efa9
MNT: changed default value of weather_coeff in flight.py and added fi…
aZira371 Nov 30, 2025
c6b8efe
MNT: shifting test_flight_dof.py to integration tests.
aZira371 Nov 30, 2025
9afa353
MNT: docsrting update in test_flight_3dof.py
aZira371 Dec 1, 2025
a179962
MNT: Update of docstring in test_flight_3dof.py
aZira371 Dec 1, 2025
dc18ed8
DOC: Update of three_dof_simulation.rst
aZira371 Dec 1, 2025
d5b9f37
Update tests/integration/simulation/test_flight_3dof.py
aZira371 Dec 1, 2025
3d1a6ed
Docstring Update tests/integration/simulation/test_flight_3dof.py
aZira371 Dec 3, 2025
b1e6212
docstring Update tests/integration/simulation/test_flight_3dof.py
aZira371 Dec 3, 2025
8b35366
docstring Update docs/user/three_dof_simulation.rst
aZira371 Dec 3, 2025
f3f3b0a
Docstring Update rocketpy/simulation/flight.py
aZira371 Dec 3, 2025
90acba7
MNT: Docstring updates to various files related to 3 dof
aZira371 Dec 3, 2025
b309d5e
MNT: unit vector edge case check in flight.py
aZira371 Dec 3, 2025
b1eb6cb
DOC: Add note about motor file paths in 3-DOF comparison section (#902)
Copilot Dec 3, 2025
70c6b5f
MNT: eliminate quaternion derivative code duplication in u_dot_genera…
Copilot Dec 3, 2025
0e104ff
Merge branch 'develop' into enh/3-dof-lateral-motion-improvement
aZira371 Dec 3, 2025
3693e5e
DOC: CHANGELOG.md update to reflect implementation of 3 dof lateral m…
aZira371 Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
BUG: correction of singularity bug during align on vectors in weather…
…cocking

- BUG: implemented a dot product check to ensure that singularity bug is avoided when rocket body and wind velocity are anti aligned to make rocket statically stable (in u_dot_generalized_3dof)

- MNT: removed redundant double assignment of e0 and w0 vectors within u_dot_generalized_3dof

- MNT: format correction to test_flight_3dof.py
  • Loading branch information
aZira371 authored and Gui-FernandesBR committed Nov 28, 2025
commit 14d199d95b66227f5c70e5936eec8a482f38a685
39 changes: 34 additions & 5 deletions rocketpy/simulation/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -1905,8 +1905,6 @@ def u_dot_generalized_3dof(self, t, u, post_processing=False):

# Dynamics
v_dot = K @ (total_force / total_mass)
e_dot = [0, 0, 0, 0] # Euler derivatives unused in 3DOF
w_dot = [0, 0, 0] # No angular dynamics in 3DOF
r_dot = [vx, vy, vz]
# Weathercocking: evolve body axis direction toward relative wind
# The body z-axis (attitude vector) should align with -freestream_velocity
Expand Down Expand Up @@ -1964,9 +1962,40 @@ def u_dot_generalized_3dof(self, t, u, post_processing=False):
e_dot = [e0_dot, e1_dot, e2_dot, e3_dot]
w_dot = [0, 0, 0] # No angular acceleration in 3DOF model
else:
# Already aligned or anti-aligned
e_dot = [0, 0, 0, 0]
w_dot = [0, 0, 0]
# Check if aligned or anti-aligned using dot product
dot = body_z_inertial @ desired_direction # Vector dot product
if dot > 0.999: # Aligned
e_dot = [0, 0, 0, 0]
w_dot = [0, 0, 0]
elif dot < -0.999: # Anti-aligned
# Choose an arbitrary perpendicular axis
# Try [1,0,0] unless body_z_inertial is parallel to it
x_axis = Vector([1.0, 0.0, 0.0])
perp_axis = body_z_inertial ^ x_axis
if abs(perp_axis) < 1e-6:
# If parallel, use y axis
y_axis = Vector([0.0, 1.0, 0.0])
perp_axis = body_z_inertial ^ y_axis
Comment thread
aZira371 marked this conversation as resolved.
rotation_axis = perp_axis.normalized()
Comment thread
aZira371 marked this conversation as resolved.
Outdated
# 180 degree rotation: sin(angle) = 1
omega_mag = self.weathercock_coeff * 1.0
omega_inertial = rotation_axis * omega_mag
omega_body = Kt @ omega_inertial
omega1_wc, omega2_wc, omega3_wc = (
omega_body.x,
omega_body.y,
omega_body.z,
)
e0_dot = 0.5 * (-omega1_wc * e1 - omega2_wc * e2 - omega3_wc * e3)
e1_dot = 0.5 * (omega1_wc * e0 + omega3_wc * e2 - omega2_wc * e3)
e2_dot = 0.5 * (omega2_wc * e0 - omega3_wc * e1 + omega1_wc * e3)
e3_dot = 0.5 * (omega3_wc * e0 + omega2_wc * e1 - omega1_wc * e2)
e_dot = [e0_dot, e1_dot, e2_dot, e3_dot]
w_dot = [0, 0, 0]
else:
# Vectors are nearly aligned, treat as aligned
e_dot = [0, 0, 0, 0]
w_dot = [0, 0, 0]
else:
# No weathercocking or negligible freestream speed
e_dot = [0, 0, 0, 0]
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/simulation/test_flight_3dof.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,6 @@ def test_weathercock_aligned_no_evolution(example_plain_env, point_mass_rocket):
# With alignment, quaternion derivatives should be very small
e_dot = result[6:10]
e_dot_magnitude = sum(ed**2 for ed in e_dot) ** 0.5
assert e_dot_magnitude < 1e-8, "Quaternion derivatives should be very small when aligned"
assert e_dot_magnitude < 1e-8, (
"Quaternion derivatives should be very small when aligned"
)
Comment thread
aZira371 marked this conversation as resolved.