Skip to content

Commit 59384f2

Browse files
CopilotGui-FernandesBR
authored andcommitted
BUG: Fix hard-coded radius value for parachute added mass calculation (#889)
* Fix hard-coded radius value for parachute added mass calculation Calculate radius from cd_s using a typical hemispherical parachute drag coefficient (1.4) when radius is not explicitly provided. This fixes drift distance calculations for smaller parachutes like drogues. Formula: R = sqrt(cd_s / (Cd * π)) Closes #860 Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Address code review: improve docstrings and add explicit None defaults Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Add CHANGELOG entry for PR #889 Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Update rocket.add_parachute to use radius=None for consistency Changed the default radius from 1.5 to None in the add_parachute method to match the Parachute class behavior. This ensures consistent automatic radius calculation from cd_s across both APIs. Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Refactor Parachute class to remove hard-coded radius value and introduce drag_coefficient parameter for radius estimation Fix hard-coded radius value for parachute added mass calculation Calculate radius from cd_s using a typical hemispherical parachute drag coefficient (1.4) when radius is not explicitly provided. This fixes drift distance calculations for smaller parachutes like drogues. Formula: R = sqrt(cd_s / (Cd * π)) Closes #860 Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Add CHANGELOG entry for PR #889 Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Refactor Parachute class to remove hard-coded radius value and introduce drag_coefficient parameter for radius estimation MNT: Extract noise initialization to fix pylint too-many-statements in Parachute.__init__ Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * Refactor environment method access in controller test for clarity * fix pylint * fix comments * avoid breaking change with drag_coefficient * reafactors Parachute.__init__ method * fix tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>
1 parent 96e9533 commit 59384f2

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

tests/integration/simulation/test_flight.py

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,49 @@ def controller( # pylint: disable=unused-argument
800800
return controller
801801

802802

803-
def test_environment_methods_accessible_in_controller( # pylint: disable=too-many-statements
803+
def make_controller_test_environment_access(methods_called):
804+
def _call_env_methods(environment, altitude_asl):
805+
_ = environment.elevation
806+
methods_called["elevation"] = True
807+
_ = environment.wind_velocity_x(altitude_asl)
808+
methods_called["wind_velocity_x"] = True
809+
_ = environment.wind_velocity_y(altitude_asl)
810+
methods_called["wind_velocity_y"] = True
811+
_ = environment.speed_of_sound(altitude_asl)
812+
methods_called["speed_of_sound"] = True
813+
_ = environment.pressure(altitude_asl)
814+
methods_called["pressure"] = True
815+
_ = environment.temperature(altitude_asl)
816+
methods_called["temperature"] = True
817+
818+
def controller( # pylint: disable=unused-argument
819+
time,
820+
sampling_rate,
821+
state,
822+
state_history,
823+
observed_variables,
824+
air_brakes,
825+
sensors,
826+
environment,
827+
):
828+
"""Controller that tests access to various environment methods."""
829+
altitude_asl = state[2]
830+
831+
if time < 3.9:
832+
return None
833+
834+
try:
835+
_call_env_methods(environment, altitude_asl)
836+
air_brakes.deployment_level = 0.3
837+
except AttributeError as e:
838+
raise AssertionError(f"Environment method not accessible: {e}") from e
839+
840+
return (time, air_brakes.deployment_level)
841+
842+
return controller
843+
844+
845+
def test_environment_methods_accessible_in_controller(
804846
calisto_robust, example_plain_env
805847
):
806848
"""Test that all environment methods are accessible within the controller.

0 commit comments

Comments
 (0)