Giter VIP home page Giter VIP logo

Comments (7)

ericsvendsen avatar ericsvendsen commented on June 18, 2024 1

I realize this issue thread is really old, but thought I would post my solution here for calculating ECF velocity in case others have the same question. If accuracy is vital and you're able to track down and decipher the math mentioned above, then great! I was not though, and this seemed to worked out pretty well for me. :)

Basically, you can determine ecf velocity using the eci data that satellite.js provides via the propagate or sgp4 methods (Note: I'm using dayjs elsewhere in my project, so that's why I'm using it here in this example. It is certainly not required)

const now = dayjs(); // date/time right now
const pv = propagate(satrec, now.toDate()); // eci position and velocity for a given satrec
if (pv.position && pv.velocity) {
    const ecfPosition = eciToEcf(pv.position, gstime(now.toDate())); // convert eci position to ecf
    const ecfMoved = eciToEcf( // add eci velocity to eci position, and convert the result to ecf
        {
            x: pv.position.x + pv.velocity.x,
            y: pv.position.y + pv.velocity.y,
            z: pv.position.z + pv.velocity.z,
        },
        gstime(now.add(1, 'second').toDate()) // be sure to use a time 1 second later, since velocity is km/s
    );
    const ecfVelocity = { // subtract original ecf from ecfMoved to obtain velocity in ecf
        x: ecfMoved.x - ecfPosition.x,
        y: ecfMoved.y - ecfPosition.y,
        z: ecfMoved.z - ecfPosition.z,
    };
}

from satellite-js.

shashwatak avatar shashwatak commented on June 18, 2024

I apologize for the extreme delay in response.
You will have to define those yourself using the functions described in the README.

from satellite-js.

nhamer avatar nhamer commented on June 18, 2024

The readme code doesn't quite run. velocityEcf and observerCoordsEcf just aren't defined.

velocityEcf = satellite.eciToEcf(velocityEci, gmst);
dopplerFactor = satellite.dopplerFactor(observerEcf, positionEcf, velocityEcf);

from satellite-js.

thkruz avatar thkruz commented on June 18, 2024

Recommend using Eci for the dopplerFactor example in the readme. There is no available function to convert velocityEci to velocityEcf and the readme already explains you can use ecf if you have those values.

from satellite-js.

nhamer avatar nhamer commented on June 18, 2024

satellite.eciToEcf converts it

from satellite-js.

thkruz avatar thkruz commented on June 18, 2024

It converts ECI Position but it doesn't convert ECI Velocity because it doesn't account for the rotation of the earth.

There is a reference at http://www.dtic.mil/dtic/tr/fulltext/u2/a015815.pdf on page 29 and 30 that explains the math to convert ECI Velocity to ECF Velocity.

from satellite-js.

thkruz avatar thkruz commented on June 18, 2024

Slick idea. That should actually account for the rotation of the earth perfectly. Feels super obvious now that you post it - thanks for helping out!

from satellite-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.