[go: up one dir, main page]

Skip to content
/ ootk Public

🛰️Orbital Object Toolkit including Multiple Propagators, Initial Orbit Determination, and Maneuver Calculations.

License

Notifications You must be signed in to change notification settings

thkruz/ootk

Repository files navigation

ootk

build Size Release Issues Coverage License

An Orbital Object Toolkit in Your Web Browser

ootk is a collection libraries for doing math related to orbital objects written in TypeScript. ootk was developed to simplify the math and let you focus on using the results.

Most of the functionality was originally written for KeepTrack and then later refactored into this library for others to use.

📘 Table of Contents

🔧 Installation

Install the library with NPM:

npm i ootk

Example Usage

import { DetailedSatellite, DetailedSensor, Degrees, Kilometers, SpaceObjectType, TleLine1, TleLine2 } from "ootk";

// Using api.keeptrack.space API
fetch('https://api.keeptrack.space/v1/sat/25544')
  .then((res) => res.json())
  .then((satData) => {
    const satellite = new DetailedSatellite({
      id: satData.id,
      tle1: satData.tle1 as TleLine1,
      tle2: satData.tle2 as TleLine2,
    });

    // Get the satellite's position at the current time
    const eci = satellite.eci();

    // Log the satellite's position - y component only
    console.log(eci.position.y);

    // Access other satellite properties
    console.log(satellite.inclination); // inclination in degrees
    console.log(satellite.eccentricity); // eccentricity
    console.log(satellite.period); // period in minutes

    // Get LLA (Latitude, Longitude, Altitude)
    const lla = satellite.lla();

    console.log(lla); // { lat: degrees, lon: degrees, alt: kilometers }

    const sensor = new DetailedSensor({
      lat: 41.754785 as Degrees,
      lon: -70.539151 as Degrees,
      alt: 0.060966 as Kilometers,
      minAz: 347 as Degrees,
      maxAz: 227 as Degrees,
      minEl: 3 as Degrees,
      maxEl: 85 as Degrees,
      minRng: 0 as Kilometers,
      maxRng: 5556 as Kilometers,
      name: 'Cape Cod',
      type: SpaceObjectType.PHASED_ARRAY_RADAR,
    });

    // Assuming we have a satellite object from the previous example
    const rae = sensor.rae(satellite);

    // Log the azimuth from sensor to satellite
    console.log(rae.az);

    // Check if a satellite is in the sensor's field of view right now
    const isSatInFov = sensor.isSatInFov(satellite);

    console.log(isSatInFov); // true or false

    // Calculate passes for a satellite (in 30 second intervals)
    const passes = sensor.calculatePasses(30, satellite);

    console.log(passes); // Array of pass information

    // Convert sensor position to J2000 coordinates
    const j2000 = sensor.toJ2000();

    console.log(j2000); // J2000 object with position and velocity
  });

🖥️ Building

  1. Install Node.js and Node Package Manager;

  2. Install all required packages with NPM by running the following command from repository's root directory:

    npm install
  3. Run the following NPM script to build everything:

    npm run build

💎 NPM Scripts

  • build compiles TypeScript into ES6 Modules and combines them into a single file in the dist directory.
  • lint lints source code located in src directory with ESLint
  • lint:fix lints tests located in src directory with ESLint and attempts to auto-fix errors
  • lint:test lints tests located in test directory with ESLint
  • test runs jest to verify code remains functional
  • test:coverage generates lcov report to view code coverage

👨‍🏫 Contributing

This repo follows Gitflow Workflow.

Before starting a work on new pull request, please, checkout your feature or bugfix branch from develop branch:

git checkout develop
git fetch origin
git merge origin/develop
git checkout -b my-feature

Make sure that your changes don't break the existing code by running:

npm test

Check that your code follows the rules established in eslint.rc:

npm run lint

👨‍🔬 Contributors

This whole project is an example of standing on the shoulder's of giants. None of it would have been possible without the previous work of the following:

⚖️ License

I have placed the code under the AGPL License in order to ensure that good ideas can be shared and that the code is open for everyone to use. Learn more here.

About

🛰️Orbital Object Toolkit including Multiple Propagators, Initial Orbit Determination, and Maneuver Calculations.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages