Skip to content

Commit

Permalink
sets tip_chord as optional attr for Fins model; raises ValueError on …
Browse files Browse the repository at this point in the history
…unsupported fin kind
  • Loading branch information
GabrielBarberini committed Sep 15, 2024
1 parent 470eb1e commit eace9ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lib/models/aerosurfaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from enum import Enum
from typing import Optional
from pydantic import BaseModel


Expand Down Expand Up @@ -28,7 +29,7 @@ class Fins(BaseModel):
name: str
n: int
root_chord: float
tip_chord: float
tip_chord: Optional[float]
span: float
position: float
cant_angle: float
Expand Down
11 changes: 1 addition & 10 deletions lib/services/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,7 @@ def get_rocketpy_finset(fins: Fins, kind: str) -> RocketPyFins:
airfoil=fins.airfoil,
)
case _:
rocketpy_finset = RocketPyTrapezoidalFins(
n=fins.n,
name=fins.name,
tip_chord=fins.tip_chord,
root_chord=fins.root_chord,
span=fins.span,
cant_angle=fins.cant_angle,
rocket_radius=fins.radius,
airfoil=fins.airfoil,
)
raise ValueError(f"Invalid fins kind: {kind}")
rocketpy_finset.position = fins.position
return rocketpy_finset

Expand Down

0 comments on commit eace9ee

Please sign in to comment.