public class BasicLaunchSegment extends SegmentDefinition
Note that the reference frame used for the input positions must be set.
This is accomplished via SegmentDefinition.setElementAndAdapter(agi.foundation.coordinates.StateElementAdapterDefinition)
.
Both the BurnoutState
(get
/ set
) and LaunchState
(get
/ set
) location reference frames must be the same.
Modifier | Constructor and Description |
---|---|
|
BasicLaunchSegment()
Initializes a new launch segment.
|
protected |
BasicLaunchSegment(BasicLaunchSegment existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
|
BasicLaunchSegment(Duration step)
Initializes a new launch segment with the specified step size.
|
|
BasicLaunchSegment(Duration step,
String motionID,
ITimeBasedState launchState)
Initializes a new launch segment with the specified step size, launch state, and motion ID.
|
|
BasicLaunchSegment(Duration step,
String motionID,
ITimeBasedState launchState,
ITimeBasedState burnoutState)
Initializes a new launch segment with the specified step size, launch state, burnout state, and motion ID.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropagationFinishedEvent(EventHandler<SegmentPropagationEventArgs> value)
An event that gets raised when propagation is complete.
|
protected boolean |
checkForSameDefinition(BasicLaunchSegment other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected boolean |
checkForSameDefinition(SegmentDefinition other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
protected SegmentPropagator |
createSegmentPropagator(EvaluatorGroup group,
SegmentDefinition previousSegment)
Creates, configures, and returns the
SegmentPropagator for this
segment. |
SegmentList |
createSequenceWithPreLaunchHold(Duration preLaunchHoldTime)
This helper method returns a
SegmentList that contains three parts; an InitialStateSegment , a HoldSegment
and this BasicLaunchSegment . |
void |
enumerateDependencies(DependencyEnumerator enumerator)
Enumerates the dependencies of this object by calling
DependencyEnumerator#enumerate(T) for each object that this object directly depends upon. |
SimpleAscentPropagatorAscentType |
getAscentType()
Gets the interpolation type for the ascent.
|
ValueDefinition<Double> |
getBurnoutFlightPathAngle()
Gets the burnout velocity's flight path angle.
|
ITimeBasedState |
getBurnoutState()
Gets the burnout state.
|
ValueDefinition<Double> |
getBurnoutVelocityAzimuth()
Gets the burnout velocity's azimuth.
|
SimpleAscentPropagatorBurnoutVelocityFrame |
getBurnoutVelocityFrame()
Gets the reference frame that the burnout velocity is specified in.
|
ValueDefinition<Double> |
getBurnoutVelocityMagnitude()
|
CentralBody |
getCentralBody()
Gets the central body to be used for the launch segment.
|
ValueDefinition<Double> |
getInitialAcceleration()
Gets the initial acceleration at launch.
|
ITimeBasedState |
getLaunchState()
Gets the launch state.
|
String |
getMotionID()
Gets the ID in the state that represents the motion to be computed/manipulated.
|
int |
getNumberOfSamplePoints()
Gets the number of points to be sampled on the interpolation spline.
|
int |
getOrder()
Gets the order of the motion produced by the propagator.
|
boolean |
getPassAllElementsToNextSegment()
Gets a value indicating whether the segment is such that it will not define any
Elements (get ) or
StateElementAdapters . |
Duration |
getStep()
Gets the default step that the
SegmentPropagator should
create states for. |
void |
removePropagationFinishedEvent(EventHandler<SegmentPropagationEventArgs> value)
An event that gets raised when propagation is complete.
|
void |
setAscentType(SimpleAscentPropagatorAscentType value)
Sets the interpolation type for the ascent.
|
void |
setBurnoutFlightPathAngle(ValueDefinition<Double> value)
Sets the burnout velocity's flight path angle.
|
void |
setBurnoutState(ITimeBasedState value)
Sets the burnout state.
|
void |
setBurnoutVelocityAzimuth(ValueDefinition<Double> value)
Sets the burnout velocity's azimuth.
|
void |
setBurnoutVelocityFrame(SimpleAscentPropagatorBurnoutVelocityFrame value)
Sets the reference frame that the burnout velocity is specified in.
|
void |
setBurnoutVelocityMagnitude(ValueDefinition<Double> value)
|
void |
setCentralBody(CentralBody value)
Sets the central body to be used for the launch segment.
|
void |
setInitialAcceleration(ValueDefinition<Double> value)
Sets the initial acceleration at launch.
|
void |
setLaunchState(ITimeBasedState value)
Sets the launch state.
|
void |
setMotionID(String value)
Sets the ID in the state that represents the motion to be computed/manipulated.
|
void |
setNumberOfSamplePoints(int value)
Sets the number of points to be sampled on the interpolation spline.
|
void |
setOrder(int value)
Sets the order of the motion produced by the propagator.
|
void |
setStep(Duration value)
Sets the default step that the
SegmentPropagator should
create states for. |
checkForSameDefinition, containsElement, getDefinedIn, getElementAdapter, getElements, getName, getNextStateBehavior, getPropagationDirection, getSegmentPropagator, getSegmentPropagator, getSegmentPropagator, getSegmentPropagator, removeElement, setElementAndAdapter, setName, setNextStateBehavior, setPropagationDirection, toString
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, freeze, freezeAggregatedObjects, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
public BasicLaunchSegment()
public BasicLaunchSegment(@Nonnull Duration step)
step
- The step size of the segment.public BasicLaunchSegment(@Nonnull Duration step, String motionID, ITimeBasedState launchState)
step
- The step size of the segment.motionID
- The ID of the motion element in the launch and burnout states that specifies the positions.launchState
- The launch motion state.public BasicLaunchSegment(@Nonnull Duration step, String motionID, ITimeBasedState launchState, ITimeBasedState burnoutState)
step
- The step size of the segment.motionID
- The ID of the motion element in the launch and burnout states that specifies the positions.launchState
- The launch motion state.burnoutState
- The burnout state.protected BasicLaunchSegment(@Nonnull BasicLaunchSegment existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
clone
in class DefinitionalObject
context
- The context to use to perform the copy.protected final boolean checkForSameDefinition(SegmentDefinition other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class SegmentDefinition
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected boolean checkForSameDefinition(BasicLaunchSegment other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
BasicLaunchSegment.checkForSameDefinition(agi.foundation.segmentpropagation.SegmentDefinition)
method.computeCurrentDefinitionHashCode
in class SegmentDefinition
public void enumerateDependencies(DependencyEnumerator enumerator)
DependencyEnumerator#enumerate(T)
for each object that this object directly depends upon.
Derived classes which contain additional dependencies MUST override this method, call the base
implementation, and enumerate dependencies introduced by the derived class.enumerateDependencies
in interface IEnumerateDependencies
enumerateDependencies
in class DefinitionalObject
enumerator
- The enumerator that is informed of the dependencies of this object.@Nonnull public final Duration getStep()
SegmentPropagator
should
create states for. This must be a positive duration.public final void setStep(@Nonnull Duration value)
SegmentPropagator
should
create states for. This must be a positive duration.public final SegmentList createSequenceWithPreLaunchHold(@Nonnull Duration preLaunchHoldTime)
SegmentList
that contains three parts; an InitialStateSegment
, a HoldSegment
and this BasicLaunchSegment
. This sequence may then be used to model a launch segment with a pre-launch hold time. The epoch of the produced initial state
segment will be the launch epoch minus the hold time.
Note that all the required properties must be set before calling this helper method.
preLaunchHoldTime
- The duration of time preceding the launch.SegmentList
that represents a launch with a hold of the input Duration
.public final String getMotionID()
public final void setMotionID(String value)
public final ITimeBasedState getLaunchState()
public final void setLaunchState(ITimeBasedState value)
public final ITimeBasedState getBurnoutState()
public final void setBurnoutState(ITimeBasedState value)
public final CentralBody getCentralBody()
public final void setCentralBody(CentralBody value)
public final int getNumberOfSamplePoints()
STK's Astrogator sets this to a fixed value of 2000, which is the default.
public final void setNumberOfSamplePoints(int value)
STK's Astrogator sets this to a fixed value of 2000, which is the default.
@Nonnull public final SimpleAscentPropagatorBurnoutVelocityFrame getBurnoutVelocityFrame()
public final void setBurnoutVelocityFrame(@Nonnull SimpleAscentPropagatorBurnoutVelocityFrame value)
@Nonnull public final SimpleAscentPropagatorAscentType getAscentType()
public final void setAscentType(@Nonnull SimpleAscentPropagatorAscentType value)
public final ValueDefinition<Double> getBurnoutVelocityAzimuth()
public final void setBurnoutVelocityAzimuth(ValueDefinition<Double> value)
public final ValueDefinition<Double> getBurnoutFlightPathAngle()
public final void setBurnoutFlightPathAngle(ValueDefinition<Double> value)
public final int getOrder()
public final void setOrder(int value)
public final ValueDefinition<Double> getBurnoutVelocityMagnitude()
public final void setBurnoutVelocityMagnitude(ValueDefinition<Double> value)
public final ValueDefinition<Double> getInitialAcceleration()
public final void setInitialAcceleration(ValueDefinition<Double> value)
public boolean getPassAllElementsToNextSegment()
Elements
(get
) or
StateElementAdapters
. Such a segment typically
affects the control flow of multiple segments instead of propagating state elements. By default this is
false
, but if the specific derived segment can use the previous segment's adapters,
override this property to always return true
. Even if this is true
some segments may require adapters
to be set with the
SegmentDefinition.setElementAndAdapter(agi.foundation.coordinates.StateElementAdapterDefinition)
method.getPassAllElementsToNextSegment
in class SegmentDefinition
protected SegmentPropagator createSegmentPropagator(EvaluatorGroup group, SegmentDefinition previousSegment)
SegmentPropagator
for this
segment. This method should check that all of the required properties on the
concrete instance are configured properly before constructing the
SegmentPropagator
to be returned.createSegmentPropagator
in class SegmentDefinition
group
- The group to use during creation.previousSegment
- The previous segment
.
Some segments will require the previousSegment to be set, whereas other will require that the
previous segment not be null
, whereas others will only use information from
it if provided. It is up to you writing a concrete type to enforce what makes sense for your
particular segment in this method.propagator
for this segment.public void addPropagationFinishedEvent(EventHandler<SegmentPropagationEventArgs> value)
addPropagationFinishedEvent
in class SegmentDefinition
public void removePropagationFinishedEvent(EventHandler<SegmentPropagationEventArgs> value)
removePropagationFinishedEvent
in class SegmentDefinition