Class ostk::astrodynamics::EventCondition

class EventCondition

An Event Condition defines a criterion that can be evaluated based on a current/previous state vectors and times.

Subclassed by ostk::astrodynamics::eventcondition::AngularCondition, ostk::astrodynamics::eventcondition::LogicalCondition, ostk::astrodynamics::eventcondition::RealCondition

Public Functions

EventCondition(const String &aName, const std::function<Real(const State&)> &anEvaluator, const EventCondition::Target &aTarget)

Constructor.

EventCondition eventCondition = {aName, anEvaluator, aTarget};
Parameters:
  • aName -- A string representing the name of the Real Event Condition

  • anEvaluator -- A function evaluating a state

  • aTarget -- A target associated with the Real Event Condition

EventCondition(const String &aName, const std::function<Real(const State&)> &anEvaluator, const Real &aTargetValue)

Constructor.

EventCondition eventCondition = {aName, anEvaluator, aTargetValue};
Parameters:
  • aName -- A string representing the name of the Real Event Condition

  • anEvaluator -- A function evaluating a state

  • aTargetValue -- A target value associated with the Real Event Condition

virtual ~EventCondition()

Virtual destructor.

String getName() const

Get the name of the Event Condition.

Returns:

String representing the name of the Event Condition

std::function<Real(const State&)> getEvaluator() const

Get evaluator.

Returns:

Evaluator

Target getTarget() const

Get the target.

Returns:

Target

virtual void updateTarget(const State &aState)

Update the target value if the Event Condition is relative.

Parameters:

aState -- A state to calculate the relative target from

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

Print the Event Condition.

Parameters:
  • anOutputStream -- [inout] The output stream where the Event Condition will be printed

  • displayDecorator -- A boolean indicating whether or not to display decorator during printing

virtual EventCondition *clone() const = 0

Create a copy of this EventCondition.

Returns:

Pointer to the cloned EventCondition

virtual bool isSatisfied(const State &currentState, const State &previousState) const = 0

Check if the Event Condition is satisfied based on current state and previous state/time.

Parameters:
  • currentState -- The current state

  • previousState -- The previous state

Returns:

Boolean value indicating if the Event Condition is met

Friends

friend std::ostream &operator<<(std::ostream &anOutputStream, const EventCondition &anEventCondition)

Output stream operator.

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

  • anEventCondition -- An EventCondition

Returns:

A reference to output stream

struct Target

Public Types

enum class Type

Values:

enumerator Absolute
enumerator Relative

Public Functions

Target(const Real &aValue, const Type &aType = Type::Absolute)
Target(const Angle &anAngle, const Type &aType = Type::Absolute)
Target(const Length &aLength, const Type &aType = Type::Absolute)
bool operator==(const Target &aTarget) const
bool operator!=(const Target &aTarget) const
bool isDefined() const

Public Members

const Real value
const Type type
mutable Real valueOffset = 0.0

Public Static Functions

static String StringFromType(const Type &aType)