Skip to content

LVLH Frame

LVLH (Local Vertical, Local Horizontal) places Z along nadir, Y opposite the orbit normal, and X completing the right-handed set. Its rate is the true-anomaly rate about \(-Y\). Some references, including Vallado and STK, use the name LVLH for the RTN axes. In brahe the two are distinct frames, related by \(X_\mathrm{LVLH} = T\), \(Y_\mathrm{LVLH} = -N\), and \(Z_\mathrm{LVLH} = -R\).

import numpy as np

import brahe as bh

bh.initialize_eop()

# Chief in a 700 km, e = 0.01, sun-synchronous orbit
oe_chief = np.array([bh.R_EARTH + 700e3, 0.01, 97.8, 15.0, 30.0, 45.0])
x_chief = bh.state_koe_to_eci(oe_chief, bh.AngleFormat.DEGREES)

# LVLH axes (CCSDS/SANA): Z nadir, Y anti-normal, X = Y x Z
r_lvlh_to_eci = bh.rotation_lvlh_to_eci(x_chief)
r_rtn_to_eci = bh.rotation_rtn_to_eci(x_chief)
print("LVLH X equals RTN T:", np.allclose(r_lvlh_to_eci[:, 0], r_rtn_to_eci[:, 1]))
print("LVLH Z equals -RTN R:", np.allclose(r_lvlh_to_eci[:, 2], -r_rtn_to_eci[:, 0]))

# Frame rate: the orbit rate about the -Y axis
omega = bh.omega_lvlh(x_chief)
print(f"omega_lvlh (rad/s): [{omega[0]:.3e}, {omega[1]:.3e}, {omega[2]:.3e}]")

# Deputy 1 km ahead and 200 m above the chief in the rotating LVLH frame
x_rel = np.array([1000.0, 0.0, -200.0, 0.0, 0.0, 0.0])
x_deputy = bh.state_lvlh_to_eci(x_chief, x_rel)
x_rel_back = bh.state_eci_to_lvlh(x_chief, x_deputy)
print(f"Relative state round trip error: {np.linalg.norm(x_rel_back - x_rel):.2e}")

# Frame graph: the same rotation from a registered object
epc = bh.Epoch.from_datetime(2024, 3, 1, 0, 0, 0.0, 0.0, bh.UTC)
bh.register_object("CHIEF", lambda epoch: x_chief, bh.CelestialFrame.GCRF)
r_graph = bh.rotation_frame_to_frame(
    bh.CelestialFrame.GCRF, bh.ReferenceFrame.LVLH("CHIEF"), epc
)
print(
    "Frame graph matches rotation_eci_to_lvlh:",
    np.allclose(r_graph, bh.rotation_eci_to_lvlh(x_chief)),
)
bh.clear_object_registry()
use brahe as bh;
use brahe::frames::{CelestialFrame, ReferenceFrame};
use brahe::time::{Epoch, TimeSystem};
use brahe::utils::BraheError;
use brahe::utils::state_providers::SStateProvider;
use nalgebra::Vector6;

/// A state provider returning a fixed state at every epoch, for registering
/// the chief as an object.
struct ConstantProvider(Vector6<f64>);
impl SStateProvider for ConstantProvider {
    fn state(&self, _epoch: Epoch) -> Result<Vector6<f64>, BraheError> {
        Ok(self.0)
    }
}

fn main() {
    bh::initialize_eop().unwrap();

    // Chief in a 700 km, e = 0.01, sun-synchronous orbit
    let oe_chief = Vector6::new(bh::R_EARTH + 700e3, 0.01, 97.8, 15.0, 30.0, 45.0);
    let x_chief = bh::state_koe_to_eci(oe_chief, bh::AngleFormat::Degrees);

    // LVLH axes (CCSDS/SANA): Z nadir, Y anti-normal, X = Y x Z
    let r_lvlh_to_eci = bh::rotation_lvlh_to_eci(x_chief);
    let r_rtn_to_eci = bh::rotation_rtn_to_eci(x_chief);
    println!(
        "LVLH X equals RTN T: {}",
        (r_lvlh_to_eci.column(0) - r_rtn_to_eci.column(1)).norm() < 1e-12
    );
    println!(
        "LVLH Z equals -RTN R: {}",
        (r_lvlh_to_eci.column(2) + r_rtn_to_eci.column(0)).norm() < 1e-12
    );

    // Frame rate: the orbit rate about the -Y axis
    let omega = bh::omega_lvlh(x_chief);
    println!("omega_lvlh (rad/s): [{:.3e}, {:.3e}, {:.3e}]", omega[0], omega[1], omega[2]);

    // Deputy 1 km ahead and 200 m above the chief in the rotating LVLH frame
    let x_rel = Vector6::new(1000.0, 0.0, -200.0, 0.0, 0.0, 0.0);
    let x_deputy = bh::state_lvlh_to_eci(x_chief, x_rel);
    let x_rel_back = bh::state_eci_to_lvlh(x_chief, x_deputy);
    println!("Relative state round trip error: {:.2e}", (x_rel_back - x_rel).norm());

    // Frame graph: the same rotation from a registered object
    let epc = Epoch::from_datetime(2024, 3, 1, 0, 0, 0.0, 0.0, TimeSystem::UTC);
    bh::register_object("CHIEF", ConstantProvider(x_chief), CelestialFrame::GCRF).unwrap();
    let r_graph =
        bh::rotation_frame_to_frame(CelestialFrame::GCRF, ReferenceFrame::LVLH("CHIEF"), epc)
            .unwrap();
    println!(
        "Frame graph matches rotation_eci_to_lvlh: {}",
        (r_graph - bh::rotation_eci_to_lvlh(x_chief)).norm() < 1e-12
    );
    bh::clear_object_registry();
}
Output
1
2
3
4
5
LVLH X equals RTN T: True
LVLH Z equals -RTN R: True
omega_lvlh (rad/s): [0.000e+00, -1.075e-03, 0.000e+00]
Relative state round trip error: 2.49e-10
Frame graph matches rotation_eci_to_lvlh: True
1
2
3
4
5
LVLH X equals RTN T: true
LVLH Z equals -RTN R: true
omega_lvlh (rad/s): [0.000e0, -1.075e-3, 0.000e0]
Relative state round trip error: 2.49e-10
Frame graph matches rotation_eci_to_lvlh: true

See Also