rockets-engine v0.6.1

Point-mass powered flight for Rust — prescribed motor burns, staging and guidance hooks on the ballistics-engine force kernel.

# Cargo.toml
rockets-engine = "0.6"

What it does

Use them together

The boundary: rockets-engine owns the powered flight — motor, mass, integration, guidance. ballistics-engine supplies the atmosphere and drag kernel through the adapter.

use rockets_engine::{
    ballistics::{Atmosphere, BallisticForces},
    ControlInput, FlightState, IntegratorSettings, Motor, Rocket, Simulator,
    ThrustCurve, ThrustPoint, Vec3,
};

fn main() -> Result<(), rockets_engine::Error> {
    // rockets-engine: prescribed motor burn
    let curve = ThrustCurve::new(vec![
        ThrustPoint { time_s: 0.0, thrust_n: 0.0 },
        ThrustPoint { time_s: 0.1, thrust_n: 20.0 },
        ThrustPoint { time_s: 0.9, thrust_n: 15.0 },
        ThrustPoint { time_s: 1.0, thrust_n: 0.0 },
    ])?;
    let rocket = Rocket::new(0.18, Some(Motor::new(curve, 0.04, 0.2)?))?;

    // ballistics-engine: atmosphere + drag kernel (via the adapter)
    let forces = BallisticForces::new(
        0.025,
        vec![(0.0, 0.45), (0.8, 0.5), (1.2, 0.7), (3.0, 0.4)],
        Atmosphere::default(),
        Vec3::new(2.0, 0.0, 0.0),
    )?;

    let sim = Simulator::new(rocket, forces, IntegratorSettings::default())?;
    let mut state = FlightState {
        time_s: 0.0,
        position_m: Vec3::new(0.0, 2.0, 0.0),
        velocity_mps: Vec3::new(2.0, 8.0, 0.0),
    };
    for _ in 0..100 {
        let result = sim.step(&state, 0.05, ControlInput::along(Vec3::new(0.3, 1.0, 0.0)))?;
        state = result.state;
    }
    Ok(())
}

In Cargo.toml: rockets-engine = "0.6"; add ballistics-engine = "=0.48.0" only if you call its API directly. Full source: examples/with_ballistics.rs. Flying something unpowered? Drive ballistics-engine directly instead.

Get it