From 02f09227bead5c8aa8cb44e1ba6b8119b34be9f6 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Fri, 12 Jan 2024 23:20:48 -0500 Subject: [PATCH] docs: :memo: update docs --- CHANGELOG.md | 27 ++++--- README.md | 70 +++++++++++-------- examples/README.md | 4 +- .../{es5 => es6}/satellite-js-migration.mjs | 0 src/body/Moon.ts | 2 +- src/coordinate/TLE.ts | 2 +- src/index.ts | 2 +- src/objects/BaseObject.ts | 2 +- src/objects/Satellite.ts | 2 +- src/objects/Star.ts | 2 +- src/sgp4/sgp4.ts | 2 +- src/transforms/transforms.ts | 2 +- 12 files changed, 69 insertions(+), 48 deletions(-) rename examples/{es5 => es6}/satellite-js-migration.mjs (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08d9f6c..286dc1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,22 +6,31 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### [v1.0.0-2](https://github.com/thkruz/ootk-core/compare/v1.0.0-1...v1.0.0-2) -- refactor: :recycle: implement strict checks in tsconfig [`b1515cb`](https://github.com/thkruz/ootk-core/commit/b1515cb07794b7ac465bf27ebfb48232140f2e25) -- feat: :sparkles: sync all commonjs es5 and typescript examples [`adb58fa`](https://github.com/thkruz/ootk-core/commit/adb58faf46de6af12568064d5941026a31942ecf) -- refactor: :recycle: standardize eci and rae methods [`5581a18`](https://github.com/thkruz/ootk-core/commit/5581a18ffcb7ebbc04365e36fe49b51534c99137) +- refactor: :recycle: implement strict checks in tsconfig + [`b1515cb`](https://github.com/thkruz/ootk-core/commit/b1515cb07794b7ac465bf27ebfb48232140f2e25) +- feat: :sparkles: sync all commonjs es6 and typescript examples + [`adb58fa`](https://github.com/thkruz/ootk-core/commit/adb58faf46de6af12568064d5941026a31942ecf) +- refactor: :recycle: standardize eci and rae methods + [`5581a18`](https://github.com/thkruz/ootk-core/commit/5581a18ffcb7ebbc04365e36fe49b51534c99137) #### [v1.0.0-1](https://github.com/thkruz/ootk-core/compare/v1.0.0-0...v1.0.0-1) > 12 January 2024 -- refactor: :recycle: combine Tle classes and improve documentation [`b5b506a`](https://github.com/thkruz/ootk-core/commit/b5b506af622d673fbf03fa4edbb11b405f27099f) -- test: :white_check_mark: fix tests [`4c2d701`](https://github.com/thkruz/ootk-core/commit/4c2d701dfc25d04a3929956e0ff2d5f94466bd05) -- refactor: :recycle: move moon code to moon [`7f5d7c7`](https://github.com/thkruz/ootk-core/commit/7f5d7c74b41216e75b94fbb32b07c6303cf044ec) +- refactor: :recycle: combine Tle classes and improve documentation + [`b5b506a`](https://github.com/thkruz/ootk-core/commit/b5b506af622d673fbf03fa4edbb11b405f27099f) +- test: :white_check_mark: fix tests + [`4c2d701`](https://github.com/thkruz/ootk-core/commit/4c2d701dfc25d04a3929956e0ff2d5f94466bd05) +- refactor: :recycle: move moon code to moon + [`7f5d7c7`](https://github.com/thkruz/ootk-core/commit/7f5d7c74b41216e75b94fbb32b07c6303cf044ec) #### v1.0.0-0 > 7 January 2024 -- feat: :boom: initial commit [`9893a6a`](https://github.com/thkruz/ootk-core/commit/9893a6acfb5dd51b12d755518c3af120fecc28be) -- test: :truck: update names and paths [`c48aece`](https://github.com/thkruz/ootk-core/commit/c48aece9a4c8a328cc7778292c4397312c162982) -- fix: :white_check_mark: fix test paths [`b784f3e`](https://github.com/thkruz/ootk-core/commit/b784f3eab311661415bfc9aa4001d9d8b8acd19f) +- feat: :boom: initial commit + [`9893a6a`](https://github.com/thkruz/ootk-core/commit/9893a6acfb5dd51b12d755518c3af120fecc28be) +- test: :truck: update names and paths + [`c48aece`](https://github.com/thkruz/ootk-core/commit/c48aece9a4c8a328cc7778292c4397312c162982) +- fix: :white_check_mark: fix test paths + [`b784f3e`](https://github.com/thkruz/ootk-core/commit/b784f3eab311661415bfc9aa4001d9d8b8acd19f) diff --git a/README.md b/README.md index b8061e9..52682d9 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ -# ootk +# ootk-core + + ![Size](https://img.shields.io/github/languages/code-size/thkruz/ootk-core?style=flat-square) -[![Release](https://img.shields.io/github/v/release/thkruz/ootk-core?style=flat-square)](https://www.npmjs.com/package/ootk) [![Issues](https://img.shields.io/github/issues/thkruz/ootk-core?style=flat-square)](https://github.com/thkruz/ootk/issues) -[![Coverage](https://img.shields.io/codecov/c/github/thkruz/ootk-core?style=flat-square)](https://codecov.io/gh/thkruz/ootk) [![License](https://img.shields.io/github/license/thkruz/ootk-core?style=flat-square)](LICENSE.md) > An Orbital Object Toolkit in Your Web Browser **ootk-core** is the core libraries of [ootk](https://github.com/thkruz/ootk) for doing math related to orbital objects -written in TypeScript. **ootk-core** was developed to simplify the math and let you focus on using the results. +written in TypeScript and built for both CommonJS and ES6 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](https://github.com/thkruz/ootk). The full library has features for doing initial orbit determination, maneuver @@ -42,9 +44,12 @@ npm i ootk-core ### Loading the Library ```js -import { Sgp4 } from 'ootk-core'; +import { Satellite } from 'ootk-core'; ... -const satrec = Sgp4.createSatrec(line1, line2, 'wgs72', 'i'); +const satellite = new Satellite({ + tle1: line1, + tle2: line2 +}); ``` ## :satellite: Usage @@ -52,12 +57,25 @@ const satrec = Sgp4.createSatrec(line1, line2, 'wgs72', 'i'); ### Propagating a TLE ```js -import { Sgp4 } from 'ootk-core'; - -const satrec = Sgp4.createSatrec(line1, line2); -const state = Sgp4.propagate(satrec, time); -console.log(state.position); // [x, y, z] -console.log(state.velocity); // [vx, vy, vz] +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 @@ -83,19 +101,18 @@ console.log(sat.period); // period in seconds console.log(sat.apogee); // apogee in kilometers console.log(sat.perigee); // perigee in kilometers -sat.propagate(time); // Propagate the satellite to the given time -sat.getLla(); // Get the satellite's position in latitude, longitude, altitude at its current time -sat.getEci(time); // Get the satellite's position in Earth-Centered Inertial coordinates at the given time without changing its state -sat.getRae(sensor, time); // Get position in range, aziimuth, elevation relative to a sensor object at the given time without changing its state +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 ```js const sensor = new Ootk.Sensor({ name: 'Test', lat: lat, lon: lon, alt: alt }); -sensor.setTime(time); // Set the sensor's time to the given time -sensor.getRae(sat); // Get satellite position in range, aziimuth, elevation at the sensor's current time -sensor.getRae(sat, time); // Get position in range, aziimuth, elevation relative to a satellite object at the given time without changing its state +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 ``` ## :desktop_computer: Building @@ -116,12 +133,9 @@ sensor.getRae(sat, time); // Get position in range, aziimuth, elevation relative ## :gem: NPM Scripts -- `build` compiles TypeScript into ES6 Modules and combines them into a single file in the `dist` directory. +- `build` compiles TypeScript into ES6 Modules in `lib` directory and CommonJs in `commonjs` directory - `lint` lints source code located in `src` directory with [ESLint](http://eslint.org/) -- `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` builds the software and then runs jest to verify the final library remains functional -- `test:coverage` generates lcov report to view code coverage ## :man_teacher: Contributing @@ -137,17 +151,15 @@ git merge origin/develop git checkout -b my-feature ``` -Make sure that your changes don't break the existing code by running: +When you are done, make sure that your changes don't break the existing code by running: ```bash npm test ``` -Check that your code follows the rules established in eslint.rc: +After you have pushed your branch you can [create a pull request here](https://github.com/thkruz/ootk-core/pulls). -```bash -npm run lint -``` +If you need help, just open an issue and I'll happily walk you through the process. ## :man_scientist: Contributors @@ -164,6 +176,6 @@ 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 +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](LICENSE.md). 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](https://www.gnu.org/philosophy/philosophy.html). diff --git a/examples/README.md b/examples/README.md index 7308705..9d1eb9d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -6,9 +6,9 @@ Run the examples using tsx as below: npx tsx ./examples/typescript/satellite-js-migration.ts -## ES5 Module +## ES6 Module -npx tsx ./examples/es5/satellite-js-migration.mjs +npx tsx ./examples/es6/satellite-js-migration.mjs ## CommonJs diff --git a/examples/es5/satellite-js-migration.mjs b/examples/es6/satellite-js-migration.mjs similarity index 100% rename from examples/es5/satellite-js-migration.mjs rename to examples/es6/satellite-js-migration.mjs diff --git a/src/body/Moon.ts b/src/body/Moon.ts index ff7fe8b..d0e1b9c 100644 --- a/src/body/Moon.ts +++ b/src/body/Moon.ts @@ -1,6 +1,6 @@ /** * @author Theodore Kruczek. - * @description Orbital Object ToolKit (OOTK) is a collection of tools for working + * @description Orbital Object ToolKit (ootk) is a collection of tools for working * with satellites and other orbital objects. * * Some of the math in this file was originally created by Vladimir Agafonkin. diff --git a/src/coordinate/TLE.ts b/src/coordinate/TLE.ts index c10e337..80c1f1b 100644 --- a/src/coordinate/TLE.ts +++ b/src/coordinate/TLE.ts @@ -1,6 +1,6 @@ /** * @author Theodore Kruczek. - * @description Orbital Object ToolKit (OOTK) is a collection of tools for working + * @description Orbital Object ToolKit (ootk) is a collection of tools for working * with satellites and other orbital objects. * * @file The Tle module contains a collection of functions for working with TLEs. diff --git a/src/index.ts b/src/index.ts index 10310cc..e6c1962 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ /** * @author @thkruz Theodore Kruczek - * @description Orbital Object ToolKit Core (OOTK-Core) is a base collection + * @description Orbital Object ToolKit Core (ootk-Core) is a base collection * of tools for working with satellites and other orbital objects. This core * library is provided under the MIT license and is free to use in any project. * For additional features, see the full library at: diff --git a/src/objects/BaseObject.ts b/src/objects/BaseObject.ts index dae16ba..ea71f82 100644 --- a/src/objects/BaseObject.ts +++ b/src/objects/BaseObject.ts @@ -1,6 +1,6 @@ /** * @author Theodore Kruczek. - * @description Orbital Object ToolKit (OOTK) is a collection of tools for working + * @description Orbital Object ToolKit (ootk) is a collection of tools for working * with satellites and other orbital objects. * * @file The BaseObject class is used for creating core properties and methods applicable diff --git a/src/objects/Satellite.ts b/src/objects/Satellite.ts index d40b9c4..00eb938 100644 --- a/src/objects/Satellite.ts +++ b/src/objects/Satellite.ts @@ -1,6 +1,6 @@ /** * @author Theodore Kruczek. - * @description Orbital Object ToolKit (OOTK) is a collection of tools for working + * @description Orbital Object ToolKit (ootk) is a collection of tools for working * with satellites and other orbital objects. * * @file The Satellite class provides functions for calculating satellites positions diff --git a/src/objects/Star.ts b/src/objects/Star.ts index df98743..adbd863 100644 --- a/src/objects/Star.ts +++ b/src/objects/Star.ts @@ -1,6 +1,6 @@ /** * @author Theodore Kruczek. - * @description Orbital Object ToolKit (OOTK) is a collection of tools for working + * @description Orbital Object ToolKit (ootk) is a collection of tools for working * with satellites and other orbital objects. * * @file The Star class is meant to help with cacluating star positions relative to diff --git a/src/sgp4/sgp4.ts b/src/sgp4/sgp4.ts index 82d9c06..5412f64 100644 --- a/src/sgp4/sgp4.ts +++ b/src/sgp4/sgp4.ts @@ -1,6 +1,6 @@ /** * @author Theodore Kruczek. - * @description Orbital Object ToolKit (OOTK) is a collection of tools for working + * @description Orbital Object ToolKit (ootk) is a collection of tools for working * with satellites and other orbital objects. * * @file The Sgp4 module contains a TypeScript port of the 2020 version of diff --git a/src/transforms/transforms.ts b/src/transforms/transforms.ts index ab26de9..f5c77ea 100644 --- a/src/transforms/transforms.ts +++ b/src/transforms/transforms.ts @@ -1,7 +1,7 @@ /* eslint-disable init-declarations */ /** * @author Theodore Kruczek. - * @description Orbital Object ToolKit (OOTK) is a collection of tools for working + * @description Orbital Object ToolKit (ootk) is a collection of tools for working * with satellites and other orbital objects. * * @file The Transforms module contains a collection of conversions not contained