Skip to content

Commit f95dbc9

Browse files
CopilotaZira371
andauthored
STY clarify FlightBody proxy assumptions and notebook realism notes
Agent-Logs-Url: https://github.com/aZira371/RocketPy/sessions/dd7a22c8-7e00-4af1-8f3f-0320d902b368 Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
1 parent a225073 commit f95dbc9

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

docs/multistage_example.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@
428428
},
429429
"outputs": [],
430430
"source": [
431+
"# Keep stage-1 short so stage-2 starts near burnout/separation, not at apogee.\n",
431432
"mission.set_flight_inputs(\n",
432433
" \"first_stage\",\n",
433434
" inclination=85,\n",
@@ -498,7 +499,8 @@
498499
"source": [
499500
"## 8) Execute the full mission (including payload)\n",
500501
"\n",
501-
"The same mission object configured above is executed directly by `MissionExecutor`. This run includes both powered stages and the deployable payload `FlightBody`, preserving mission continuity.\n"
502+
"The same mission object configured above is executed directly by `MissionExecutor`.\n",
503+
"This run includes both powered stages and the deployable payload `FlightBody`, preserving mission continuity.\n"
502504
]
503505
},
504506
{

rocketpy/mission/mission_executor.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,34 @@ def _extract_rocket(body: Any):
102102

103103
@staticmethod
104104
def _build_point_mass_from_flight_body(body: FlightBody) -> PointMassRocket:
105-
"""Build a PointMassRocket proxy from a FlightBody mission item."""
105+
"""Build a PointMassRocket proxy from a FlightBody mission item.
106+
107+
Notes
108+
-----
109+
This proxy uses the `FlightBody` snapshot at ``t=0`` for dry mass and
110+
center of mass. The goal is to provide an immediate Flight-compatible
111+
representation for mission execution of deployables, especially passive
112+
payloads and recovery-only bodies.
113+
"""
106114
radius = MissionExecutor._extract_reference_radius(body.geometry)
115+
# Use t=0 as a stable initialization snapshot for point-mass proxy setup.
107116
mass = body.mass(0.0)
108117
center_of_mass = body.center_of_mass(0.0)
118+
# Conservative default Cd for a generic bluff-body payload proxy.
119+
# These can be superseded by parachute/recovery deployment dynamics.
120+
default_drag_coefficient = 0.75
109121
rocket = PointMassRocket(
110122
radius=radius,
111123
mass=mass,
112124
center_of_mass_without_motor=center_of_mass,
113-
power_off_drag=0.75,
114-
power_on_drag=0.75,
125+
power_off_drag=default_drag_coefficient,
126+
power_on_drag=default_drag_coefficient,
115127
)
116128
rocket.name = body.name
117129

118130
orientation = body.coordinate_system_orientation()
131+
# PointMassRocket currently has no public API to re-evaluate `_csys`
132+
# after initialization, so we synchronize both orientation fields here.
119133
rocket.coordinate_system_orientation = orientation
120134
rocket._csys = 1 if orientation == "tail_to_nose" else -1
121135

tests/unit/mission/test_mission.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ def center_of_mass(self, t):
103103
return 0.0
104104

105105

106+
class UnsupportedBody:
107+
"""Intentional unsupported mission body type for executor error-path tests."""
108+
109+
106110
def _make_rocket_adapter(name="rocket_body"):
107111
"""Create a RocketAdapter with a minimal fake rocket object."""
108112
return RocketAdapter(FakeRocket(name=name))
@@ -556,7 +560,7 @@ def test_execute_runs_stage_and_deployable(self):
556560
def test_execute_raises_for_non_rocket_body(self):
557561
"""execute raises TypeError when body is not RocketAdapter-backed."""
558562
mission = Mission()
559-
mission.add_stage(_make_stage(name="stage_1", body=object()))
563+
mission.add_stage(_make_stage(name="stage_1", body=UnsupportedBody()))
560564

561565
executor = MissionExecutor(
562566
mission=mission,

0 commit comments

Comments
 (0)