

Flight computer
Thrust vector control rocket via differentiable simulation and reinforcement learning.
- Size
- 64 × 64 mm
- Copper layers
- 4
- Thickness
- 1.6 mm
- Parts
- 96
- Nets
- 93
- Pads
- 309
- Tracks, vias
- 730, 141
- Pours
- 9
- Routed
- Yes
- KiCad
- KiCad 10.0 (file 20260206)
- Created
- 7 Jun 2026
- Updated
- 18 Aug 2026
Overview
Flight computer is an open-source printed circuit board by daniel360kim, from the daniel360kim/ember repository on GitHub. It is a 4-layer board of 64 × 64 mm with 96 parts on 93 nets, routed with 730 tracks and 141 vias.
It is built around the TEENSY 4.1, NRF24L01 and BMP388, with the TPS563201DDCR, TPS73633DRBR and BAT54 among its other parts. Its parts include 37 resistors, 23 capacitors, 8 diodes, 8 connectors and 7 transistors. It belongs with the NXP (LPC, Kinetis, i.MX RT) boards of this library.
Main components
9TEENSY 4.1
Development Boards & Kits - ARM ModuleSparkFun ElectronicsUncategorisedNRF24L01
QFN-20-EP(4x4)-40℃~+85℃ -85dBm 0dBm 1.9V~3.6V 2.4GHz 2Mbps CRC check function、Automatic response function、Automatic retransmission function SPI QFN-20-EP(4x4) RF Transceiver ICs ROHSNordic SemiconRF Transceiver ICsBMP388
LGA-10(2x2)-40℃~+85℃ 1.65V~3.6V 1pa/K 2uA 30Kpa~1.25bar 50pa 8pa I2C、SPI LGA-10(2x2) Pressure Sensors ROHSBosch SensortecPressure SensorsTPS563201DDCR
SOT-23-THIN-6-40℃~+125℃@(TJ) 1 3A 4.5V~17V 580kHz 768mV~7V Adjustable Buck Buck Built-in Yes SOT-23-THIN-6 DC-DC Converters ROHSTexas InstrumentsDC-DC ConvertersTPS73633DRBR
VSON-8-EP(3x3)-40℃~+125℃@(Tj) 1 200mV@(400mA) 3.3V 30uVrms 5.5V 500mA 550uA 58dB@(100Hz) Fixed Over Current Protection、Over Temperature Protection、Over Voltage Protection、Enable Positive VSON-8-EP(3x3) Voltage Regulators - Linear, Low Drop Out (LDO) Regulators ROHSTexas InstrumentsVoltage Regulators - Linear, Low Drop Out (LDO) RegulatorsBAT54
SOT-23200mA 2uA@25V 30V 800mV@100mA Independent SOT-23 Schottky Diodes ROHSFOSANSchottky DiodesAO3401A
SOT-231 P-Channel 14nC@10V 30V 47mΩ@10V、60mΩ@4.5V、85mΩ@2.5V 4A 55pF 645pF 80pF 900mV SOT-23 MOSFETs ROHSAlpha & Omega SemiconductorMOSFETsAO3400A
SOT-23-55℃~+150℃ 1 N-channel 1.45V 1.4W 30V 48mΩ@2.5V 5.7A 50pF 630pF 75pF 7nC@10V N-Channel SOT-23 MOSFETs ROHSAlpha & Omega SemiconductorMOSFETsBZT52C5V1
SOD-1231 Independent 130Ω 2uA 4.85V~5.36V 5.1V 500mW SOD-123 Zener Diodes ROHSMDDZener Diodes
README
README.mdEmber
A differentiable 6-DOF rocket simulator that trains a neural flight controller by backpropagating through physics.
Ember is an end-to-end platform for developing thrust-vector-controlled (TVC) model rockets: a fully differentiable PyTorch flight dynamics engine, a neural attitude-control policy trained directly through the simulated physics, and a custom flight computer to fly the learned controller on real hardware.
The core idea is differentiable simulation (a.k.a. "diffsim"). Instead of treating the physics engine as an opaque, non-differentiable black box and learning a controller with reinforcement learning, Ember implements the entire 6-DOF rigid-body simulation in PyTorch so that gradients flow through every integration step, every aerodynamic force, and every actuator model. The attitude error at the end of a flight can be differentiated all the way back to the neural network's weights, letting the controller be optimized with plain gradient descent — the same way you would train any other neural network.
Project status
Ember is an active work in progress. The current state:
Working today
- Complete, batched, GPU-ready 6-DOF differentiable physics (motor, TVC gimbal, aerodynamics, time-varying mass), integrated with RK4 and quaternion attitude kinematics.
- Batched rollout stack (
RocketEnv+EpisodeManager) with flight-phase termination (burnout, ground impact, excessive tilt). - A neural MLP attitude controller trained end-to-end through the physics via autograd, plus a PID baseline.
- Declarative YAML vehicle configuration.
- An extensive test suite (~40+ tests) including explicit gradient-flow verification.
- A custom Teensy-based flight computer designed in KiCad (
hardware/).
On the roadmap
- Fully config-driven training/eval runners (task and hyperparameter YAML layers).
- Domain randomization over motor thrust, mass, servo lag, and drag for robust sim-to-real transfer.
- Trajectory-length masking of the loss past episode termination.
- Experiment logging, checkpointing, and a dedicated evaluation runner.
- Export of the trained policy to run in real time on the flight computer, closing the sim-to-hardware loop.
Why differentiable simulation?
Learning a controller for an unstable, fast, safety-critical system like a TVC rocket is hard. The two conventional options each have a major drawback:
- Reinforcement learning (RL) treats the simulator as a black box and estimates gradients from scalar rewards. This works, but it is notoriously sample-inefficient — it throws away all the structure of the physics and needs enormous numbers of rollouts to converge.
- Classical control (PID, LQR) is sample-free but requires hand-tuning and a linearized model, and it struggles with the strongly time-varying, nonlinear dynamics of a rocket whose mass, center of gravity, and inertia change every millisecond as propellant burns.
Differentiable simulation gets the best of both. Because the physics engine is written in an autodiff framework, the analytic gradient of the flight outcome with respect to the controller parameters is available for free. Training becomes a direct optimization problem:
"Given this rocket, what network weights minimize the attitude error over the boost phase?"
This is dramatically more sample-efficient than RL and far more flexible than classical control, because the exact gradient — not a noisy estimate — points the optimizer in the right direction on every single rollout.
┌─────────────────────────────────────────────┐
setpoint (upright) ─────►│ Neural Policy (MLP) │
│ attitude error + body rates → gimbal command│
└───────────────────┬─────────────────────────┘
│ U (2-axis TVC torque cmd)
▼
┌───────────────────────────────────────────────────────────────┐
│ Differentiable 6-DOF Physics (PyTorch) │
│ motor thrust · TVC gimbal · aerodynamics · time-varying mass │
│ RK4 integration · quaternion attitude kinematics │
└───────────────────────────┬───────────────────────────────────┘
│ trajectory X(t) (fully differentiable)
▼
┌────────────────────┐
│ Attitude-error │
│ loss │
└─────────┬──────────┘
│
◄────────────────────────────────┘
loss.backward(): gradient flows through the ENTIRE rollout,
through every RK4 step and physics term, back to the MLP weights.How the differentiable simulation works
Everything in the physics path is a torch.Tensor operation, so the whole rollout is a single differentiable computation graph. A few deliberate engineering choices keep that graph intact and its gradients well-behaved:
- Autograd through the integrator. The RK4 step chains four evaluations of the vehicle dynamics per timestep, and every one is differentiable — the full trajectory is one continuous graph from initial condition to final state.
def rk4_step(...):
k1 = dynamics_fn(X, U, t)
k2 = dynamics_fn(X + dt / 2 * k1, U, t + dt / 2)
k3 = dynamics_fn(X + dt / 2 * k2, U, t + dt / 2)
k4 = dynamics_fn(X + dt * k3, U, t + dt)
X_new = X + (dt / 6) * (k1 + 2 * k2 + 2 * k3 + k4)-
Out-of-place quaternion normalization. After each step the attitude quaternion is renormalized by constructing a new tensor rather than mutating in place, so backpropagation through the projection is safe (in-place writes are a classic way to silently break an autograd graph).
-
Branch-free physics. Discontinuous logic — like the piecewise F15 thrust curve — is written with
torch.whereinstead of Pythonifstatements, so gradients propagate across every phase of the burn. -
Gradient-safe numerics. Operations that can produce infinite gradients (e.g.
arccosat±1when computing angle of attack) clamp their inputs away from the singularity, keeping training stable.
Because the physics is written this way, loss.backward() on the training loss populates gradients on the neural network's parameters through thousands of chained physics operations, and a standard Adam optimizer step improves the controller. There is no reward function, no value network, and no policy-gradient estimator — just supervised optimization of a trajectory-level loss.
for i in range(N_EPOCHS):
initial_state = torch.zeros(BATCH_DIM, S.DIM)
initial_state[..., S.ORI] = start_orientation
history = episode_runner.run(
initial_state=initial_state,
setpoint=setpoint,
policy=policy,
vehicle=self.vehicle,
)
loss = self.calculate_loss(history.to_episode_result(), setpoint=setpoint)
print(f"Epoch {i + 1}/{N_EPOCHS} — loss: {loss.item():.6f}")
optimizer.zero_grad()
loss.backward()
optimizer.step()The physics model
Ember simulates a full six-degree-of-freedom rigid body with a compact, batched 15-dimensional state vector (simulation/src/vehicle/state.py):
| State | Indices | Description |
|---|---|---|
| Position | 0:3 | World-frame position (Z up) |
| Orientation | 3:7 | Attitude quaternion, scalar-last [x, y, z, w] |
| Velocity | 7:10 | World-frame linear velocity |
| Angular velocity | 10:13 | Body-frame angular rates |
| Gimbal angle | 13:15 | 2-axis TVC deflections (δx, δy) |
Each timestep, the vehicle sums the physical forces and torques and integrates the rigid-body equations of motion. The physics is decomposed into independently-testable, composable components:
- Motor — a piecewise-polynomial F15 thrust curve with analytic total impulse and a time-varying propellant mass / moment-of-inertia model (inside-out burn).
- Cartesian TVC gimbal — a 2-axis thrust-vectoring actuator that tilts the thrust vector, with a first-order servo lag between commanded and actual deflection.
- Aerodynamics — quadratic drag, Barrowman-style normal force, and a pitch-damping moment.
- Mass properties — combines the dry airframe and burning motor, shifting the center of gravity and inertia tensor (via the parallel-axis theorem) as propellant is consumed.
- Rigid-body core — Newton–Euler dynamics including the gyroscopic term
ω × (Iω), integrated with swappable explicit-Euler or RK4 schemes.
The entire vehicle is specified declaratively in YAML (simulation/configs/vehicles/atlas.yaml) — mass, motor, geometry, aero coefficients, and gimbal limits — so a rocket is fully described by data rather than code.
The neural controller
The policy is a small multilayer perceptron (simulation/src/policy/mlp.py) — deliberately kept tiny so it can eventually be exported and run in real time on a microcontroller. It observes the shortest-path body-frame attitude error (the x/y components of the error quaternion) together with the body angular rates, and outputs a 2-axis gimbal torque command squashed through tanh to respect the actuator's physical limits.
def forward(self, X, setpoint):
q = normalize_quat(X[..., S.ORI])
w_b = X[..., S.ANG_VEL]
setpoint = normalize_quat(setpoint.expand(*q.shape[:-1], 4))
q_error = quat_mul(quat_inv(q), setpoint)
q_error = q_error * torch.where(q_error[..., 3:4] < 0, -1., 1.)
error = q_error[..., :2]
input = torch.cat([error, X[..., S.ANG_VEL]], dim=-1)
output = self.network(input)
return self.max_output * torch.tanh(output)A conventional PID controller (simulation/src/policy/pid.py) is included as a baseline for comparison against the learned policy.
Quick start
Requires Python 3.10+.
git clone https://github.com/daniel360kim/ember.git
cd ember/simulation
pip install -e .This installs torch, numpy, matplotlib, and pyyaml, and puts src/ on the import path so from vehicle.atlas_v1 import Atlas-style imports resolve.
Train the neural controller through the physics
cd ember/simulation
PYTHONPATH=src python src/runners/train_runner.pyThis builds the Atlas vehicle, rolls it out under the MLP policy from a slightly tilted initial attitude, computes the attitude-error loss over the boost, and backpropagates through the entire flight to update the network — for 100 epochs. It plots the orientation and gimbal histories at the first, middle, and last epoch so you can watch the controller learn to stabilize the rocket.
Run the test suite
The physics engine is covered by an extensive suite of unit and integration tests, including explicit checks that gradients flow correctly through the integrators, the rigid-body core, and the full vehicle dynamics.
cd ember/simulation
pytest # everything
pytest tests/vehicle/ # physics component & dynamics tests
pytest tests/runners/ # environment & rollout integration testsRepository layout
ember/
├── simulation/ # Differentiable PyTorch simulator (main project)
│ ├── src/
│ │ ├── vehicle/ # 6-DOF physics
│ │ │ ├── atlas_v1.py # Concrete rocket: assembles the full dynamics
│ │ │ ├── base_vehicle.py # Vehicle interface + quaternion projection
│ │ │ ├── rigid_body.py # Newton–Euler derivative core
│ │ │ ├── mass_properties.py # Time-varying mass / CG / inertia
│ │ │ ├── integrators.py # euler_step, rk4_step (differentiable)
│ │ │ ├── state.py # 15-D state-vector layout
│ │ │ └── components/ # motor, cartesian_gimbal (TVC), aero
│ │ ├── policy/
│ │ │ ├── mlp.py # Neural attitude controller
│ │ │ └── pid.py # Classical baseline
│ │ ├── runners/
│ │ │ ├── rocket_env.py # Batched, Gym-like physics environment
│ │ │ ├── episode_manager.py # Policy-in-the-loop rollout engine
│ │ │ └── train_runner.py # Differentiable training entry point
│ │ └── utils/math.py # Quaternion algebra & kinematics
│ ├── configs/vehicles/atlas.yaml # Declarative vehicle definition
│ └── tests/ # Physics unit tests + gradient-flow checks
│
├── hardware/ # Custom flight computer (KiCad)
│ └── pcb/flight_computer/ # Teensy-based board: IMU, barometer,
│ # servo drivers, pyro channels, power
└── background/ # Early diffsim prototypes & experimentsHardware
The hardware/ directory contains the KiCad design for a custom rocket flight computer — a Teensy-class board with an IMU, barometer, servo drivers for the TVC gimbal, pyro channels for recovery, and power management. The long-term goal of Ember is zero-shot sim-to-real transfer: train the attitude controller entirely in the differentiable simulator, then deploy the exact learned weights to this board to fly a physical rocket.
Parts
96| Qty | Value | Footprint | References |
|---|---|---|---|
| 12 | 0.1 uF | Capacitor_SMD:C_0603_1608Metric | C1, C4, C5, C10, C12, C13, C14, C15, C16, C18, C19, C20 |
| 6 | 10k | Resistor_SMD:R_0603_1608Metric | R1, R8, R14, R23, R26, R38 |
| 6 | 10k 1% | Resistor_SMD:R_0603_1608Metric | R7, R17, R18, R19, R30, R32 |
| 5 | 100k | Resistor_SMD:R_0603_1608Metric | R9, R12, R21, R24, R37 |
| 4 | 10 uF | Capacitor_SMD:C_0603_1608Metric | C7, C17, C21, C22 |
| 4 | 100 | Resistor_SMD:R_0603_1608Metric | R10, R11, R20, R22 |
| 4 | 4.7k | Resistor_SMD:R_0603_1608Metric | R13, R15, R25, R27 |
| 4 | BAT54 | footprints:SOT95P240X120-3N | D2, D3, D4, D5 |
| 4 | MountingHole_Pad | MountingHole:MountingHole_3mm_Pad | H1, H2, H3, H4 |
| 3 | 1K | Resistor_SMD:R_0603_1608Metric | R28, R31, R41 |
| 3 | AO3401A | footprints:SOT95P240X120-3N | Q1, Q2, Q6 |
| 2 | 220 | Resistor_SMD:R_0603_1608Metric | R29, R36 |
| 2 | 220 uF | footprints:CAP_UCD_6P3X7P7_NCH | C24, C25 |
| 2 | 22uF | Capacitor_SMD:C_0603_1608Metric | C2, C3 |
| 2 | 2N7002 | footprints:SOT95P240X111-3N | Q3, Q5 |
| 2 | AO3400A | footprints:SOT95P240X120-3N | Q4, Q7 |
| 2 | LED | LED_SMD:LED_0603_1608Metric | D8, D9 |
| 2 | R | Resistor_SMD:R_0603_1608Metric | R33, R35 |
| 2 | Servo | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J6, J7 |
| 1 | 10 nF | Capacitor_SMD:C_0603_1608Metric | C9 |
| 1 | 100 uF | footprints:WCAP-ASLI_6.3X7.7_DXL_ | C11 |
| 1 | 10K 1% | Resistor_SMD:R_0603_1608Metric | R16 |
| 1 | 10uF | Capacitor_SMD:C_0603_1608Metric | C6 |
| 1 | 110K 1% | Resistor_SMD:R_0603_1608Metric | R2 |
| 1 | 16K 1% | Resistor_SMD:R_0603_1608Metric | R3 |
| 1 | 18k 1% | Resistor_SMD:R_0603_1608Metric | R6 |
| 1 | 3.3 uH | Inductor_SMD:L_0603_1608Metric | L1 |
| 1 | 5V Terminal | footprints:691502710002 | J3 |
| 1 | AZ1117-5.0 | footprints:SOT223-5_DIO | U7 |
| 1 | Aux Ports | Connector_PinHeader_2.54mm:PinHeader_2x04_P2.54mm_Vertical | J9 |
| 1 | BATT_TERMINAL | footprints:691502710002 | J2 |
| 1 | BMP388 | footprints:XDCR_BMP388 | U4 |
| 1 | BZT52C5V1 | footprints:P35_SOD-123F | D7 |
| 1 | Buzzer | Buzzer_Beeper:Buzzer_Murata_PKMCS0909E | BZ1 |
| 1 | G*** | kibuzzard-6A2E09AC | kibuzzard-6A2E09AC |
| 1 | LED_RGB | LED_SMD:LED_RGB_5050-6 | D6 |
| 1 | LSM6DSRXTR | footprints:LGA-14L_STM | U5 |
| 1 | NRF24L01 | Connector_PinHeader_2.54mm:PinHeader_2x04_P2.54mm_Vertical | J1 |
| 1 | Pyro 1 | footprints:691502710002 | J4 |
| 1 | Pyro 2 | footprints:691502710002 | J5 |
| 1 | TPS563201DDCR | footprints:SOT95P280X110-6N | U2 |
| 1 | TPS73633DRBR | footprints:SOT95P280X145-5N | U3 |
| 1 | Teensy4.1 | footprints:Teensy41 | U6 |
| 1 | ~ | Resistor_SMD:R_0603_1608Metric | R34 |
Questions
How big is the Flight computer PCB?
It measures 64 × 64 mm and has 4 copper layers, 1.6 mm thick.
What parts does the Flight computer use?
96 parts, built around the TEENSY 4.1, NRF24L01, BMP388 and TPS563201DDCR. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
Where can I download the Flight computer KiCad files?
From the daniel360kim/ember repository on GitHub, at the commit this page was made from: the board is hardware/pcb/flight_computer/flight_computer.kicad_pcb and its schematic hardware/pcb/.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Flight computer design in my own project?
Its repository states no licence, so its author keeps all rights: ask daniel360kim before reusing the design.
Similar boards
- 4 layers100 × 80 mm

- 4 layers18 × 40 mm

- 4 layers150 × 90 mm

Misrc v2.5-rounded
Stefan-Olt/MISRC
MISRC Is a multi channel RF capture device for FM RF, S-Video, CVBS RAW capture and anything else, but intended and supported for the decode family of projects vhs-decode, ld-decode, hifi-decode.
328 parts236CC-BY-4.0 - 4 layers172.5 × 85 mm

- 4 layers50 × 36 mm

Power dual buck
HeyPCB/power-kit
Six open power and charging boards: KiCad 10, JLCPCB-ready, CERN-OHL-S-2.0
34 partsCERN-OHL-S-2.0 - 4 layers150 × 40 mm

Linklite v2
WeasalCrafter/linklite-v2
Programming and KiCad files for LinkLite v2: a modular lighting system with wireless control and syncing.
116 partsMIT - 2 layers50 × 50 mm

- 2 layers105 × 142.5 mm

TestStand
ibsal/LERT
LERT will launch humans to space in 2 months, please give me 10 trillion dollars pls
116 parts1