Read Live Telemetry
You have met /sim. Now let’s ask a vessel how it is doing. Early on, individual files are lovely:
they say exactly what they contain. A program that makes decisions needs the whole picture from one
instant, though. That is what telemetry is for.
First, read the obvious files
Section titled “First, read the obvious files”cat /sim/vessels/active/mass/totalcat /sim/vessels/active/altitude/radarcat /sim/vessels/active/orbit/apoapsiscurl http://127.0.0.1:4242/v1/fs/vessels/active/mass/totalcurl http://127.0.0.1:4242/v1/fs/vessels/active/altitude/radarcurl http://127.0.0.1:4242/v1/fs/vessels/active/orbit/apoapsisValues are SI: mass is kilograms and altitude is metres. Apoapsis and periapsis are also altitudes above the mean surface, not distances from the planet’s centre.
Take one coherent picture
Section titled “Take one coherent picture”vessels/active/telemetry is one JSON document sampled together. Its seq and ut identify the
snapshot. Use it in a loop so position, velocity, mass, and orbit cannot come from slightly different
moments.
cat /sim/vessels/active/telemetry | jq '{id, sit, parent, controllable, mass, alt, orbit, ut, seq}'curl http://127.0.0.1:4242/v1/vessels/active/telemetry | jq '{id, sit, parent, controllable, mass, alt, orbit, ut, seq}'controllable is the important little flag. 1 means KSA can accept vessel commands. When it is
0, do not start a burn just because the numbers looked exciting.
Next, make your first write: Throttle and ignite.