TimelineTranslation
Inherits Translation
Members
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values that are valid Translation objects |
|
No |
|
|
If this value is set to ‘true’, an interpolation is applied between the given keyframes. If this value is set to ‘false’, the interpolation is not applied |
|
Value of type ‘Boolean’ |
Yes |
Inherited members from Translation
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
The type of translation that is described in this element. The available types of translations depend on the configuration of the application and can be written to disk on application startup into the FactoryDocumentation |
|
Must name a valid Translation type |
No |
Table parameters for Keyframes
A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values that are valid Translation objects
Optional: No
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
|
No |
Asset Examples
1local earthTransforms = asset.require("scene/solarsystem/planets/earth/transforms")
2local sunTransforms = asset.require("scene/solarsystem/sun/transforms")
3local l2 = asset.require("scene/solarsystem/planets/earth/lagrange_points/l2")
4local kernels = asset.require("./kernels")
5local coreKernels = asset.require("spice/core")
6
7
8
9local LaunchTime = "2021 DEC 25 12:20:00"
10local DetachTime = "2021 DEC 25 12:50:00"
11local L2orbitInsertionTime = "2022 JAN 25 00:00:00"
12
13local JWSTPosition = {
14 Identifier = "JWSTPosition",
15 Parent = earthTransforms.EarthIAU.Identifier,
16 Transform = {
17 Translation = {
18 Type = "TimelineTranslation",
19 ShouldInterpolate = false,
20 Keyframes = {
21 [LaunchTime] = {
22 Type = "SpiceTranslation",
23 Target = kernels.ID.JWST,
24 Observer = coreKernels.ID.Earth,
25 Frame = coreKernels.Frame.Earth
26 },
27 [DetachTime] = {
28 Type = "SpiceTranslation",
29 Target = kernels.ID.JWST,
30 Observer = coreKernels.ID.Earth,
31 Frame = coreKernels.Frame.Galactic
32 },
33 [L2orbitInsertionTime] = {
34 Type = "SpiceTranslation",
35 Target = kernels.ID.JWST,
36 Observer = l2.ID.L2,
37 Frame = coreKernels.Frame.Galactic
38 }
39 }
40 }
41 },
42 GUI = {
43 Name = "JWST Position",
44 Path = "/Solar System/Telescopes/JWST",
45 Hidden = true
46 }
47}
48
49local JWSTRotation = {
50 Identifier = "JWSTRotation",
51 Parent = JWSTPosition.Identifier,
52 Transform = {
53 Rotation = {
54 Type = "FixedRotation",
55 Attached = "JWSTRotation",
56 XAxis = { 1, 0, 0 },
57 XAxisOrthogonal = true,
58 YAxisInvert = true,
59 YAxis = sunTransforms.SolarSystemBarycenter.Identifier
60 }
61 },
62 GUI = {
63 Name = "JWST Rotation",
64 Path = "/Solar System/Telescopes/JWST",
65 Hidden = true
66 }
67}
68
69
70-- Reparent the JWSTPosition node when the data changes
71asset.onInitialize(function()
72 openspace.addSceneGraphNode(JWSTPosition)
73 openspace.addSceneGraphNode(JWSTRotation)
74
75 -- Set correct parent during run-time
76 openspace.scriptScheduler.loadScheduledScript(
77 DetachTime,
78 [[openspace.setParent("JWSTPosition", "EarthCenter")]],
79 [[openspace.setParent("JWSTPosition", "EarthIAU")]],
80 "",
81 1 -- Not default group, never clear this script
82 )
83 openspace.scriptScheduler.loadScheduledScript(
84 L2orbitInsertionTime,
85 [[openspace.setParent("JWSTPosition", "L2")]],
86 [[openspace.setParent("JWSTPosition", "EarthCenter")]],
87 "",
88 1 -- Not default group, never clear this script
89 )
90
91 -- Set correct parent at the start
92 local now = openspace.time.currentTime()
93 if now < openspace.time.convertTime(DetachTime) then
94 openspace.setParent("JWSTPosition", "EarthIAU")
95 elseif now > openspace.time.convertTime(L2orbitInsertionTime) then
96 openspace.setParent("JWSTPosition", "L2")
97 else
98 openspace.setParent("JWSTPosition", "EarthCenter")
99 end
100end)
101
102asset.onDeinitialize(function()
103 openspace.removeSceneGraphNode(JWSTRotation)
104 openspace.removeSceneGraphNode(JWSTPosition)
105 openspace.scriptScheduler.clear(1)
106end)
107
108asset.export(JWSTPosition)
109asset.export(JWSTRotation)
110
111
112
113asset.meta = {
114 Name = "James Webb Space Telescope Transforms",
115 Version = "1.0",
116 Description = [[
117 JWST transforms: JWST position relative to Earth and JWST rotation,
118 a fixed rotation so sunshield always points toward the Sun.
119 ]],
120 Author = "OpenSpace Team",
121 URL = "http://openspaceproject.com",
122 License = "MIT license"
123}