Commit 5b545b0
committed
fix(motor): make burn_time optional; honour nozzle_position for non-generic kinds
Two related fixes surfaced during jarvis form refactor.
1. MotorModel.burn_time: float → Optional[float] = None.
RocketPy's LiquidMotor / HybridMotor / SolidMotor all auto-detect
burn_time from the thrust_source array span — forcing clients to
supply it was wrong. GenericMotor still requires it; the service
now raises a 422 at the API boundary when the GENERIC path receives
None, instead of letting rocketpy error deeper in construction.
2. MotorService.from_motor_model: nozzle_position previously landed in
motor_core only for the GenericMotor branch; Liquid / Hybrid / Solid
silently ignored the user's value and took rocketpy's default of 0.
Now forwarded via motor_core for every kind (conditionally, so a
null still falls back to rocketpy's default). Removed the redundant
nozzle_position kwarg on the GenericMotor constructor call.
3. Optional-forwarding convention: motor_core only carries burn_time /
nozzle_position when the client actually supplied them, so rocketpy
picks its own default otherwise instead of receiving None for
number-typed args.
Verified against real rocketpy:
- LIQUID, burn_time=None → LiquidMotor auto-detects burn window
- LIQUID, burn_time=2.0 → LiquidMotor builds with explicit window
- LIQUID, nozzle_position=0.3 → LiquidMotor.nozzle_position == 0.3
- LIQUID, nozzle_position=None → LiquidMotor.nozzle_position == 0
- GENERIC, burn_time=None → 422 'burn_time is required for generic motors.'
All 173 unit tests pass.1 parent ff59ada commit 5b545b0
2 files changed
Lines changed: 91 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | | - | |
| 16 | + | |
14 | 17 | | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
19 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
25 | 87 | | |
26 | 88 | | |
27 | 89 | | |
| |||
45 | 107 | | |
46 | 108 | | |
47 | 109 | | |
48 | | - | |
49 | 110 | | |
50 | 111 | | |
51 | 112 | | |
| |||
54 | 115 | | |
55 | 116 | | |
56 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
57 | 125 | | |
58 | 126 | | |
59 | 127 | | |
| |||
103 | 171 | | |
104 | 172 | | |
105 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
106 | 186 | | |
107 | 187 | | |
108 | 188 | | |
109 | 189 | | |
110 | 190 | | |
111 | 191 | | |
112 | | - | |
113 | 192 | | |
114 | 193 | | |
115 | 194 | | |
116 | 195 | | |
117 | 196 | | |
118 | 197 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 198 | + | |
122 | 199 | | |
123 | | - | |
124 | | - | |
| 200 | + | |
| 201 | + | |
125 | 202 | | |
126 | 203 | | |
127 | 204 | | |
| |||
0 commit comments