spacecraftPositionfunction
Where a craft is at a moment: x, y, z in kilometres from the Sun, in the J2000 ecliptic frame (the same axes as heliocentric, which is in astronomical units).
The path comes from Horizons, which is the craft's tracked path to now and its planned path after, so a moment in the future is a prediction. A moment outside the record (before about an hour after launch, or past its end) throws a RangeError.
Import it
import { spacecraftPosition } from "@johnmorrisdotca/wakusei-planets/spacecraft";
Definition
function spacecraftPosition(id: SpacecraftId, when: When): Vec3
Parameters
| Name | Type | Description |
|---|---|---|
id | "voyager1" | "voyager2" | "newhorizons" | "pioneer10" | "pioneer11" | "cassini" | "galileo" | "juno" | "parker" | "webb" | The craft. |
when | When | A |
Returns
Vec3
The position in kilometres.
Examples
import { loadSpacecraft, spacecraftPosition } from "@johnmorrisdotca/wakusei-planets/spacecraft";
await loadSpacecraft("newhorizons");
console.log(spacecraftPosition("newhorizons", new Date("2015-07-14T11:49:00Z")).map((n) => Math.round(n / 1e6)));[ 1197, -4772, 164 ]What it prints (run when this page was built)