Fix jwst pointing event

This commit is contained in:
Malin E
2022-04-19 11:26:57 +02:00
parent 3e81092c68
commit 1b25e1b0dc

View File

@@ -50,6 +50,8 @@ local point_jwst = {
local D0 = math.rad(27.1284)
-- Galactic longitude of the equatorial north pole
local L0 = math.rad(122.9320)
-- distance = 9.2E15 m (set to size of view sphere)
local distance = 9.2E15
-- (Ra, Dec) -> (a, d)
local a = math.rad(ra)
@@ -64,9 +66,9 @@ local point_jwst = {
-- Convert to cartesian
local rGalactic = {
math.cos(b) * math.cos(l),
math.cos(b) * math.sin(l),
math.sin(b)
distance * math.cos(b) * math.cos(l),
distance * math.cos(b) * math.sin(l),
distance * math.sin(b)
}
return rGalactic
@@ -103,11 +105,9 @@ local point_jwst = {
end
local coordinates = convertRaDec(ra, dec)
local JWSTPosition = openspace.worldPosition('JWSTModel')
local JWSTRotation = openspace.worldRotation('JWSTRotation')
openspace.printInfo(JWSTPosition)
openspace.printInfo(JWSTRotation)
local JWSTtoCoord = {
coordinates[1] - JWSTPosition[1],
coordinates[2] - JWSTPosition[2],
@@ -117,11 +117,6 @@ local point_jwst = {
local JWSTtoCoordRotated = applyMatrix(JWSTRotation, JWSTtoCoord)
local JWSTAngles = calculateJWSTAngles(JWSTtoCoordRotated)
-- Check non 0
if JWSTAngles[1] == 0 and JWSTAngles[2] == 0 then
return
end
-- Check if the new angle violate the sunshield
-- -45 deg to 5 deg is valid in x rotation
if JWSTAngles[1] < math.rad(-45) or JWSTAngles[1] > math.rad(5) then