TargetPointing.java

  1. /* Copyright 2002-2013 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.attitudes;

  18. import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
  19. import org.orekit.bodies.BodyShape;
  20. import org.orekit.bodies.GeodeticPoint;
  21. import org.orekit.errors.OrekitException;
  22. import org.orekit.frames.Frame;
  23. import org.orekit.time.AbsoluteDate;
  24. import org.orekit.utils.PVCoordinates;
  25. import org.orekit.utils.PVCoordinatesProvider;



  26. /**
  27.  * This class handles target pointing attitude provider.

  28.  * <p>
  29.  * This class represents the attitude provider where the satellite z axis is
  30.  * pointing to a ground point target.</p>
  31.  * <p>
  32.  * The target position is defined in a body frame specified by the user.
  33.  * It is important to make sure this frame is consistent.
  34.  * </p>
  35.  * <p>
  36.  * The object <code>TargetPointing</code> is guaranteed to be immutable.
  37.  * </p>
  38.  * @see     GroundPointing
  39.  * @author V&eacute;ronique Pommier-Maurussane
  40.  */
  41. public class TargetPointing extends GroundPointing {

  42.     /** Serializable UID. */
  43.     private static final long serialVersionUID = -8002434923471977301L;

  44.     /** Target in body frame. */
  45.     private final PVCoordinates target;


  46.     /** Creates a new instance from body frame and target expressed in cartesian coordinates.
  47.      * @param bodyFrame body frame.
  48.      * @param target target position in body frame
  49.      */
  50.     public TargetPointing(final Frame bodyFrame, final Vector3D target) {
  51.         super(bodyFrame);
  52.         this.target = new PVCoordinates(target, Vector3D.ZERO);
  53.     }

  54.     /** Creates a new instance from body shape and target expressed in geodetic coordinates.
  55.      * @param targetGeo target defined as a geodetic point in body shape frame
  56.      * @param shape body shape
  57.      */
  58.     public TargetPointing(final GeodeticPoint targetGeo, final BodyShape shape) {
  59.         super(shape.getBodyFrame());
  60.         // Transform target from geodetic coordinates to position-velocity coordinates
  61.         target = new PVCoordinates(shape.transform(targetGeo), Vector3D.ZERO);
  62.     }

  63.     /** {@inheritDoc} */
  64.     protected Vector3D getTargetPoint(final PVCoordinatesProvider pvProv,
  65.                                       final AbsoluteDate date, final Frame frame)
  66.         throws OrekitException {
  67.         return getBodyFrame().getTransformTo(frame, date).transformPosition(target.getPosition());
  68.     }

  69.     /** {@inheritDoc} */
  70.     @Override
  71.     protected PVCoordinates getTargetPV(final PVCoordinatesProvider pvProv,
  72.                                         final AbsoluteDate date, final Frame frame)
  73.         throws OrekitException {
  74.         return getBodyFrame().getTransformTo(frame, date).transformPVCoordinates(target);
  75.     }

  76. }