Adding a component extractor
The serializer builds parameters.json in ork_extractor.ork_extractor() by calling one
search_* function per rocket concern from rocketserializer/components/. To add or extend
a component, follow the existing pattern exactly.
Anatomy of a component module
Each components/<thing>.py:
- Starts with
import loggingandlogger = logging.getLogger(__name__). - Exposes
search_<thing>(bs, ...)returning a dict or list of dicts (never prints; logs instead). - Uses NumPy-style docstrings (Parameters / Returns).
- Reads scalars from the BeautifulSoup tree
bs; reads geometry/positions from theelementsmap produced byopen_rocket_wrangler.process_elements_position(which needs the Javaorkdocument). Seenose_cone.pyandfins.pyfor theelementspattern.
Wiring it into the pipeline
In ork_extractor.py:
- Import your function at the top with the other
from .components.<x> import ...lines. - Call it through the local
_safe_search(func, default_ret, *args)wrapper so a failure logs and returns the default instead of aborting the whole extraction. Choose a sensible default ({},[], or a minimal dict) matching the shape callers expect. - Assign the result into
settings["<key>"]. The top-level keys are a contract withnb_builder.pyand the acceptance golden files — don't rename existing keys casually.
Current keys: id, environment, rocket, nosecones, trapezoidal_fins,
elliptical_fins, tails, parachutes, rail_buttons, motors, flight,
stored_results (plus rocket.drag_curve and motors.thrust_source which point to CSVs
written into the output folder).
If the notebook must use the new value
Add/adjust the matching build_* method in nb_builder.NotebookBuilder so the value flows
into the generated RocketPy notebook. The builder reads only from parameters.json.
Validate the change
make format && make lint- Run the pipeline on an example that exercises the component:
ork2json --filepath "examples/EPFL--BellaLui--2020/rocket.ork" --verboseand inspect the resultingparameters.json. pytest tests/acceptance/test_ork_extractor.py -v. Acceptance tests compare against committedexamples/<name>/parameters.json. If your change intentionally alters output, regenerate those golden files and review the diff carefully before committing.- Add unit coverage under
tests/unit/when practical.
Remember the input limitations
The pipeline assumes a single stage, single motor, and single nose cone, and English-only
.ork files with at least one run simulation. Don't silently break these assumptions.