Skip to content

Commit

Permalink
Merge pull request #29 from thkruz/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
thkruz authored Aug 23, 2024
2 parents 70dda63 + 0f6c26f commit 3c23205
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 55 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is an automatic changelog that automatically records all changes made to the project. Generated from Git commit
messages, it details updates like bug fixes and new features, providing a clear history of the project's development.

#### [4.0.1](https://github.com/thkruz/ootk/compare/v5.0.0-0...4.0.1)
#### [4.0.2](https://github.com/thkruz/ootk/compare/v5.0.0-0...4.0.2)

- feat: :sparkles: Add node support [`7d28c3f`](https://github.com/thkruz/ootk/commit/7d28c3f5de0e3e9d2dd13bbf5cdfd5527f6126a8)
- refactor: :recycle: update RfSensor to allow multiple faces [`179b486`](https://github.com/thkruz/ootk/commit/179b486bbbd9355569414f9ca7ca82aaa374ca93)
Expand All @@ -13,12 +13,19 @@ messages, it details updates like bug fixes and new features, providing a clear
- refactor: :recycle: move freqBand from RfSensor to DetailedSensor [`185cc50`](https://github.com/thkruz/ootk/commit/185cc506482c0e0224ff0392e6bb1bad599d54ec)
- refactor: :recycle: update transforms to allow multiple faces [`53c8877`](https://github.com/thkruz/ootk/commit/53c887730d389b06f18889d4f2170a1e4ac82993)
- feat: :sparkles: add new catalog sources [`9dd4160`](https://github.com/thkruz/ootk/commit/9dd41607da91e4daffd8456f795239e945493a2d)
- fix: :arrow_up: bump ootk-core [`3c87557`](https://github.com/thkruz/ootk/commit/3c875578298b20a3906cf00e45e5bedf55cfa43f)
- build: :arrow_up: bump ootk-core [`2ff598e`](https://github.com/thkruz/ootk/commit/2ff598ec309be005a40335b99eb1b232b646f44b)
- fix: :arrow_up: bump ootk-core [`edaafb7`](https://github.com/thkruz/ootk/commit/edaafb7ee1092064addd040d438d100f6b84514b)
- build: :arrow_up: bump ootk-core [`f5152ed`](https://github.com/thkruz/ootk/commit/f5152ed69c98f92e354240dfe36589fad81e1fa6)
- fix: :bug: fix issue with vite [`9b540f9`](https://github.com/thkruz/ootk/commit/9b540f9231076ce8670eb2230321b592d0696b99)

#### [v5.0.0-0](https://github.com/thkruz/ootk/compare/v4.0.0...v5.0.0-0)
#### [v5.0.0-0](https://github.com/thkruz/ootk/compare/v4.0.1...v5.0.0-0)

#### [v4.0.1](https://github.com/thkruz/ootk/compare/v4.0.0...v4.0.1)

> 25 June 2024
- build: :arrow_up: bump ootk-core [`2ff598e`](https://github.com/thkruz/ootk/commit/2ff598ec309be005a40335b99eb1b232b646f44b)

### [v4.0.0](https://github.com/thkruz/ootk/compare/v4.0.0-17...v4.0.0)

Expand Down
104 changes: 59 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,58 +36,72 @@ Install the library with [NPM](https://www.npmjs.com/):
npm i ootk
```

### Loading the Library
### Example Usage

```js
import { Sgp4, Satellite } from 'ootk';
...
const satrec = Sgp4.createSatrec(line1, line2, 'wgs72', 'i');
```
```ts
import { DetailedSatellite, DetailedSensor, Degrees, Kilometers, SpaceObjectType, TleLine1, TleLine2 } from "ootk";

## :satellite: Usage
// 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,
});

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

```js
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]
```
// Log the satellite's position - y component only
console.log(eci.position.y);

### Creating a Satellite

```js
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.raan); // 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.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
```
// 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

### Creating a Sensor
// Convert sensor position to J2000 coordinates
const j2000 = sensor.toJ2000();

```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
console.log(j2000); // J2000 object with position and velocity
});
```

## :desktop_computer: Building
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ootk",
"version": "4.0.1",
"version": "4.0.2",
"type": "module",
"module": "dist/main.js",
"description": "Orbital Object Toolkit including Multiple Propagators, Initial Orbit Determination, and Maneuver Calculations.",
Expand Down Expand Up @@ -55,7 +55,7 @@
"typescript": "^5.4.3"
},
"dependencies": {
"ootk-core": "^1.2.3"
"ootk-core": "^1.2.4"
},
"homepage": "https://github.com/thkruz/ootk"
}

0 comments on commit 3c23205

Please sign in to comment.