use of org.orekit.frames.TopocentricFrame in project Orekit by CS-SI.
the class VisibilityCheck method main.
/**
* Program entry point.
* @param args program arguments (unused here)
*/
public static void main(String[] args) {
try {
// configure Orekit
File home = new File(System.getProperty("user.home"));
File orekitData = new File(home, "orekit-data");
if (!orekitData.exists()) {
System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
System.exit(1);
}
DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new DirectoryCrawler(orekitData));
// Initial state definition : date, orbit
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
// gravitation coefficient
double mu = 3.986004415e+14;
// inertial frame for orbit definition
Frame inertialFrame = FramesFactory.getEME2000();
Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
PVCoordinates pvCoordinates = new PVCoordinates(position, velocity);
Orbit initialOrbit = new KeplerianOrbit(pvCoordinates, inertialFrame, initialDate, mu);
// Propagator : consider a simple Keplerian motion (could be more elaborate)
Propagator kepler = new KeplerianPropagator(initialOrbit);
// Earth and frame
Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, earthFrame);
// Station
final double longitude = FastMath.toRadians(45.);
final double latitude = FastMath.toRadians(25.);
final double altitude = 0.;
final GeodeticPoint station1 = new GeodeticPoint(latitude, longitude, altitude);
final TopocentricFrame sta1Frame = new TopocentricFrame(earth, station1, "station1");
// Event definition
final double maxcheck = 60.0;
final double threshold = 0.001;
final double elevation = FastMath.toRadians(5.0);
final EventDetector sta1Visi = new ElevationDetector(maxcheck, threshold, sta1Frame).withConstantElevation(elevation).withHandler(new VisibilityHandler());
// Add event to be detected
kepler.addEventDetector(sta1Visi);
// Propagate from the initial date to the first raising or for the fixed duration
SpacecraftState finalState = kepler.propagate(initialDate.shiftedBy(1500.));
System.out.println(" Final state : " + finalState.getDate().durationFrom(initialDate));
} catch (OrekitException oe) {
System.err.println(oe.getMessage());
}
}
use of org.orekit.frames.TopocentricFrame in project Orekit by CS-SI.
the class VisibilityCircle method computeCircle.
private static List<GeodeticPoint> computeCircle(double latitude, double longitude, double altitude, String name, double minElevation, double radius, int points) throws OrekitException {
// define Earth shape, using WGS84 model
BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, false));
// define an array of ground stations
TopocentricFrame station = new TopocentricFrame(earth, new GeodeticPoint(latitude, longitude, altitude), name);
// compute the visibility circle
List<GeodeticPoint> circle = new ArrayList<GeodeticPoint>();
for (int i = 0; i < points; ++i) {
double azimuth = i * (2.0 * FastMath.PI / points);
circle.add(station.computeLimitVisibilityPoint(radius, azimuth, minElevation));
}
// return the computed points
return circle;
}
Aggregations