@@ -70,7 +70,7 @@ def flight_weathercock_zero(example_plain_env, point_mass_rocket):
7070
7171@pytest .fixture
7272def flight_3dof (example_plain_env , point_mass_rocket ):
73- """Creates a standard 3-DOF Flight fixture with default weathercock_coeff=1 .0.
73+ """Creates a standard 3-DOF Flight fixture with default weathercock_coeff=0 .0.
7474
7575 Returns
7676 -------
@@ -85,6 +85,24 @@ def flight_3dof(example_plain_env, point_mass_rocket):
8585 )
8686
8787
88+ @pytest .fixture
89+ def flight_weathercock_pos (example_plain_env , point_mass_rocket ):
90+ """Creates a Flight fixture with weathercock_coeff set to 1.0.
91+
92+ Returns
93+ -------
94+ rocketpy.simulation.flight.Flight
95+ A Flight object configured for 3-DOF with weathercocking enabled.
96+ """
97+ return Flight (
98+ rocket = point_mass_rocket ,
99+ environment = example_plain_env ,
100+ rail_length = 1 ,
101+ simulation_mode = "3 DOF" ,
102+ weathercock_coeff = 1.0 ,
103+ )
104+
105+
88106def test_simulation_mode_sets_3dof_with_point_mass_rocket (flight_3dof ):
89107 """Tests that simulation mode is correctly set to 3 DOF for PointMassRocket.
90108
@@ -180,7 +198,7 @@ def test_weathercock_coeff_stored(example_plain_env, point_mass_rocket):
180198
181199
182200def test_weathercock_coeff_default (flight_3dof ):
183- """Tests that the default weathercock_coeff is 1.0 .
201+ """Tests that the default weathercock_coeff is 0.0 (no weathercocking) .
184202
185203 Parameters
186204 ----------
@@ -189,7 +207,7 @@ def test_weathercock_coeff_default(flight_3dof):
189207 point_mass_rocket : rocketpy.PointMassRocket
190208 A point mass rocket fixture for 3-DOF simulation.
191209 """
192- assert flight_3dof .weathercock_coeff == 1 .0
210+ assert flight_3dof .weathercock_coeff == 0 .0
193211
194212
195213def test_weathercock_zero_gives_fixed_attitude (flight_weathercock_zero ):
@@ -201,7 +219,7 @@ def test_weathercock_zero_gives_fixed_attitude(flight_weathercock_zero):
201219 ----------
202220 example_plain_env : rocketpy.Environment
203221 A basic environment fixture for flight simulation.
204- point_mass_rocket : rocketpy.PointMassRocket
222+ point_mass_rocket : rocketpy.PointMassMotor
205223 A point mass rocket fixture for 3-DOF simulation.
206224 """
207225 flight = flight_weathercock_zero
@@ -215,7 +233,7 @@ def test_weathercock_zero_gives_fixed_attitude(flight_weathercock_zero):
215233 assert all (abs (ed ) < 1e-10 for ed in e_dot ), "Quaternion derivatives should be zero"
216234
217235
218- def test_weathercock_nonzero_evolves_attitude (flight_3dof ):
236+ def test_weathercock_nonzero_evolves_attitude (flight_weathercock_pos ):
219237 """Tests that non-zero weathercock_coeff causes attitude evolution.
220238 When the body axis is misaligned with the relative wind and weathercock_coeff
221239 is positive, the quaternion derivatives should be non-zero.
@@ -227,7 +245,7 @@ def test_weathercock_nonzero_evolves_attitude(flight_3dof):
227245 point_mass_rocket : rocketpy.PointMassRocket
228246 A point mass rocket fixture for 3-DOF simulation.
229247 """
230- flight = flight_3dof
248+ flight = flight_weathercock_pos
231249 # Create a state with misaligned body axis
232250 # Body pointing straight up (e0=1, e1=e2=e3=0) but velocity is horizontal
233251 # [x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
@@ -240,7 +258,7 @@ def test_weathercock_nonzero_evolves_attitude(flight_3dof):
240258 assert e_dot_magnitude > 1e-6 , "Quaternion derivatives should be non-zero"
241259
242260
243- def test_weathercock_aligned_no_evolution (flight_3dof ):
261+ def test_weathercock_aligned_no_evolution (flight_weathercock_pos ):
244262 """Tests that when body axis is aligned with relative wind, no rotation occurs.
245263 When the rocket's body z-axis is already aligned with the negative of the
246264 freestream velocity, the quaternion derivatives should be approximately zero.
@@ -252,7 +270,7 @@ def test_weathercock_aligned_no_evolution(flight_3dof):
252270 point_mass_rocket : rocketpy.PointMassRocket
253271 A point mass rocket fixture for 3-DOF simulation.
254272 """
255- flight = flight_3dof
273+ flight = flight_weathercock_pos
256274 # Body pointing in +x direction (into the wind for vx=50)
257275 # Quaternion for 90 degree rotation about y-axis uses half-angle:
258276 # e0=cos(90°/2)=cos(45°), e2=sin(90°/2)=sin(45°)
@@ -269,14 +287,14 @@ def test_weathercock_aligned_no_evolution(flight_3dof):
269287 )
270288
271289
272- def test_weathercock_anti_aligned_uses_perp_axis_and_evolves (flight_3dof ):
290+ def test_weathercock_anti_aligned_uses_perp_axis_and_evolves (flight_weathercock_pos ):
273291 """Tests the anti-aligned case where body z-axis is opposite freestream.
274292
275293 This should exercise the branch that selects a perpendicular axis (y-axis)
276294 when the cross with x-axis is nearly zero, producing a non-zero quaternion
277295 derivative.
278296 """
279- flight = flight_3dof
297+ flight = flight_weathercock_pos
280298
281299 sqrt2_2 = np .sqrt (2 ) / 2
282300 # Build quaternion that makes body z-axis = [-1, 0, 0]
0 commit comments