npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ootk-core

v1.2.5

Published

Orbital Object Toolkit. A modern typed replacement for satellite.js including SGP4 propagation, TLE parsing, Sun and Moon calculations, and more.

Downloads

604

Readme

ootk-core

Size Issues License

An Orbital Object Toolkit in Your Web Browser

ootk-core is the core libraries of ootk for doing math related to orbital objects written in TypeScript and built for JavaScript or TypeScript. ootk-core was developed to simplify the math and let you focus on using the results. It is the culmination of years of fixes and improvements to other libraries.

If you would like more functionality the expanded ootk library is available free under the AGPL license here. The full library has features for doing initial orbit determination, maneuver calculations, and more.

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

:blue_book: Table of Contents

:wrench: Installation

Install the library with NPM:

npm i ootk-core

Loading the Library

import { Satellite } from 'ootk-core';
...
const satellite = new Satellite({
   tle1: line1,
   tle2: line2
});

:satellite: Usage

Common Patterns

  • If you don't specify a date, the method will assume you want to use the current date/time.
  • Many parameters are in shorthand - Ex: sensor.rng.
  • Changing a variable requires you to cast its units before using it as a parameters - Ex: (3.14 * -1) as Radians
  • Methods starting with 'to' change the class - Ex: satellite.toGeodetic() or satellite.toITRF()
    • Methods that are optimized for loops are marked as @variation optimized
    • Methods that are slower with expanded capabilities are marked as @variation expanded
  • Class parameters assume degrees and specify radians - Ex: sensor.az is in degrees and sensor.azRad is in radians.

Propagating a TLE

import { Satellite } from 'ootk-core';
...
const satellite = new Satellite({
   tle1: line1,
   tle2: line2
});
const state = satellite.eci();
console.log(state.position);
// {
//   x:  1538.223335842895
//   y:  5102.261204021967
//   z:  4432.634965003577
// }
console.log(state.velocity);
// {
//   x:  -4.26262363267920
//   y:  0.159169020320195
//   z:  1.502351885030190
// }

Creating a Satellite

import { Satellite } from 'ootk-core';

const sat = new Satellite({ name: 'Test', tle1, tle2 });

console.log(sat.intlDes); // International Designator
console.log(sat.epochYear); // Epoch Year
console.log(sat.epochDay); // Epoch Day
console.log(sat.meanMoDev1); // Mean Motion Deviation 1
console.log(sat.meanMoDev2); // Mean Motion Deviation 2
console.log(sat.bstar); // Bstar (Drag Coefficient)
console.log(sat.inclination); // inclination in degrees
console.log(sat.rightAscension); // right ascension of the ascending node in degrees
console.log(sat.eccentricity); // eccentricity
console.log(sat.argOfPerigee); // argument of perigee in degrees
console.log(sat.meanAnomaly); // mean anomaly in degrees
console.log(sat.meanMotion); // mean motion in revolutions per day
console.log(sat.period); // period in seconds
console.log(sat.apogee); // apogee in kilometers
console.log(sat.perigee); // perigee in kilometers

sat.lla(); // Get the satellite's position in latitude, longitude, altitude at its current time
sat.eci(time); // Get the satellite's position in Earth-Centered Inertial coordinates at the given time
sat.rae(sensor, time); // Get position in range, aziimuth, elevation relative to a sensor object at the given time

Creating a Sensor

import { GroundPosition } from 'ootk-core';

const sensor = new GroundPosition({ name: 'Test', lat: lat, lon: lon, alt: alt });
sensor.rae(sat); // Get satellite position in range, aziimuth, elevation at the sensor's current time
sensor.rae(sat, time); // Get position in range, aziimuth, elevation relative to a satellite object at the given time
sensor.eci() // Get the sensor's position in ECI coordinates

More Examples

More examples can be found in the examples folder of the code.

Changelog

You can find a list of changes here.

:desktop_computer: 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

:gem: NPM Scripts

  • build compiles TypeScript into ES6 Modules in dist directory
  • lint lints source code located in src directory with ESLint
  • test runs jest to verify the final library remains functional

:man_teacher: 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

When you are done, make sure that your changes don't break the existing code by running:

npm test

After you have pushed your branch you can create a pull request here.

If you need help, just open an issue and I'll happily walk you through the process.

:man_scientist: 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:

:balance_scale: License

In order to maximize the usabiltiy of the core modules of ootk with other projects I support, I have placed this repository under the MIT License. I strongly encourage you to conisder a GPL license for your own project to keep your project free for everyone to use. Learn more here.