From 56c2d4d07a2f8a32db46fda2b02a3e4c7486b6ad Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Fri, 20 Sep 2024 11:50:58 +0200 Subject: [PATCH] Separate JWST asset into multiple assets and avoid specifying timestamps in multiple files --- .../telescopes/jwst/fieldofview.asset | 58 +++++++ .../solarsystem/telescopes/jwst/jwst.asset | 162 +----------------- .../solarsystem/telescopes/jwst/label.asset | 48 ++++++ .../solarsystem/telescopes/jwst/model.asset | 63 +++++++ .../solarsystem/telescopes/jwst/trail.asset | 36 ++-- .../telescopes/jwst/transforms.asset | 3 + .../telescopes/jwst/viewingband.asset | 68 ++++++++ 7 files changed, 263 insertions(+), 175 deletions(-) create mode 100644 data/assets/scene/solarsystem/telescopes/jwst/fieldofview.asset create mode 100644 data/assets/scene/solarsystem/telescopes/jwst/label.asset create mode 100644 data/assets/scene/solarsystem/telescopes/jwst/model.asset create mode 100644 data/assets/scene/solarsystem/telescopes/jwst/viewingband.asset diff --git a/data/assets/scene/solarsystem/telescopes/jwst/fieldofview.asset b/data/assets/scene/solarsystem/telescopes/jwst/fieldofview.asset new file mode 100644 index 0000000000..8d5364b01d --- /dev/null +++ b/data/assets/scene/solarsystem/telescopes/jwst/fieldofview.asset @@ -0,0 +1,58 @@ +local transforms = asset.require("./transforms") +local model = asset.require("./model") + + + +local JWSTFov = { + Identifier = "JWSTFov", + Parent = model.JWSTModel.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = transforms.LaunchTime + }, + Renderable = { + Type = "RenderablePrism", + Segments = 6, + Lines = 3, + Radius = 3.25, + LineWidth = 1.0, + Color = { 1.0, 1.0, 1.0 }, + Length = 9.2E15 + }, + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = { 0, 0, math.rad(30) } + } + }, + Tag = { "mission_jwst_fov" }, + GUI = { + Name = "JWST Field of View", + Path = "/Solar System/Telescopes/JWST", + Description = [[ + The field of view for the James Webb Space Telescope at its current position. + ]] + } +} + +asset.onInitialize(function() + openspace.addSceneGraphNode(JWSTFov) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(JWSTFov) +end) + +asset.export(JWSTFov) + + + +asset.meta = { + Name = "JWST Field of View", + Description = [[ + The field of view for the James Webb Space Telescope at its current position. + ]], + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/telescopes/jwst/jwst.asset b/data/assets/scene/solarsystem/telescopes/jwst/jwst.asset index ceaf3717e7..1a50a4885d 100644 --- a/data/assets/scene/solarsystem/telescopes/jwst/jwst.asset +++ b/data/assets/scene/solarsystem/telescopes/jwst/jwst.asset @@ -1,176 +1,26 @@ asset.require("./actions") +asset.require("./fieldofview") +asset.require("./label") asset.require("./mission") -local sunTransforms = asset.require("scene/solarsystem/sun/transforms") -local transforms = asset.require("./transforms") +asset.require("./model") +asset.require("./viewingband") -local models = asset.resource({ - Name = "JWST Model", - Type = "HttpSynchronization", - Identifier = "jwst_model", - Version = 3 -}) - -local band = asset.resource({ - Name = "JWST band texture", - Type = "HttpSynchronization", - Identifier = "jwst_band_texture", - Version = 1 -}) - - -local LaunchTime = "2021 DEC 25 12:20:00" - -local JWSTBand = { - Identifier = "JWSTBand", - Parent = transforms.JWSTPosition.Identifier, - TimeFrame = { - Type = "TimeFrameInterval", - Start = LaunchTime - }, - Transform = { - Rotation = { - Type = "FixedRotation", - Attached = "JWSTBand", - XAxis = { 1.0, 0.0, 0.0 }, - XAxisOrthogonal = true, - ZAxis = sunTransforms.SolarSystemBarycenter.Identifier - } - }, - Renderable = { - Type = "RenderableSphereImageLocal", - Texture = band .. "JWST-band.png", - Size = 9.2E15, - Segments = 50, - DisableFadeInOut = true, - Orientation = "Inside", - Opacity = 0.05 - }, - Tag = { "mission_jwst_fov" }, - GUI = { - Name = "JWST Safe Viewing Band", - Path = "/Solar System/Telescopes/JWST", - Description = [[ - The safe viewing band for the James Webb Space Telescope at its current position - ]] - } -} - -local JWSTModel = { - Identifier = "JWSTModel", - Parent = transforms.JWSTRotation.Identifier, - TimeFrame = { - Type = "TimeFrameInterval", - Start = LaunchTime - }, - Renderable = { - Type = "RenderableModel", - GeometryFile = models .. "jwst_anim74_2fps_2018_nb.osmodel", - ModelScale = 0.0328, -- First scale down with centimeters then scale up with feet - EnableAnimation = true, - AnimationStartTime = "2021 12 25 12:20:00", - AnimationTimeScale = "Millisecond", - AnimationMode = "Once", - LightSources = { - sunTransforms.LightSource - }, - PerformShading = true - }, - GUI = { - Name = "James Webb Space Telescope Model", - Path = "/Solar System/Telescopes/JWST", - Description = [[ - Animated model of the James Webb Space Telescope that shows its deployment in - real time - ]] - } -} - -local JWSTFov = { - Identifier = "JWSTFov", - Parent = JWSTModel.Identifier, - TimeFrame = { - Type = "TimeFrameInterval", - Start = LaunchTime - }, - Renderable = { - Type = "RenderablePrism", - Segments = 6, - Lines = 3, - Radius = 3.25, - LineWidth = 1.0, - Color = { 1.0, 1.0, 1.0 }, - Length = 9.2E15 - }, - Transform = { - Rotation = { - Type = "StaticRotation", - Rotation = { 0, 0, math.rad(30) } - } - }, - Tag = { "mission_jwst_fov" }, - GUI = { - Name = "JWST Field of View", - Path = "/Solar System/Telescopes/JWST", - Description = [[ - The field of view for the James Webb Space Telescope at its current position - ]] - } -} - -local JWSTLabel = { - Identifier = "JWSTLabel", - Parent = transforms.JWSTPosition.Identifier, - TimeFrame = { - Type = "TimeFrameInterval", - Start = LaunchTime - }, - Renderable = { - Type = "RenderableLabel", - Text = "JWST", - FontSize = 50, - Size = 6.5, - MinMaxSize = { 4.0, 30.0 }, - OrientationOption = "Camera View Direction", - BlendMode = "Normal", - EnableFading = false - }, - GUI = { - Name = "JWST Label", - Path = "/Solar System/Telescopes/JWST", - Description = "Main label for the James Webb Space Telescope" - } -} - - asset.onInitialize(function() - openspace.addSceneGraphNode(JWSTBand) - openspace.addSceneGraphNode(JWSTModel) - openspace.addSceneGraphNode(JWSTFov) - openspace.addSceneGraphNode(JWSTLabel) end) asset.onDeinitialize(function() - openspace.removeSceneGraphNode(JWSTLabel) - openspace.removeSceneGraphNode(JWSTFov) - openspace.removeSceneGraphNode(JWSTModel) - openspace.removeSceneGraphNode(JWSTBand) - openspace.scriptScheduler.clear(2) end) -asset.export(JWSTBand) -asset.export(JWSTModel) -asset.export(JWSTFov) -asset.export(JWSTLabel) - asset.meta = { Name = "James Webb Space Telescope", Description = [[ - James Webb Space Telescope animated model, safe viewing band, field of view and label. + This assets adds the content for the James Webb Space Telescope mission, including + the animated model, safe viewing band, field of view, label, mission file and actions. ]], Author = "OpenSpace Team", URL = "http://openspaceproject.com", diff --git a/data/assets/scene/solarsystem/telescopes/jwst/label.asset b/data/assets/scene/solarsystem/telescopes/jwst/label.asset new file mode 100644 index 0000000000..792b6909c2 --- /dev/null +++ b/data/assets/scene/solarsystem/telescopes/jwst/label.asset @@ -0,0 +1,48 @@ +local transforms = asset.require("./transforms") + + + +local JWSTLabel = { + Identifier = "JWSTLabel", + Parent = transforms.JWSTPosition.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = transforms.LaunchTime + }, + Renderable = { + Type = "RenderableLabel", + Text = "JWST", + FontSize = 50, + Size = 6.5, + MinMaxSize = { 4.0, 30.0 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = false + }, + GUI = { + Name = "JWST Label", + Path = "/Solar System/Telescopes/JWST", + Description = "Main label for the James Webb Space Telescope." + } +} + + +asset.onInitialize(function() + openspace.addSceneGraphNode(JWSTLabel) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(JWSTLabel) +end) + +asset.export(JWSTLabel) + + + +asset.meta = { + Name = "JWST Label", + Description = "Main label for the James Webb Space Telescope", + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/telescopes/jwst/model.asset b/data/assets/scene/solarsystem/telescopes/jwst/model.asset new file mode 100644 index 0000000000..088d60e1ab --- /dev/null +++ b/data/assets/scene/solarsystem/telescopes/jwst/model.asset @@ -0,0 +1,63 @@ +local sunTransforms = asset.require("scene/solarsystem/sun/transforms") +local transforms = asset.require("./transforms") + + + +local models = asset.resource({ + Name = "JWST Model", + Type = "HttpSynchronization", + Identifier = "jwst_model", + Version = 3 +}) + + +local JWSTModel = { + Identifier = "JWSTModel", + Parent = transforms.JWSTRotation.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = transforms.LaunchTime + }, + Renderable = { + Type = "RenderableModel", + Enabled = asset.enabled, + GeometryFile = models .. "jwst_anim74_2fps_2018_nb.osmodel", + ModelScale = 0.0328, -- First scale down with centimeters then scale up with feet + EnableAnimation = true, + AnimationStartTime = "2021 12 25 12:20:00", + AnimationTimeScale = "Millisecond", + AnimationMode = "Once", + LightSources = { + sunTransforms.LightSource + }, + PerformShading = true + }, + GUI = { + Name = "James Webb Space Telescope Model", + Path = "/Solar System/Telescopes/JWST", + Description = [[ + Animated model of the James Webb Space Telescope that shows its deployment in + real time. + ]] + } +} + +asset.onInitialize(function() + openspace.addSceneGraphNode(JWSTModel) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(JWSTModel) +end) + +asset.export(JWSTModel) + + + +asset.meta = { + Name = "James Webb Space Telescope Model", + Description = [[James Webb Space Telescope animated model.]], + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/telescopes/jwst/trail.asset b/data/assets/scene/solarsystem/telescopes/jwst/trail.asset index eccc987873..91b96c4ece 100644 --- a/data/assets/scene/solarsystem/telescopes/jwst/trail.asset +++ b/data/assets/scene/solarsystem/telescopes/jwst/trail.asset @@ -1,14 +1,12 @@ -local transforms = asset.require("scene/solarsystem/planets/earth/lagrange_points/l2") +local L2transforms = asset.require("scene/solarsystem/planets/earth/lagrange_points/l2") local earthTransforms = asset.require("scene/solarsystem/planets/earth/transforms") local sunTransforms = asset.require("scene/solarsystem/sun/transforms") local kernels = asset.require("./kernels") +local transforms = asset.require("./transforms") local coreKernels = asset.require("spice/core") -local LaunchTime = "2021 DEC 25 12:20:00" -local DetachTime = "2021 DEC 25 12:50:00" -local L2orbitInsertionTime = "2022 JAN 25 00:00:00" local EndTime = "2024 JAN 22 00:00:00" -- Trail of JWST relative the Earth Inertial for the first 30 minutes after launch @@ -18,8 +16,8 @@ local JWSTTrailLaunch = { Parent = earthTransforms.EarthIAU.Identifier, TimeFrame = { Type = "TimeFrameInterval", - Start = LaunchTime, - End = DetachTime + Start = transforms.LaunchTime, + End = transforms.DetachTime }, Renderable = { Type = "RenderableTrailTrajectory", @@ -30,8 +28,8 @@ local JWSTTrailLaunch = { Frame = coreKernels.Frame.Earth }, Color = { 0.9, 0.9, 0.0 }, - StartTime = LaunchTime, - EndTime = DetachTime, + StartTime = transforms.LaunchTime, + EndTime = transforms.DetachTime, SampleInterval = 60 -- Sample rate of once per minute }, GUI = { @@ -48,8 +46,8 @@ local JWSTTrailCruise = { Parent = earthTransforms.EarthCenter.Identifier, TimeFrame = { Type = "TimeFrameInterval", - Start = DetachTime, - End = L2orbitInsertionTime + Start = transforms.DetachTime, + End = transforms.L2orbitInsertionTime }, Renderable = { Type = "RenderableTrailTrajectory", @@ -60,8 +58,8 @@ local JWSTTrailCruise = { Frame = coreKernels.Frame.Galactic }, Color = { 0.9, 0.9, 0.0 }, - StartTime = DetachTime, - EndTime = L2orbitInsertionTime, + StartTime = transforms.DetachTime, + EndTime = transforms.L2orbitInsertionTime, SampleInterval = 60 -- Sample rate of once per minute }, GUI = { @@ -76,10 +74,10 @@ local JWSTTrailCruise = { -- This does NOT co-rotate with L2 and gives a saddle look of the trail local JWSTTrailOrbit = { Identifier = "JWSTTrailOrbit", - Parent = transforms.L2Position.Identifier, + Parent = L2transforms.L2Position.Identifier, TimeFrame = { Type = "TimeFrameInterval", - Start = L2orbitInsertionTime, + Start = transforms.L2orbitInsertionTime, End = EndTime }, Renderable = { @@ -87,7 +85,7 @@ local JWSTTrailOrbit = { Translation = { Type = "SpiceTranslation", Target = kernels.ID.JWST, - Observer = transforms.ID.L2, + Observer = L2transforms.ID.L2, Frame = coreKernels.Frame.Galactic }, Color = { 0.863, 0.0, 0.902 }, @@ -105,10 +103,10 @@ local JWSTTrailOrbit = { -- This gives the trail a look of a wheel going along L2 around the Sun local JWSTTrailCoRevOrbit = { Identifier = "JWSTTrailCoRevOrbit", - Parent = transforms.L2CoRevFrame.Identifier, + Parent = L2transforms.L2CoRevFrame.Identifier, TimeFrame = { Type = "TimeFrameInterval", - Start = L2orbitInsertionTime, + Start = transforms.L2orbitInsertionTime, End = EndTime }, Renderable = { @@ -116,7 +114,7 @@ local JWSTTrailCoRevOrbit = { Translation = { Type = "SpiceTranslation", Target = kernels.ID.JWST, - Observer = transforms.ID.L2, + Observer = L2transforms.ID.L2, Frame = "L2_COREV" }, Color = { 1.0, 0.663, 0.157 }, @@ -135,7 +133,7 @@ local JWSTSunTrail = { Parent = sunTransforms.SolarSystemBarycenter.Identifier, TimeFrame = { Type = "TimeFrameInterval", - Start = L2orbitInsertionTime, + Start = transforms.L2orbitInsertionTime, End = EndTime }, Renderable = { diff --git a/data/assets/scene/solarsystem/telescopes/jwst/transforms.asset b/data/assets/scene/solarsystem/telescopes/jwst/transforms.asset index 9baa639981..517eb88b92 100644 --- a/data/assets/scene/solarsystem/telescopes/jwst/transforms.asset +++ b/data/assets/scene/solarsystem/telescopes/jwst/transforms.asset @@ -105,6 +105,9 @@ asset.onDeinitialize(function() openspace.scriptScheduler.clear(1) end) +asset.export("LaunchTime", LaunchTime) +asset.export("DetachTime", DetachTime) +asset.export("L2orbitInsertionTime", L2orbitInsertionTime) asset.export(JWSTPosition) asset.export(JWSTRotation) diff --git a/data/assets/scene/solarsystem/telescopes/jwst/viewingband.asset b/data/assets/scene/solarsystem/telescopes/jwst/viewingband.asset new file mode 100644 index 0000000000..6da9a9a016 --- /dev/null +++ b/data/assets/scene/solarsystem/telescopes/jwst/viewingband.asset @@ -0,0 +1,68 @@ +local sunTransforms = asset.require("scene/solarsystem/sun/transforms") +local transforms = asset.require("./transforms") + + + +local band = asset.resource({ + Name = "JWST band texture", + Type = "HttpSynchronization", + Identifier = "jwst_band_texture", + Version = 1 +}) + + +local JWSTBand = { + Identifier = "JWSTBand", + Parent = transforms.JWSTPosition.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = transforms.LaunchTime + }, + Transform = { + Rotation = { + Type = "FixedRotation", + Attached = "JWSTBand", + XAxis = { 1.0, 0.0, 0.0 }, + XAxisOrthogonal = true, + ZAxis = sunTransforms.SolarSystemBarycenter.Identifier + } + }, + Renderable = { + Type = "RenderableSphereImageLocal", + Texture = band .. "JWST-band.png", + Size = 9.2E15, + Segments = 50, + DisableFadeInOut = true, + Orientation = "Inside", + Opacity = 0.05 + }, + Tag = { "mission_jwst_fov" }, + GUI = { + Name = "JWST Safe Viewing Band", + Path = "/Solar System/Telescopes/JWST", + Description = [[ + The safe viewing band for the James Webb Space Telescope at its current position. + ]] + } +} + + +asset.onInitialize(function() + openspace.addSceneGraphNode(JWSTBand) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(JWSTBand) +end) + + + +asset.meta = { + Name = "JWST Safe Viewing Band", + Description = [[ + The safe viewing band for the James Webb Space Telescope at its current position. + ]], + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +}