Class ostk::astrodynamics::Trajectory

class Trajectory

Path followed by an object through space as a function of time.

https://en.wikipedia.org/wiki/Trajectory

Subclassed by ostk::astrodynamics::trajectory::Orbit

Public Functions

Trajectory(const Model &aModel)

Constructor (model)

Tabulated model = Tabulated::Load(File::Path(Path::Parse("/path/to/trajectory.csv")));
Trajectory trajectory = { model };
Parameters:

aModel -- A trajectory model

Trajectory(const Array<State> &aStateArray)

Constructor (state array)

Array<State> stateArray = { ... };
Trajectory trajectory = { stateArray };
Parameters:

aStateArray -- An array of states

Trajectory(const Trajectory &aTrajectory)

Copy constructor.

Parameters:

aTrajectory -- A trajectory

Trajectory &operator=(const Trajectory &aTrajectory)

Copy assignment operator.

bool operator==(const Trajectory &aTrajectory) const

Equal to operator.

Trajectory(...) == Trajectory(...);
Parameters:

aTrajectory -- A trajectory

Returns:

True if trajectories are equal

bool operator!=(const Trajectory &aTrajectory) const

Not equal to operator.

Trajectory(...) != Trajectory(...);
Parameters:

aTrajectory -- A trajectory

Returns:

True if trajectories are not equal

bool isDefined() const

Check if trajectory is defined.

Trajectory(...).isDefined();
Returns:

True if trajectory is defined

const Model &accessModel() const

Access trajectory model.

Returns:

Reference to trajectory model

State getStateAt(const Instant &anInstant) const

Get state at a given instant.

Trajectory trajectory = { ... };
Instant instant = { ... };
State state = trajectory.getStateAt(instant);
Parameters:

anInstant -- An instant

Returns:

State

Array<State> getStatesAt(const Array<Instant> &anInstantArray) const

Get states at a given instants.

Trajectory trajectory = { ... };
Array<Instant> instants = { ... };
Array<State> state = trajectory.getStatesAt(instants);
Parameters:

anInstantArray -- An array of instants

Returns:

Array of states

virtual void print(std::ostream &anOutputStream, bool displayDecorator = true) const

Print trajectory to output stream.

Trajectory trajectory = { ... };
trajectory.print(std::cout, true);
Parameters:
  • anOutputStream -- An output stream

  • displayDecorator -- If true, display decorator

Public Static Functions

static Trajectory Undefined()

Constructs an undefined trajectory.

Trajectory trajectory = Trajectory::Undefined(); // Undefined
Returns:

Undefined trajectory

static Trajectory Position(const physics::coordinate::Position &aPosition)

Constructs a trajectory from a given position.

Position position = Position::Meters({ 0.0, 0.0, 0.0 }, Frame::GCRF());
Trajectory trajectory = Trajectory::Position(position);
Parameters:

aPosition -- A position

Returns:

Static trajectory

static Trajectory GroundStrip(const LLA &aStartLLA, const LLA &anEndLLA, const Derived &aGroundSpeed, const Instant &aStartInstant, const Celestial &aCelestial = Earth::WGS84(), const Duration &aStepSize = Duration::Seconds(1.0))

Constructs a trajectory for a given strip, specified ground speed and start instant.

LLA startLLA = { 0.0, 0.0, 0.0 };
LLA endLLA = { 1.0, 0.0, 0.0 };
Derived groundSpeed = Derived(1000.0, Derived::Unit::MeterPerSecond());
Instant startInstant = Instant::DateTime(DateTime::Parse("2020-01-01 00:00:00"), Scale::UTC);
Earth earth = Earth::WGS84();
Duration stepSize = Duration::Seconds(1.0);
Trajectory trajectory = Trajectory::GroundStrip(startLLA, endLLA, groundSpeed, startInstant, earth,
duration);

Deprecated:

Use Trajectory(TargetScan::FromGroundSpeed(...)) instead.

Parameters:
  • aStartLLA -- A start LLA

  • anEndLLA -- An end LLA

  • aGroundSpeed -- A ground speed

  • aStartInstant -- A start instant

  • aCelestial -- Celestial body

Returns:

GroundStrip trajectory

static Trajectory GroundStrip(const LLA &aStartLLA, const LLA &anEndLLA, const Array<Instant> &anInstantArray, const Celestial &aCelestial = Earth::WGS84())

Constructs a trajectory for a given strip, assuming a constant ground speed and start instant.

LLA startLLA = LLA::FromVector({ 0.0, 0.0, 0.0 });
LLA endLLA = LLA::FromVector({ 1.0, 0.0, 0.0 });
Instant startInstant = Instant::DateTime(DateTime::Parse("2020-01-01 00:00:00"), Scale::UTC);
Instant endInstant = Instant::DateTime(DateTime::Parse("2020-01-01 00:10:00"), Scale::UTC);
Interval interval = Interval::Closed(startInstant, endInstant);
Array<Instant> instants = interval.generateGrid(Duration::Seconds(1.0));
Earth earth = Earth::WGS84();
Trajectory trajectory = Trajectory::GroundStrip(startLLA, endLLA, instants, earth);

Deprecated:

Use Trajectory(TargetScan(...)) instead.

Parameters:
  • aStartLLA -- A start LLA

  • anEndLLA -- An end LLA

  • anInstantArray -- An array of instants

  • aCelestial -- Celestial body

Returns:

GroundStrip trajectory

static Trajectory GroundStripGeodeticNadir(const trajectory::Orbit &anOrbit, const Array<Instant> &anInstantArray, const Celestial &aCelestial = Earth::WGS84())

Constructs a trajectory representing a ground strip that follows the geodetic nadir of the provided orbit.

Instant startInstant = Instant::DateTime(DateTime::Parse("2020-01-01 00:00:00"), Scale::UTC);
Earth earth = Earth::WGS84();
Trajectory trajectory = Trajectory::GroundStripGeodeticNadir(anOrbit, anInstantArray, earth);

Deprecated:

Use Trajectory(Nadir(...)) instead.

Parameters:
  • anOrbit -- An orbit

  • anInstantArray -- An array of instants

  • aCelestial -- Celestial body

Returns:

Trajectory

Friends

friend std::ostream &operator<<(std::ostream &anOutputStream, const Trajectory &aTrajectory)

Output stream operator.

std::cout << Trajectory(...);
Parameters:
  • anOutputStream -- An output stream

  • aTrajectory -- A trajectory

Returns:

A reference to output stream