List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Rotation Rotation
public Rotation(RotationOrder order, double alpha1, double alpha2, double alpha3)
From source file:edu.mit.fss.examples.visual.gui.WorldWindVisualization.java
/** * Instantiates a new world wind visualization. * * @throws OrekitException the orekit exception *///from ww w . j av a2 s. com public WorldWindVisualization() throws OrekitException { logger.trace("Creating Orekit reference frames."); eme = ReferenceFrame.EME2000.getOrekitFrame(); itrf = ReferenceFrame.ITRF2008.getOrekitFrame(); // world wind frame is a fixed rotation from Earth inertial frame wwj = new Frame(itrf, new Transform(date, new Rotation(RotationOrder.ZXZ, 0, -Math.PI / 2, -Math.PI / 2)), "World Wind"); logger.trace("Creating World Window GL canvas and adding to panel."); wwd = new WorldWindowGLCanvas(); wwd.setModel(new BasicModel()); wwd.setPreferredSize(new Dimension(800, 600)); setLayout(new BorderLayout()); add(wwd, BorderLayout.CENTER); logger.trace("Creating and adding a renderable layer."); displayLayer = new RenderableLayer(); wwd.getModel().getLayers().add(displayLayer); logger.trace("Creating and adding a marker layer."); markerLayer = new MarkerLayer(); // allow markers above/below surface markerLayer.setOverrideMarkerElevation(false); wwd.getModel().getLayers().add(markerLayer); logger.trace("Creating and adding a sun renderable."); Vector3D position = sun.getPVCoordinates(date, wwj).getPosition(); sunShape = new Ellipsoid(wwd.getModel().getGlobe().computePositionFromPoint(convert(position)), 696000000., 696000000., 696000000.); ShapeAttributes sunAttributes = new BasicShapeAttributes(); sunAttributes.setInteriorMaterial(Material.YELLOW); sunAttributes.setInteriorOpacity(1.0); sunShape.setAttributes(sunAttributes); displayLayer.addRenderable(sunShape); logger.trace("Creating and adding a terminator."); LatLon antiSun = LatLon.fromRadians(-sunShape.getCenterPosition().getLatitude().radians, FastMath.PI + sunShape.getCenterPosition().getLongitude().radians); // set radius to a quarter Earth chord at the anti-sun position less // a small amount (100 m) to avoid graphics problems terminatorShape = new SurfaceCircle(antiSun, wwd.getModel().getGlobe().getRadiusAt(antiSun) * FastMath.PI / 2 - 100); ShapeAttributes nightAttributes = new BasicShapeAttributes(); nightAttributes.setInteriorMaterial(Material.BLACK); nightAttributes.setInteriorOpacity(0.5); terminatorShape.setAttributes(nightAttributes); displayLayer.addRenderable(terminatorShape); logger.trace("Creating and adding a panel for buttons."); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); buttonPanel.add(new JCheckBox(new AbstractAction("Inertial Frame") { private static final long serialVersionUID = 2287109397693524964L; @Override public void actionPerformed(ActionEvent e) { setInertialFrame(((JCheckBox) e.getSource()).isSelected()); } })); buttonPanel.add(new JButton(editOptionsAction)); add(buttonPanel, BorderLayout.SOUTH); logger.trace( "Creating a timer to rotate the sun renderable, " + "terminator surface circle, and stars layer."); Timer rotationTimer = new Timer(15, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { wwd.redraw(); try { BasicOrbitView wwdView; if (wwd.getView() instanceof BasicOrbitView) { wwdView = (BasicOrbitView) wwd.getView(); } else { return; } // rotate camera to simulate inertial frame if (wwd.getView().isAnimating() || !inertialFrame.get()) { // update eme datum rotationDatum = wwj.getTransformTo(eme, date) .transformPosition(convert(wwdView.getCenterPoint())); } else if (inertialFrame.get()) { Position newCenter = wwd.getModel().getGlobe().computePositionFromPoint( convert(eme.getTransformTo(wwj, date).transformPosition(rotationDatum))); // move to eme datum wwdView.setCenterPosition(newCenter); } // rotate stars layer for (Layer layer : wwd.getModel().getLayers()) { if (layer instanceof StarsLayer) { StarsLayer stars = (StarsLayer) layer; // find the EME coordinates of (0,0) Vector3D emeDatum = wwj.getTransformTo(eme, date).transformPosition(convert( wwd.getModel().getGlobe().computePointFromLocation(LatLon.fromDegrees(0, 0)))); // find the WWJ coordinates the equivalent point in ITRF Vector3D wwjDatum = itrf.getTransformTo(wwj, date).transformPosition(emeDatum); // set the longitude offset to the opposite of // the difference in longitude (i.e. from 0) stars.setLongitudeOffset(wwd.getModel().getGlobe() .computePositionFromPoint(convert(wwjDatum)).getLongitude().multiply(-1)); } } } catch (OrekitException ex) { logger.error(ex); } } }); // set initial 2-second delay for initialization rotationTimer.setInitialDelay(2000); rotationTimer.start(); }
From source file:IK.AbstractBone.java
public AbstractBone(AbstractBone par, //parent bone double xAngle, //how much the bone should be pitched relative to its parent bone double yAngle, //how much the bone should be rolled relative to its parent bone double zAngle, //how much the bone should be yawed relative to its parent bone String inputTag, //some user specified name for the bone, if desired double inputBoneHeight //bone length ) throws NullParentForBoneException { if (par != null) { if (this.tag == null || this.tag == "") { this.tag = Integer.toString(System.identityHashCode(this)); } else//from w w w . j av a2 s . c om this.tag = inputTag; this.boneHeight = inputBoneHeight; AbstractAxes tempAxes = par.localAxes().getAbsoluteCopy(); Rotation toRot = new Rotation(RotationOrder.XZY, xAngle, yAngle, zAngle); Rot newRot = new Rot(); newRot.rotation = toRot; tempAxes.rotateTo(newRot); this.parent = par; this.parentArmature = this.parent.parentArmature; parentArmature.addToBoneList(this); generateAxes(parent.getTip(), tempAxes.x().heading(), tempAxes.y().heading(), tempAxes.z().heading()); this.localAxes.orthogonalize(); localAxes.setParent(parent.localAxes); previousOrientation = localAxes.attachedCopy(true); majorRotationAxes = parent.localAxes().getAbsoluteCopy(); majorRotationAxes.translateTo(parent.getTip()); majorRotationAxes.setParent(parent.localAxes); this.parent.addFreeChild(this); this.parent.addChild(this); this.updateSegmentedArmature(); } else { throw new NullParentForBoneException(); } }
From source file:fr.cs.examples.attitude.EarthObservation_day_night_switch_with_spinned_transitions.java
/** Program entry point. * @param args program arguments (unused here) *///w ww .j a v a 2 s . c om public static void main(String[] args) { try { // configure Orekit Autoconfiguration.configureOrekit(); final SortedSet<String> output = new TreeSet<String>(); //---------------------------------------- // Initial state definition : date, orbit //---------------------------------------- final AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 02, 00, 00, 00.000, TimeScalesFactory.getUTC()); final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680); final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231); final Orbit initialOrbit = new KeplerianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initialDate, Constants.EIGEN5C_EARTH_MU); //------------------------------ // Attitudes sequence definition //------------------------------ final AttitudesSequence attitudesSequence = new AttitudesSequence(); // Attitude laws definition final double settingRate = FastMath.toRadians(1.0); final AttitudeProvider dayObservationLaw = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(20), FastMath.toRadians(40), 0); final AttitudeProvider nightRestingLaw = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH); final AttitudeProvider transitionLaw = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(20), 0, 0); final AttitudeProvider rollSetUpLaw = new SpinStabilized(nightRestingLaw, AbsoluteDate.J2000_EPOCH, Vector3D.PLUS_I, settingRate); final AttitudeProvider pitchSetUpLaw = new SpinStabilized(transitionLaw, AbsoluteDate.J2000_EPOCH, Vector3D.PLUS_J, settingRate); final AttitudeProvider pitchTearDownLaw = new SpinStabilized(dayObservationLaw, AbsoluteDate.J2000_EPOCH, Vector3D.PLUS_J, -settingRate); final AttitudeProvider rollTearDownLaw = new SpinStabilized(transitionLaw, AbsoluteDate.J2000_EPOCH, Vector3D.PLUS_I, -settingRate); // Event detectors definition //--------------------------- final PVCoordinatesProvider sun = CelestialBodyFactory.getSun(); final PVCoordinatesProvider earth = CelestialBodyFactory.getEarth(); // Detectors : end day-night rdv 2 final DateDetector endDayNightRdV2Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to night law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-2 night-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endDayNightRdV2Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to night law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-2 night-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detectors : end day-night rdv 1 final DateDetector endDayNightRdV1Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to day-night rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-1 day-night-rdv2-mode"); endDayNightRdV2Event_increase.addEventDate(s.getDate().shiftedBy(20)); endDayNightRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(20)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endDayNightRdV1Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to day-night rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-1 day-night-rdv2-mode"); endDayNightRdV2Event_increase.addEventDate(s.getDate().shiftedBy(20)); endDayNightRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(20)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detector : eclipse entry final EventDetector dayNightEvent = new EclipseDetector(sun, 696000000., earth, Constants.WGS84_EARTH_EQUATORIAL_RADIUS).withHandler(new EventHandler<EclipseDetector>() { public Action eventOccurred(final SpacecraftState s, final EclipseDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to day-night rdv 1 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " eclipse-entry day-night-rdv1-mode"); endDayNightRdV1Event_increase.addEventDate(s.getDate().shiftedBy(40)); endDayNightRdV1Event_decrease.addEventDate(s.getDate().shiftedBy(40)); } return Action.CONTINUE; } public SpacecraftState resetState(EclipseDetector detector, SpacecraftState oldState) { return oldState; } }); // Detectors : end night-day rdv 2 final DateDetector endNightDayRdV2Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to day law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-2 day-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endNightDayRdV2Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to day law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-2 day-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detectors : end night-day rdv 1 final DateDetector endNightDayRdV1Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to night-day rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-1 night-day-rdv2-mode"); endNightDayRdV2Event_increase.addEventDate(s.getDate().shiftedBy(40)); endNightDayRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(40)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endNightDayRdV1Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to night-day rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-1 night-day-rdv2-mode"); endNightDayRdV2Event_increase.addEventDate(s.getDate().shiftedBy(40)); endNightDayRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(40)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detector : eclipse exit final EventDetector nightDayEvent = new EclipseDetector(sun, 696000000., earth, Constants.WGS84_EARTH_EQUATORIAL_RADIUS).withHandler(new EventHandler<EclipseDetector>() { public Action eventOccurred(final SpacecraftState s, final EclipseDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to night-day rdv 1 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " eclipse-exit night-day-rdv1-mode"); endNightDayRdV1Event_increase.addEventDate(s.getDate().shiftedBy(20)); endNightDayRdV1Event_decrease.addEventDate(s.getDate().shiftedBy(20)); } return Action.CONTINUE; } public SpacecraftState resetState(EclipseDetector detector, SpacecraftState oldState) { return oldState; } }); // Attitude sequences definition //------------------------------ attitudesSequence.addSwitchingCondition(dayObservationLaw, dayNightEvent, false, true, pitchTearDownLaw); attitudesSequence.addSwitchingCondition(pitchTearDownLaw, endDayNightRdV1Event_increase, true, false, rollTearDownLaw); attitudesSequence.addSwitchingCondition(pitchTearDownLaw, endDayNightRdV1Event_decrease, false, true, rollTearDownLaw); attitudesSequence.addSwitchingCondition(rollTearDownLaw, endDayNightRdV2Event_increase, true, false, nightRestingLaw); attitudesSequence.addSwitchingCondition(rollTearDownLaw, endDayNightRdV2Event_decrease, false, true, nightRestingLaw); attitudesSequence.addSwitchingCondition(nightRestingLaw, nightDayEvent, true, false, rollSetUpLaw); attitudesSequence.addSwitchingCondition(rollSetUpLaw, endNightDayRdV1Event_increase, true, false, pitchSetUpLaw); attitudesSequence.addSwitchingCondition(rollSetUpLaw, endNightDayRdV1Event_decrease, false, true, pitchSetUpLaw); attitudesSequence.addSwitchingCondition(pitchSetUpLaw, endNightDayRdV2Event_increase, true, false, dayObservationLaw); attitudesSequence.addSwitchingCondition(pitchSetUpLaw, endNightDayRdV2Event_decrease, false, true, dayObservationLaw); // Initialisation //--------------- if (dayNightEvent.g(new SpacecraftState(initialOrbit)) >= 0) { // initial position is in daytime attitudesSequence.resetActiveProvider(dayObservationLaw); System.out .println("# " + (initialDate.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " begin with day law"); } else { // initial position is in nighttime attitudesSequence.resetActiveProvider(nightRestingLaw); System.out .println("# " + (initialDate.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " begin with night law"); } //---------------------- // Propagator definition //---------------------- // Propagator : consider the analytical Eckstein-Hechler model final Propagator propagator = new EcksteinHechlerPropagator(initialOrbit, attitudesSequence, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60); // Register the switching events to the propagator attitudesSequence.registerSwitchEvents(propagator); propagator.setMasterMode(10.0, new OrekitFixedStepHandler() { private DecimalFormat f1 = new DecimalFormat("0.0000000000000000E00", new DecimalFormatSymbols(Locale.US)); private Vector3DFormat f2 = new Vector3DFormat(" ", " ", " ", f1); private PVCoordinatesProvider sun = CelestialBodyFactory.getSun(); private PVCoordinatesProvider moon = CelestialBodyFactory.getMoon(); private Frame eme2000 = FramesFactory.getEME2000(); private Frame itrf2005 = FramesFactory.getITRF(IERSConventions.IERS_2010, true); private String printVector3D(final String name, final Vector3D v) { return name + " " + f2.format(v); } private String printRotation(final String name, final Rotation r) { return name + " " + f1.format(r.getQ1()) + " " + f1.format(r.getQ2()) + " " + f1.format(r.getQ3()) + " " + f1.format(r.getQ0()); } private String printRotation2(final String name, final Rotation r) { return name + " " + f1.format(-r.getQ1()) + " " + f1.format(-r.getQ2()) + " " + f1.format(-r.getQ3()) + " " + f1.format(-r.getQ0()); } public void init(final SpacecraftState s0, final AbsoluteDate t) { } public void handleStep(SpacecraftState currentState, boolean isLast) throws PropagationException { try { // the Earth position in spacecraft should be along spacecraft Z axis // during nigthtime and away from it during daytime due to roll and pitch offsets final Vector3D earth = currentState.toTransform().transformPosition(Vector3D.ZERO); final double pointingOffset = Vector3D.angle(earth, Vector3D.PLUS_K); // the g function is the eclipse indicator, its an angle between Sun and Earth limb, // positive when Sun is outside of Earth limb, negative when Sun is hidden by Earth limb final double eclipseAngle = dayNightEvent.g(currentState); final double endNightDayTimer1 = endNightDayRdV1Event_decrease.g(currentState); final double endNightDayTimer2 = endNightDayRdV2Event_decrease.g(currentState); final double endDayNightTimer1 = endDayNightRdV1Event_decrease.g(currentState); final double endDayNightTimer2 = endDayNightRdV2Event_decrease.g(currentState); output.add(currentState.getDate() + " " + FastMath.toDegrees(eclipseAngle) + " " + endNightDayTimer1 + " " + endNightDayTimer2 + " " + endDayNightTimer1 + " " + endDayNightTimer2 + " " + FastMath.toDegrees(pointingOffset)); final AbsoluteDate date = currentState.getDate(); final PVCoordinates pv = currentState.getPVCoordinates(eme2000); final Rotation lvlhRot = new Rotation(pv.getPosition(), pv.getMomentum(), Vector3D.MINUS_K, Vector3D.MINUS_J); final Rotation earthRot = eme2000.getTransformTo(itrf2005, date).getRotation(); System.out.println("Scenario::setVectorMap 0x960b7e0 " + (date.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " " + printVector3D("sun", sun.getPVCoordinates(date, eme2000).getPosition()) + " " + printVector3D("moon", moon.getPVCoordinates(date, eme2000).getPosition()) + " " + printVector3D("satPos", pv.getPosition()) + " " + printVector3D("satVel", pv.getVelocity()) + " " + printVector3D("orbMom", pv.getMomentum())); System.out.println("Scenario::setQuatMap 0x960b7e0 " + (date.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " " + printRotation("earthFrame", earthRot) + " " + printRotation("LVLHFrame", lvlhRot)); System.out.println("Scenario::computeStep 0x960b7e0 " + (date.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY)); System.out.println(" -> " + printRotation2("", currentState.getAttitude().getRotation()) + " " + printVector3D("", currentState.getAttitude().getSpin())); } catch (OrekitException oe) { throw new PropagationException(oe); } } }); //---------- // Propagate //---------- // Propagate from the initial date for the fixed duration propagator.propagate(initialDate.shiftedBy(1.75 * 3600.)); //-------------- // Print results //-------------- // we print the lines according to lexicographic order, which is chronological order here // to make sure out of orders calls between step handler and event handlers don't mess things up for (final String line : output) { System.out.println(line); } } catch (OrekitException oe) { System.err.println(oe.getMessage()); } }
From source file:fr.cs.examples.attitude.EarthObservation_day_night_switch_with_fixed_transitions.java
/** Program entry point. * @param args program arguments (unused here) *///from w w w .ja v a2s.c o m public static void main(String[] args) { try { // configure Orekit Autoconfiguration.configureOrekit(); final SortedSet<String> output = new TreeSet<String>(); //---------------------------------------- // Initial state definition : date, orbit //---------------------------------------- final AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 02, 00, 00, 00.000, TimeScalesFactory.getUTC()); final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680); final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231); final Orbit initialOrbit = new KeplerianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initialDate, Constants.EIGEN5C_EARTH_MU); //------------------------------ // Attitudes sequence definition //------------------------------ final AttitudesSequence attitudesSequence = new AttitudesSequence(); // Attitude laws definition //------------------------- // Mode : day final AttitudeProvider dayObservationLaw = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(20), FastMath.toRadians(40), 0); // Mode : night final AttitudeProvider nightRestingLaw = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH); // Mode : day-night rdv 1 final AttitudeProvider dayNightRdV1Law = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(20), FastMath.toRadians(20), 0); // Mode : day-night rdv 2 final AttitudeProvider dayNightRdV2Law = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(20), 0, 0); // Mode : night-day rdv 1 final AttitudeProvider nightDayRdV1Law = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(20), 0, 0); // Mode : night-day rdv 2 final AttitudeProvider nightDayRdV2Law = new LofOffset(initialOrbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(20), FastMath.toRadians(20), 0); // Event detectors definition //--------------------------- final PVCoordinatesProvider sun = CelestialBodyFactory.getSun(); final PVCoordinatesProvider earth = CelestialBodyFactory.getEarth(); // Detectors : end day-night rdv 2 final DateDetector endDayNightRdV2Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to night law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-2 night-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endDayNightRdV2Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to night law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-2 night-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detectors : end day-night rdv 1 final DateDetector endDayNightRdV1Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to day-night rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-1 day-night-rdv2-mode"); endDayNightRdV2Event_increase.addEventDate(s.getDate().shiftedBy(20)); endDayNightRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(20)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endDayNightRdV1Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to day-night rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-day-night-1 day-night-rdv2-mode"); endDayNightRdV2Event_increase.addEventDate(s.getDate().shiftedBy(20)); endDayNightRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(20)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detector : eclipse entry final EventDetector dayNightEvent = new EclipseDetector(sun, 696000000., earth, Constants.WGS84_EARTH_EQUATORIAL_RADIUS).withHandler(new EventHandler<EclipseDetector>() { public Action eventOccurred(final SpacecraftState s, final EclipseDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to day-night rdv 1 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " eclipse-entry day-night-rdv1-mode"); endDayNightRdV1Event_increase.addEventDate(s.getDate().shiftedBy(40)); endDayNightRdV1Event_decrease.addEventDate(s.getDate().shiftedBy(40)); } return Action.CONTINUE; } public SpacecraftState resetState(EclipseDetector detector, SpacecraftState oldState) { return oldState; } }); // Detectors : end night-day rdv 2 final DateDetector endNightDayRdV2Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to day law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-2 day-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endNightDayRdV2Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to day law"); System.out.println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-2 day-mode"); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detectors : end night-day rdv 1 final DateDetector endNightDayRdV1Event_increase = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to night-day rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-1 night-day-rdv2-mode"); endNightDayRdV2Event_increase.addEventDate(s.getDate().shiftedBy(40)); endNightDayRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(40)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); final DateDetector endNightDayRdV1Event_decrease = new DateDetector(10, 1e-04) .withHandler(new EventHandler<DateDetector>() { public Action eventOccurred(final SpacecraftState s, final DateDetector detector, final boolean increasing) { if (!increasing) { output.add(s.getDate() + ": switching to night-day rdv 2 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " end-night-day-1 night-day-rdv2-mode"); endNightDayRdV2Event_increase.addEventDate(s.getDate().shiftedBy(40)); endNightDayRdV2Event_decrease.addEventDate(s.getDate().shiftedBy(40)); } return Action.CONTINUE; } public SpacecraftState resetState(DateDetector detector, SpacecraftState oldState) { return oldState; } }); // Detector : eclipse exit final EventDetector nightDayEvent = new EclipseDetector(sun, 696000000., earth, Constants.WGS84_EARTH_EQUATORIAL_RADIUS).withHandler(new EventHandler<EclipseDetector>() { public Action eventOccurred(final SpacecraftState s, final EclipseDetector detector, final boolean increasing) { if (increasing) { output.add(s.getDate() + ": switching to night-day rdv 1 law"); System.out .println("# " + (s.getDate().durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " eclipse-exit night-day-rdv1-mode"); endNightDayRdV1Event_increase.addEventDate(s.getDate().shiftedBy(20)); endNightDayRdV1Event_decrease.addEventDate(s.getDate().shiftedBy(20)); } return Action.CONTINUE; } public SpacecraftState resetState(EclipseDetector detector, SpacecraftState oldState) { return oldState; } }); // Attitude sequences definition //------------------------------ attitudesSequence.addSwitchingCondition(dayObservationLaw, dayNightEvent, false, true, dayNightRdV1Law); attitudesSequence.addSwitchingCondition(dayNightRdV1Law, endDayNightRdV1Event_increase, true, false, dayNightRdV2Law); attitudesSequence.addSwitchingCondition(dayNightRdV1Law, endDayNightRdV1Event_decrease, false, true, dayNightRdV2Law); attitudesSequence.addSwitchingCondition(dayNightRdV2Law, endDayNightRdV2Event_increase, true, false, nightRestingLaw); attitudesSequence.addSwitchingCondition(dayNightRdV2Law, endDayNightRdV2Event_decrease, false, true, nightRestingLaw); attitudesSequence.addSwitchingCondition(nightRestingLaw, nightDayEvent, true, false, nightDayRdV1Law); attitudesSequence.addSwitchingCondition(nightDayRdV1Law, endNightDayRdV1Event_increase, true, false, nightDayRdV2Law); attitudesSequence.addSwitchingCondition(nightDayRdV1Law, endNightDayRdV1Event_decrease, false, true, nightDayRdV2Law); attitudesSequence.addSwitchingCondition(nightDayRdV2Law, endNightDayRdV2Event_increase, true, false, dayObservationLaw); attitudesSequence.addSwitchingCondition(nightDayRdV2Law, endNightDayRdV2Event_decrease, false, true, dayObservationLaw); // Initialisation //--------------- if (dayNightEvent.g(new SpacecraftState(initialOrbit)) >= 0) { // initial position is in daytime attitudesSequence.resetActiveProvider(dayObservationLaw); System.out .println("# " + (initialDate.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " begin with day law"); } else { // initial position is in nighttime attitudesSequence.resetActiveProvider(nightRestingLaw); System.out .println("# " + (initialDate.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " begin with night law"); } //---------------------- // Propagator definition //---------------------- // Propagator : consider the analytical Eckstein-Hechler model final Propagator propagator = new EcksteinHechlerPropagator(initialOrbit, attitudesSequence, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60); // Register the switching events to the propagator attitudesSequence.registerSwitchEvents(propagator); propagator.setMasterMode(10.0, new OrekitFixedStepHandler() { private DecimalFormat f1 = new DecimalFormat("0.0000000000000000E00", new DecimalFormatSymbols(Locale.US)); private Vector3DFormat f2 = new Vector3DFormat(" ", " ", " ", f1); private PVCoordinatesProvider sun = CelestialBodyFactory.getSun(); private PVCoordinatesProvider moon = CelestialBodyFactory.getMoon(); private Frame eme2000 = FramesFactory.getEME2000(); private Frame itrf2005 = FramesFactory.getITRF(IERSConventions.IERS_2010, true); private String printVector3D(final String name, final Vector3D v) { return name + " " + f2.format(v); } private String printRotation(final String name, final Rotation r) { return name + " " + f1.format(r.getQ1()) + " " + f1.format(r.getQ2()) + " " + f1.format(r.getQ3()) + " " + f1.format(r.getQ0()); } private String printRotation2(final String name, final Rotation r) { return name + " " + f1.format(-r.getQ1()) + " " + f1.format(-r.getQ2()) + " " + f1.format(-r.getQ3()) + " " + f1.format(-r.getQ0()); } public void init(final SpacecraftState s0, final AbsoluteDate t) { } public void handleStep(SpacecraftState currentState, boolean isLast) throws PropagationException { try { // the Earth position in spacecraft should be along spacecraft Z axis // during nigthtime and away from it during daytime due to roll and pitch offsets final Vector3D earth = currentState.toTransform().transformPosition(Vector3D.ZERO); final double pointingOffset = Vector3D.angle(earth, Vector3D.PLUS_K); // the g function is the eclipse indicator, its an angle between Sun and Earth limb, // positive when Sun is outside of Earth limb, negative when Sun is hidden by Earth limb final double eclipseAngle = dayNightEvent.g(currentState); final double endNightDayTimer1 = endNightDayRdV1Event_decrease.g(currentState); final double endNightDayTimer2 = endNightDayRdV2Event_decrease.g(currentState); final double endDayNightTimer1 = endDayNightRdV1Event_decrease.g(currentState); final double endDayNightTimer2 = endDayNightRdV2Event_decrease.g(currentState); output.add(currentState.getDate() + " " + FastMath.toDegrees(eclipseAngle) + " " + endNightDayTimer1 + " " + endNightDayTimer2 + " " + endDayNightTimer1 + " " + endDayNightTimer2 + " " + FastMath.toDegrees(pointingOffset)); final AbsoluteDate date = currentState.getDate(); final PVCoordinates pv = currentState.getPVCoordinates(eme2000); final Rotation lvlhRot = new Rotation(pv.getPosition(), pv.getMomentum(), Vector3D.MINUS_K, Vector3D.MINUS_J); final Rotation earthRot = eme2000.getTransformTo(itrf2005, date).getRotation(); System.out.println("Scenario::setVectorMap 0x960b7e0 " + (date.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " " + printVector3D("sun", sun.getPVCoordinates(date, eme2000).getPosition()) + " " + printVector3D("moon", moon.getPVCoordinates(date, eme2000).getPosition()) + " " + printVector3D("satPos", pv.getPosition()) + " " + printVector3D("satVel", pv.getVelocity()) + " " + printVector3D("orbMom", pv.getMomentum())); System.out.println("Scenario::setQuatMap 0x960b7e0 " + (date.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY) + " " + printRotation("earthFrame", earthRot) + " " + printRotation("LVLHFrame", lvlhRot)); System.out.println("Scenario::computeStep 0x960b7e0 " + (date.durationFrom(AbsoluteDate.J2000_EPOCH) / Constants.JULIAN_DAY)); System.out.println(" -> " + printRotation2("", currentState.getAttitude().getRotation()) + " " + printVector3D("", currentState.getAttitude().getSpin())); } catch (OrekitException oe) { throw new PropagationException(oe); } } }); //---------- // Propagate //---------- // Propagate from the initial date for the fixed duration propagator.propagate(initialDate.shiftedBy(1.75 * 3600.)); //-------------- // Print results //-------------- // we print the lines according to lexicographic order, which is chronological order here // to make sure out of orders calls between step handler and event handlers don't mess things up for (final String line : output) { System.out.println(line); } } catch (OrekitException oe) { System.err.println(oe.getMessage()); } }
From source file:nova.core.wrapper.mc.forge.v17.wrapper.entity.forward.MCEntityTransform.java
@Override public Rotation rotation() { return new Rotation(RotationUtil.DEFAULT_ORDER, -Math.toRadians(wrapper.rotationYaw) - Math.PI, -Math.toRadians(wrapper.rotationPitch), 0); }
From source file:org.jtrfp.trcl.beh.CubeCollisionBehavior.java
@Override public void proposeCollision(WorldObject obj) { if (obj instanceof Player) { final WorldObject p = getParent(); final double[] relPos = TR.twosComplimentSubtract(obj.getPosition(), p.getPosition(), new double[3]); final Rotation rot = new Rotation(Vector3D.PLUS_K, Vector3D.PLUS_J, p.getHeading(), p.getTop()); final double[] rotPos = rot.applyInverseTo(new Vector3D(relPos)).toArray(); final double[] rotTransPos = Vect3D.add(rotPos, origin, rotTransPosVar); if (TR.twosComplimentDistance(obj.getPosition(), p.getPosition()) < 80000) if (rotTransPos[0] > 0 && rotTransPos[0] < dims[0] && rotTransPos[1] > 0 && rotTransPos[1] < dims[1] && rotTransPos[2] > 0 && rotTransPos[2] < dims[2]) { obj.probeForBehaviors(new AbstractSubmitter<DamageableBehavior>() { @Override/*from w w w . ja va2 s.c om*/ public void submit(DamageableBehavior item) { item.proposeDamage(new GroundCollisionDamage(damageOnImpact)); } }, DamageableBehavior.class); } //end if(withinRange) } //end if(Player) }
From source file:org.jtrfp.trcl.beh.ProjectileFiringBehavior.java
@Override public void _tick(long tickTimeMillis) { if (tickTimeMillis > timeWhenNextFiringPermittedMillis && pendingFiring) { if (takeAmmo()) { final WorldObject p = getParent(); Vector3D heading = this.firingHeading; if (this.firingHeading == null) heading = p.getHeading(); for (int mi = 0; mi < multiplexLevel; mi++) { final Vector3D firingPosition = new Rotation(Vector3D.PLUS_K, Vector3D.PLUS_J, heading, p.getTop()).applyTo(getNextFiringPosition()); resetFiringTimer();//from www. j a v a2 s . c o m projectileFactory.fire( Vect3D.add(p.getPositionWithOffset(), firingPosition.toArray(), new double[3]), heading, getParent()); } //for(multiplex) heading = p.getHeading(); } //end if(ammo) pendingFiring = false; } //end timeWhenNextfiringPermitted }
From source file:org.orekit.attitudes.CelestialBodyPointed.java
/** {@inheritDoc} */ public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException { final PVCoordinates satPV = pvProv.getPVCoordinates(date, celestialFrame); // compute celestial references at the specified date final PVCoordinates bodyPV = pointedBody.getPVCoordinates(date, celestialFrame); final PVCoordinates pointing = new PVCoordinates(satPV, bodyPV); final Vector3D pointingP = pointing.getPosition(); final double r2 = Vector3D.dotProduct(pointingP, pointingP); // evaluate instant rotation axis due to sat and body motion only (no phasing yet) final Vector3D rotAxisCel = new Vector3D(1 / r2, Vector3D.crossProduct(pointingP, pointing.getVelocity())); // fix instant rotation to take phasing constraint into account // (adding a rotation around pointing axis ensuring the motion of the phasing axis // is constrained in the pointing-phasing plane) final Vector3D v1 = Vector3D.crossProduct(rotAxisCel, phasingCel); final Vector3D v2 = Vector3D.crossProduct(pointingP, phasingCel); final double compensation = -Vector3D.dotProduct(v1, v2) / v2.getNormSq(); final Vector3D phasedRotAxisCel = new Vector3D(1.0, rotAxisCel, compensation, pointingP); // compute transform from celestial frame to satellite frame final Rotation celToSatRotation = new Rotation(pointingP, phasingCel, pointingSat, phasingSat); // build transform combining rotation and instant rotation axis Transform transform = new Transform(date, celToSatRotation, celToSatRotation.applyTo(phasedRotAxisCel)); if (frame != celestialFrame) { // prepend transform from specified frame to celestial frame transform = new Transform(date, frame.getTransformTo(celestialFrame, date), transform); }//from www. j a v a 2 s . c o m // build the attitude return new Attitude(date, frame, transform.getRotation(), transform.getRotationRate(), transform.getRotationAcceleration()); }
From source file:org.orekit.attitudes.LofOffset.java
/** Creates new instance. * <p>// w ww .j av a2 s . c o m * An important thing to note is that the rotation order and angles signs used here * are compliant with an <em>attitude</em> definition, i.e. they correspond to * a frame that rotate in a field of fixed vectors. The underlying definitions used * in commons-math {@link org.apache.commons.math3.geometry.euclidean.threed.Rotation#Rotation(RotationOrder, * double, double, double) Rotation(RotationOrder, double, double, double)} use * <em>reversed</em> definition, i.e. they correspond to a vectors field rotating * with respect to a fixed frame. So to retrieve the angles provided here from the * commons-math underlying rotation, one has to <em>revert</em> the rotation, as in * the following code snippet: * </p> * <pre> * LofOffset law = new LofOffset(inertial, lofType, order, alpha1, alpha2, alpha3); * Rotation offsetAtt = law.getAttitude(orbit).getRotation(); * Rotation alignedAtt = new LofOffset(inertial, lofType).getAttitude(orbit).getRotation(); * Rotation offsetProper = offsetAtt.applyTo(alignedAtt.revert()); * * // note the call to revert in the following statement * double[] angles = offsetProper.revert().getAngles(order); * * System.out.println(alpha1 + " == " + angles[0]); * System.out.println(alpha2 + " == " + angles[1]); * System.out.println(alpha3 + " == " + angles[2]); * </pre> * @param inertialFrame inertial frame with respect to which orbit should be computed * @param type type of Local Orbital Frame * @param order order of rotations to use for (alpha1, alpha2, alpha3) composition * @param alpha1 angle of the first elementary rotation * @param alpha2 angle of the second elementary rotation * @param alpha3 angle of the third elementary rotation * @exception OrekitException if inertialFrame is not a pseudo-inertial frame */ public LofOffset(final Frame inertialFrame, final LOFType type, final RotationOrder order, final double alpha1, final double alpha2, final double alpha3) throws OrekitException { this.type = type; this.offset = new Rotation(order, alpha1, alpha2, alpha3).revert(); if (!inertialFrame.isPseudoInertial()) { throw new OrekitException(OrekitMessages.NON_PSEUDO_INERTIAL_FRAME, inertialFrame.getName()); } this.inertialFrame = inertialFrame; }
From source file:org.orekit.forces.maneuvers.ImpulseManeuverTest.java
@Test public void testInertialManeuver() throws OrekitException { final double mu = CelestialBodyFactory.getEarth().getGM(); final double initialX = 7100e3; final double initialY = 0.0; final double initialZ = 1300e3; final double initialVx = 0; final double initialVy = 8000; final double initialVz = 1000; final Vector3D position = new Vector3D(initialX, initialY, initialZ); final Vector3D velocity = new Vector3D(initialVx, initialVy, initialVz); final AbsoluteDate epoch = new AbsoluteDate(2010, 1, 1, 0, 0, 0, TimeScalesFactory.getUTC()); final TimeStampedPVCoordinates state = new TimeStampedPVCoordinates(epoch, position, velocity, Vector3D.ZERO);//from w w w . ja v a 2s . c o m final Orbit initialOrbit = new CartesianOrbit(state, FramesFactory.getEME2000(), mu); final double totalPropagationTime = 0.00001; final double driftTimeInSec = totalPropagationTime / 2.0; final double deltaX = 0.01; final double deltaY = 0.02; final double deltaZ = 0.03; final double isp = 300; final Vector3D deltaV = new Vector3D(deltaX, deltaY, deltaZ); KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC)); DateDetector dateDetector = new DateDetector(epoch.shiftedBy(driftTimeInSec)); InertialProvider attitudeOverride = new InertialProvider(new Rotation(RotationOrder.XYX, 0, 0, 0)); ImpulseManeuver<DateDetector> burnAtEpoch = new ImpulseManeuver<DateDetector>(dateDetector, attitudeOverride, deltaV, isp).withThreshold(driftTimeInSec / 4); propagator.addEventDetector(burnAtEpoch); SpacecraftState finalState = propagator.propagate(epoch.shiftedBy(totalPropagationTime)); final double finalVxExpected = initialVx + deltaX; final double finalVyExpected = initialVy + deltaY; final double finalVzExpected = initialVz + deltaZ; final double maneuverTolerance = 1e-4; final Vector3D finalVelocity = finalState.getPVCoordinates().getVelocity(); Assert.assertEquals(finalVxExpected, finalVelocity.getX(), maneuverTolerance); Assert.assertEquals(finalVyExpected, finalVelocity.getY(), maneuverTolerance); Assert.assertEquals(finalVzExpected, finalVelocity.getZ(), maneuverTolerance); }