Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 5 #30

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 73 additions & 14 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
"node": true,
"jest": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jsdoc/recommended-typescript-error"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended-typescript-error"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "jsdoc"],
"plugins": [
"@typescript-eslint",
"jsdoc"
],
"rules": {
"accessor-pairs": "error",
"array-bracket-newline": "error",
Expand All @@ -28,7 +35,10 @@
"camelcase": "error",
"capitalized-comments": "off",
"class-methods-use-this": "off",
"comma-dangle": ["error", "always-multiline"],
"comma-dangle": [
"error",
"always-multiline"
],
"comma-spacing": "error",
"comma-style": "error",
"complexity": "error",
Expand Down Expand Up @@ -59,25 +69,66 @@
"id-length": "off",
"id-match": "error",
"implicit-arrow-linebreak": "off",
"indent": ["error", 2, { "SwitchCase": 1 }],
"indent-legacy": ["error", 2, { "SwitchCase": 1 }],
"indent": [
"error",
2,
{
"SwitchCase": 1
}
],
"indent-legacy": [
"error",
2,
{
"SwitchCase": 1
}
],
"init-declarations": "off",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": "error",
"line-comment-position": "off",
"linebreak-style": ["error", "unix"],
"linebreak-style": [
"error",
"unix"
],
"lines-around-comment": "off",
"lines-around-directive": "error",
"lines-between-class-members": "off",
"max-classes-per-file": "error",
"max-depth": "error",
"max-len": ["error", { "code": 120 }],
"max-lines": ["error", { "max": 1000 }],
"max-lines-per-function": ["error", { "max": 300 }],
// TODO: Reenable this
"max-len": [
"off",
{
"code": 120
}
],
"max-lines": [
"error",
{
"max": 1000
}
],
"max-lines-per-function": [
"error",
{
"max": 300
}
],
"max-nested-callbacks": "error",
"max-params": ["error", { "max": 8 }],
"max-statements": ["error", { "max": 85 }],
"max-params": [
"error",
{
"max": 8
}
],
"max-statements": [
"error",
{
"max": 85
}
],
"max-statements-per-line": "error",
"multiline-comment-style": "error",
"multiline-ternary": "off",
Expand Down Expand Up @@ -163,7 +214,12 @@
"no-template-curly-in-string": "error",
"no-ternary": "off",
"no-throw-literal": "error",
"no-trailing-spaces": ["error", { "ignoreComments": true }],
"no-trailing-spaces": [
"error",
{
"ignoreComments": true
}
],
"no-undef-init": "error",
"no-undefined": "error",
"no-underscore-dangle": "off",
Expand Down Expand Up @@ -209,7 +265,10 @@
"prefer-spread": "error",
"prefer-template": "error",
"quote-props": "off",
"quotes": ["error", "single"],
"quotes": [
"error",
"single"
],
"radix": "off",
"require-atomic-updates": "error",
"require-await": "error",
Expand Down Expand Up @@ -241,4 +300,4 @@
"yield-star-spacing": "error",
"yoda": "error"
}
}
}
23 changes: 8 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,16 @@
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.2](https://github.com/thkruz/ootk/compare/v5.0.0-0...4.0.2)
#### [5.0.0-0](https://github.com/thkruz/ootk/compare/v4.0.2...5.0.0-0)

- 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)
- fix: :bug: add fix for vite compiler [`c72bd38`](https://github.com/thkruz/ootk/commit/c72bd38df2be1fef82603e85fd687a2e3f67ca83)
- refactor: :recycle: make rfSensor an extension of DetailedSensor [`add7613`](https://github.com/thkruz/ootk/commit/add7613c9cea3ddf56b5da0accef36b8b866b144)
- build: :arrow_up: bump ootk-core [`9ac1464`](https://github.com/thkruz/ootk/commit/9ac1464338284e6169304e44ceecb9c978543203)
- 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)
- refactor: :recycle: Merge ootk-core with ootk for upgrade to v5 [`1e137bb`](https://github.com/thkruz/ootk/commit/1e137bba174072586cf748fee18b3dbd793c7fc7)
- fix: :memo: fix outdated documentation [`0f6c26f`](https://github.com/thkruz/ootk/commit/0f6c26f40edaa5d8fe275b8aa967e5a00188beca)

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

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

- fix: :arrow_up: bump ootk-core [`3c87557`](https://github.com/thkruz/ootk/commit/3c875578298b20a3906cf00e45e5bedf55cfa43f)

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

Expand Down
3 changes: 1 addition & 2 deletions examples/integrator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { RungeKutta4Propagator, RungeKutta89Propagator, ForceModel } from '../src/main.js';
import { EpochUTC, Satellite, TleLine1, TleLine2 } from 'ootk-core';
import { EpochUTC, ForceModel, RungeKutta4Propagator, RungeKutta89Propagator, Satellite, TleLine1, TleLine2 } from '../src/main.js';

const start = new Date(2024, 0, 28, 0, 0, 0, 0);
const stop = new Date(2024, 0, 29, 0, 0, 0, 0);
Expand Down
4 changes: 2 additions & 2 deletions examples/iod.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LambertIOD } from '@src/orbit_determination/LambertIOD.js';
import { GibbsIOD } from './../src/orbit_determination/GibbsIOD.js';
import { HerrickGibbsIOD } from './../src/orbit_determination/HerrickGibbsIOD.js';
import { DEG2RAD, Degrees, EpochUTC, J2000, Kilometers, KilometersPerSecond, RAE, Radians, Tle, Vector3D, calcGmst,
lla2eci } from 'ootk-core';
import { EpochUTC, Kilometers, Degrees, DEG2RAD, Radians, calcGmst, lla2eci, RAE, J2000, Vector3D, KilometersPerSecond, Tle } from '@src/main.js';

/* eslint-disable no-console */

const lambert = new LambertIOD();
Expand Down
70 changes: 70 additions & 0 deletions examples/readme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* eslint-disable multiline-comment-style */
/* eslint-disable no-console */

import { Degrees, Kilometers, SpaceObjectType, TleLine1, TleLine2 } from '@src/main';
import { DetailedSatellite, DetailedSensor } from '@src/objects';

// Examples for README.md
// 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
});
83 changes: 60 additions & 23 deletions examples/sensor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-console */

import {
calcGmst,
DEG2RAD,
Expand All @@ -9,33 +10,69 @@ import {
eci2rae,
Kilometers,
Satellite,
Sensor,
SensorParams,
SpaceObjectType,
Scenario,
Facility,
RadarSensor,
TleLine1,
TleLine2,
} from 'ootk-core';
} from '../dist/main';

const scenario = new Scenario({
name: 'Example Scenario',
currentTime: new Date(),
stepSize: 60,
});

const facility = new Facility({
name: 'Example Facility',
shortDescription: 'This is an example facility.',
longDescription: 'This is a long description of the facility.',
lat: 0 as Degrees,
lon: 0 as Degrees,
alt: 0 as Kilometers,
orientation: {
azimuth: 0 as Degrees,
elevation: 0 as Degrees,
},
});

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const capeCodRadar = new Sensor({
lat: <Degrees>41.754785,
lon: <Degrees>-70.539151,
alt: <Kilometers>0.060966,
minAz: 347 as Degrees,
maxAz: 227 as Degrees,
minEl: 3 as Degrees,
maxEl: 85 as Degrees,
scenario.addObject(facility);

const capeCodA = new RadarSensor({
name: 'CapeCodA',
shortDescription: 'Cape Cod Face A',
longDescription: 'This is a long description of the sensor.',
orientation: {
azimuth: 47 as Degrees,
elevation: 20 as Degrees,
},
minRng: 0 as Kilometers,
maxRng: 5556 as Kilometers,
minAz: -65 as Degrees,
minEl: -20 as Degrees,
maxAz: 65 as Degrees,
maxEl: 65 as Degrees,
coneHalfAngle: 2 as Degrees,
});
const capeCodB = new RadarSensor({
name: 'CapeCodB',
shortDescription: 'Cape Cod Face B',
longDescription: 'This is a long description of the sensor.',
orientation: {
azimuth: 167 as Degrees,
elevation: 20 as Degrees,
},
minRng: 0 as Kilometers,
maxRng: 5556 as Kilometers,
name: 'Cape Cod',
type: SpaceObjectType.PHASED_ARRAY_RADAR,
minAz: -65 as Degrees,
minEl: -20 as Degrees,
maxAz: 65 as Degrees,
maxEl: 65 as Degrees,
coneHalfAngle: 2 as Degrees,
});

const testSensor = new Sensor({
lat: <Degrees>41,
lon: <Degrees>-71,
alt: <Kilometers>1,
} as SensorParams);
facility.attachObject(capeCodA);
facility.attachObject(capeCodB);

const sat = new Satellite({
tle1: '1 00005U 58002B 23361.70345217 .00000401 00000-0 53694-3 0 99999' as TleLine1,
Expand All @@ -51,10 +88,10 @@ const ecf = {
};
// const ecf2 = { x: 982.8336640053099, y: -6779.137352354403, z: 3813.7284924837254 } as EcfVec3<Kilometers>;

const rae = ecf2rae(testSensor.lla(), ecf);
const rae = ecf2rae(facility.lla(), ecf);

const { gmst } = calcGmst(date);
const rae2 = eci2rae(date, ecf2eci(ecf, gmst), testSensor);
const rae2 = eci2rae(date, ecf2eci(ecf, gmst), facility);
const lla = eci2lla(ecf2eci(ecf, gmst), gmst);

console.log(rae);
Expand All @@ -67,5 +104,5 @@ console.log({

// sat.propagateTo(date);

console.log(sat.rae(testSensor, date));
console.log(sat.rae(facility, date));
console.log(sat.toJ2000(date).toITRF().toGeodetic());
3 changes: 2 additions & 1 deletion examples/sun.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Degrees, Meters, Sun } from 'ootk-core';
import { Sun } from '@src/body';
import { Degrees, Meters } from '@src/main';

/* eslint-disable no-console */
console.log(Sun.getTimes(new Date(), 41 as Degrees, -71 as Degrees, 0 as Meters));
Loading
Loading