Hi Orekit community, I am new to Orekit and have been trying to learn it over the last couple days. I am having trouble understanding how the ‘FieldOfViewDetector’ is suppose to work. What I want to accomplish is to see if a Satellite can determine if a gps position on the earth’s surface is within its field of view for some detector/camera. I’m having trouble figuring out how to place the event detector so that it sits with the satellite frame and triggers when contacting the Topocentric frame.
I’m unsure If I am approaching this issue correctly, I’m still very new, any help/guidance/criticism is welcome.
Thank you for any help you can offer. I will gladly create a tutorial of what we build for the community! Here is my current code/thoughts.
//create orbit
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);
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
Frame inertialFrame = FramesFactory.getEME2000();
double mu = 3.986004415e+14;
Orbit initialOrbit = new KeplerianOrbit(pvCoordinates, inertialFrame, initialDate, mu);
//create gps point on earth frame
double longitude = FastMath.toRadians(45.);
double latitude = FastMath.toRadians(25.);
double altitude = 0.;
GeodeticPoint earthPoint = new GeodeticPoint(latitude, longitude, altitude);
Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, earthFrame);
TopocentricFrame myHouseFrame = new TopocentricFrame(earth, earthPoint, "MyHouse");
//set field of view for camera
Vector3D cameraDirection = new Vector3D(0,0,1);
FieldOfView fov = new CircularFieldOfView(cameraPossition, FastMath.toRadians(180), FastMath.toRadians(30));
FieldOfViewDetector eventDetector = new FieldOfViewDetector(myHouseFrame, fov);
//what do I do here??
eventDetector.withHandler((s, detector, increasing) -> {
System.out.println(" Visibility on MyHouse" +
(increasing ? " begins at " : " ends at ") +
s.getDate());
return increasing ? Action.CONTINUE : Action.STOP;
});
//set propagator//attitude
NadirPointing nadirLaw = new NadirPointing(inertialFrame, earth);
Propagator propagator =
new EcksteinHechlerPropagator(initialOrbit, nadirLaw,
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);
//Add event detector to propagator
propagator.addEventDetector(eventDetector);
//propagate
SpacecraftState finalState = propagator.propagate(new AbsoluteDate(initialDate, 1500.));