Skip to main content

Module thrustcurve

Module thrustcurve 

Source
Expand description

Motor records and thrust curves from ThrustCurve.org’s API, and the join that gives a motor in stock its curve.

ThrustCurve.org aims to hold every certified hobby motor’s published figures and the simulator files (thrust curves) people have contributed for them. Its API answers two questions: a search (Search, read by parse_search), which lists motor records, each with ThrustCurve’s own id, its motorId; and a download (Download, read by parse_download), which gives a motor’s data files, each a RASP (.eng) or RockSim (.rse) file that DataFile::read hands to hpr_motor’s readers. The fetch_ functions ask a Client for the answer, so it comes from the cache when it can, and offline from the cache only; an answer that doesn’t parse is never cached. Motor records and curves change seldom, so a copy stays fresh for TTL_S, a day. Show ATTRIBUTION (it is on every Fetched) wherever the data is shown.

join maps the motor finder’s motors (crate::motor_finder) to ThrustCurve records. The finder carries no ThrustCurve id, but spells each designation as ThrustCurve does, so a motor maps when exactly one record has its manufacturer’s full name and its designation, character for character. Anything else is a Miss, with its reason, and Join::report lists them. fetch_finder_records fetches the records the join needs: one search per maker the finder reads.

How far to trust it: a value is the answer’s, unchanged (tests/thrustcurve.rs reads every field of every committed answer back: two recorded downloads, and three stand-in searches in the API’s shape, as ThrustCurve grants no license for its records). A curve is the file a contributor uploaded, as ThrustCurve serves it, read by the same readers as a file on disk. The join is by name only: it doesn’t compare impulse or diameter, so a finder motor whose designation ThrustCurve spells differently is a miss, not a wrong match. On ThrustCurve’s answers of 2026-10-01 (recorded then, no longer committed), 282 of the finder’s 282 motors in stock mapped, each to one record.

use hpr_net::thrustcurve;

// AeroTech's J450DM curve as ThrustCurve.org served it on 2026-10-01.
let body = include_bytes!("../tests/fixtures/replay/thrustcurve-download-J450DM.json");
let answer = thrustcurve::parse_download(body)?;
let curve = answer.results[0].read()?.thrust_curve()?;
// The file's 36 points, after the curve's start at zero thrust.
assert_eq!((curve.times_s().len(), curve.end_time_s()), (37, 2.311));

Structs§

Criterion
One search criterion, as the answer echoes it.
DataFile
One data file of a motor.
Download
A request for one motor’s data files, in one format. Build it with Download::new, which checks the motor id.
DownloadAnswer
A download’s answer.
Join
The motor finder’s motors matched to ThrustCurve records, with the misses.
Mapped
A finder motor and the one ThrustCurve record with its name.
Miss
A finder motor that didn’t map, and why.
MotorRecord
One motor’s record. The API returns only the fields that have values, so all but the id, manufacturer and designation are optional. Units are the API’s: newtons, newton-seconds, seconds, millimeters and grams.
Search
A motor search. Every field set narrows it; the API joins them with “and”. Start from Search::manufacturer or Search::default() and set the fields wanted: more may be added.
SearchAnswer
A search’s answer.

Enums§

Curve
A data file read by hpr_motor.
Format
A data file’s format, as the API names it.
MissReason
Why a finder motor didn’t map.
ThrustCurveError
Why a ThrustCurve request or answer was refused.

Constants§

ATTRIBUTION
The credit for ThrustCurve.org’s data.
BASE_URL
The API’s base URL, version 1 of its JSON endpoints.
MAX_RESULTS
The most records a search asks for. ThrustCurve’s whole database held 1,156 motors on 2026-10-01; a search that matches more than it returns is refused by fetch_finder_records.
TTL_S
How long a cached answer counts as fresh, s: a day. Motor records and curves change seldom.

Functions§

fetch_download
Fetches a motor’s data files through client, as fetch_search does. An answer holding another motor’s file, or a file in another format, is refused and never cached.
fetch_finder_records
Fetches every record of the makers the motor finder reads (MANUFACTURERS), one complete search each, as fetch_search does: the records join needs. A search that matches more motors than it returns, or holds another maker’s record, is refused and never cached, so a join never runs on part of a maker’s records.
fetch_search
Runs a search through client.
join
Maps each finder motor to the one ThrustCurve record whose manufacturer (its full name) and designation equal the motor’s, character for character. A motor with no such record, or several, is a Miss. A record given twice (the same motor_id, as when two searches overlap) counts once: the first copy is kept.
parse_download
Reads a download’s answer.
parse_search
Reads a search’s answer.
source
The Source a Client caches every answer under: ThrustCurve.org, its ATTRIBUTION, and TTL_S.