Skip to content

Commit

Permalink
docs: 📝 update documentation for v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 15, 2024
1 parent 59f7f53 commit ff144a2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ later refactored into this library for others to use.
- [:wrench: Installation](#wrench-installation)
- [Loading the Library](#loading-the-library)
- [:satellite: Usage](#satellite-usage)
- [Common Patterns](#common-patterns)
- [Propagating a TLE](#propagating-a-tle)
- [Creating a Satellite](#creating-a-satellite)
- [Creating a Sensor](#creating-a-sensor)
- [More Examples](#more-examples)
- [Changelog](#changelog)
- [:desktop\_computer: Building](#desktop_computer-building)
- [:gem: NPM Scripts](#gem-npm-scripts)
- [:man\_teacher: Contributing](#man_teacher-contributing)
Expand Down Expand Up @@ -57,6 +60,16 @@ const satellite = new Satellite({

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

```js
Expand Down Expand Up @@ -112,12 +125,22 @@ sat.rae(sensor, time); // Get position in range, aziimuth, elevation relative to
### Creating a Sensor

```js
const sensor = new Ootk.Sensor({ name: 'Test', lat: lat, lon: lon, alt: alt });
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](https://github.com/thkruz/ootk-core/blob/main/CHANGELOG.md).

## :desktop_computer: Building

1. Install [Node.js](https://nodejs.org/) and [Node Package Manager](https://www.npmjs.com/);
Expand Down
6 changes: 3 additions & 3 deletions examples/satellite-js-migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ const rangeRate = lookAngles.rngRate; // Kilometers/Second

// There is a built in cache to allow fast retrieval of repeated calculations.
// This means you can make repeat calls to `.rae()` for minimal performance hit.
const rangeCache = satellite.rae(observer, exampleDate).range;
const azimuthCached = satellite.rae(observer, exampleDate).azimuth;
const elevationCached = satellite.rae(observer, exampleDate).elevation;
const rangeCache = satellite.rae(observer, exampleDate).rng;
const azimuthCached = satellite.rae(observer, exampleDate).az;
const elevationCached = satellite.rae(observer, exampleDate).el;
const latitudeCached = satellite.lla(exampleDate).lat;
const longitudeCached = satellite.lla(exampleDate).lon;
const heightCached = satellite.lla(exampleDate).alt;
Expand Down
2 changes: 1 addition & 1 deletion src/objects/Satellite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export class Satellite extends BaseObject {
* @param date - The date at which to calculate the range. Optional, defaults to the current date.
* @returns The range of the satellite from the given sensor at the specified time.
*/
range(observer: GroundObject, date: Date = new Date()): Kilometers {
rng(observer: GroundObject, date: Date = new Date()): Kilometers {
return this.rae(observer, date).rng;
}

Expand Down
2 changes: 1 addition & 1 deletion test/objects/Satellite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('Satellite', () => {

// can calculate and return range to an observer
it('should calculate and return range to an observer', () => {
const range = satellite.range(observer, exampleDate);
const range = satellite.rng(observer, exampleDate);

expect(range).toMatchSnapshot();
});
Expand Down

0 comments on commit ff144a2

Please sign in to comment.