Feature/satellites (#325)

* Initial commit of satellites test branch

* Modified code to work with batch TLE files from online links specified in .mod file. Does not yet auto-download the files.

* Added debug function to mod file for testing static points in orbit

* Fixed time offset bug that was corrupting satellite positions

* Minor changes for debug output and camera position.

* Changed to circle billboard for rendering satellite position

* Added satellite group name to each renderable title, and keyboard shortcuts for toggling visibility

* Added support for using ghoul luasocket lib to download latest satellite TLE files from celestrak.com

* Adding reference to updated Ghoul submodule containing luasocket changes

* Updating reference to latest Ghoul submodule in feature/satellites

* Updated reference to new ghoul version

* Updated reference to new ghoul submodule version for satellites

* Updated reference to new ghoul submodule version for satellits

* Updated versions of TLE files

* Added new Lua-accessible downloader available for scene loading

* Improved error handling for TLE files

* Updated submodule reference for ext/ghoul prior to luasocket addition

* Update SGCT reference
This commit is contained in:
Gene Payne
2017-06-06 11:42:38 -06:00
committed by Alexander Bock
parent 624fdd555f
commit be1b211dfb
15 changed files with 2157 additions and 98 deletions
+71
View File
@@ -0,0 +1,71 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0011.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
-- openspace.spice.loadKernel("${OPENSPACE_DATA}/spice/de430_1850-2150.bsp")
openspace.time.setTime(openspace.time.currentWallTime())
--Test for vernal equinox time 2017
--openspace.time.setTime("2017 MAR 20 10:28:30.500")
dofile(openspace.absPath('${SCRIPTS}/bind_keys_satellites.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.printInfo("Setting default values")
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
openspace.setPropertyValue("SunGlare.renderable.enabled", false)
openspace.setPropertyValue("MilkyWay.renderable.enabled", false)
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
openspace.setPropertyValue("EarthTrail.renderable.enabled", false)
openspace.setPropertyValue("Earth.renderable.performShading", false)
openspace.resetCameraDirection()
openspace.printInfo("Done setting default values")
if openspace.modules.isLoaded("ISWA") then
openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json");
--openspace.iswa.addCygnet(7);
--openspace.iswa.addCygnet(-4,"Data","Gm");
--openspace.iswa.addCygnet(-5,"Data","Gm");
--openspace.iswa.addCygnet(-6,"Data","Gm");
--openspace.iswa.addCygnet(-7,"Data","Gm");
--openspace.iswa.addCygnet(-8,"Data","Gm");
--openspace.iswa.addCygnet(-9,"Data","Gm");
end
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Earth",
Position = {-54343425747.129051, -73298476295.934555, 116584089130.590012},
Rotation = {-0.078983, 0.830093, 0.014241, -0.551819},
},
Modules = {
--"satellites/earth",
"sun",
"earth",
-- "stars",
-- "milkyway",
"satellites"
}
}
+66
View File
@@ -0,0 +1,66 @@
#!/bin/lua
--For debug purposes, but also for generating raw output in case the parsing
-- isn't working as intended.
function tableLength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
output = dofile("satellites.mod")
outputLen = tableLength(output)
print("return {")
for i=1,outputLen do
type=output[i].Renderable.Type
print(" {")
if( type == "RenderablePlane" ) then
print(" Name = \"" .. output[i].Name .. "\",")
print(" Parent = \"" .. output[i].Parent .. "\",")
print(" Renderable = {")
print(" Type = \"" .. output[i].Renderable.Type .. "\",")
print(" Size = {".. output[i].Renderable.Size[1] .. "," .. output[i].Renderable.Size[2] .. "},")
print(" Origin = \"".. output[i].Renderable.Origin .. "\",")
print(" Body = \"" .. output[i].Renderable.Body .. "\",")
if (output[i].Renderable.Billboard) then
print(" Billboard = true,")
else
print(" Billboard = false,")
end
print(" Texture = \"" .. output[i].Renderable.Texture .. "\",")
print(" },")
print(" Transform = {")
print(" Translation = {")
print(" Type = \"" .. output[i].Transform.Translation.Type .. "\",")
print(" Body = \"" .. output[i].Transform.Translation.Body .. "\",")
print(" Observer = \"" .. output[i].Transform.Translation.Observer .. "\",")
print(" File = \"" .. output[i].Transform.Translation.File .. "\",")
print(" LineNum = " .. output[i].Transform.Translation.LineNum .. ",")
print(" },")
print(" Scale = {")
print(" Type = \"" .. output[i].Transform.Scale.Type .. "\",")
print(" Scale = " .. output[i].Transform.Scale.Scale .. ",")
print(" },")
print(" },")
elseif( type == "RenderableTrailOrbit" ) then
print(" Name = \"" .. output[i].Name .. "\",")
print(" Parent = \"" .. output[i].Parent .. "\",")
print(" Renderable = {")
print(" Type = \"" .. output[i].Renderable.Type .. "\",")
print(" Translation = {")
print(" Type = \"" .. output[i].Renderable.Translation.Type .. "\",")
print(" Body = \"" .. output[i].Renderable.Translation.Body .. "\",")
print(" Observer = \"" .. output[i].Renderable.Translation.Observer .. "\",")
print(" File = \"" .. output[i].Renderable.Translation.File .. "\",")
print(" LineNum = " .. output[i].Renderable.Translation.LineNum .. ",")
print(" },")
print(" Color = {" .. output[i].Renderable.Color[1] .. "," .. output[i].Renderable.Color[2] .. "," .. output[i].Renderable.Color[3] .. "},")
print(" Period = " .. output[i].Renderable.Period .. ",")
print(" Resolution = " .. output[i].Renderable.Resolution .. ",")
print(" },")
print(" GuiName = \"" .. output[i].GuiName .. "\",")
end
print(" },")
end
print("}")
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+194
View File
@@ -0,0 +1,194 @@
DOWNLOAD = true
function dirListing(dirname)
f = io.popen('ls ' .. dirname)
files = {}
for name in f:lines() do
table.insert(files, name)
end
return files
end
function values(t)
local i = 0
return function () i = i + 1; return t[i] end
end
function trimString(s)
s = s:gsub("^%s*(.-)%s*$", "%1")
s = s:gsub("%s+", "_")
s = s:gsub("[%-()]", "")
return s
end
function getPeriodFromFile(line2)
return tonumber(string.sub(line2, 53, 63))
end
function getNumLinesInFile(filename)
local ctr = 0
for _ in io.lines(filename) do
ctr = ctr + 1
end
return ctr
end
function isEmpty(s)
return s == nil or s == ''
end
--Check format of a set of 3 TLE file lines and return nonzero if there is a format error
function checkTleFileFormat(lineArr)
if isEmpty(lineArr[1]) or isEmpty(lineArr[2]) or isEmpty(lineArr[3]) then
return -1
end
if string.sub(lineArr[2], 1, 2) ~= "1 " then
return -1
end
if string.sub(lineArr[3], 1, 2) ~= "2 " then
return -1
end
return 0
end
function getSat(title, file, lineNum)
return {
Name = title,
Parent = "EarthInertial",
Renderable = {
Type = "RenderablePlane",
Size = {3.0, 4.0},
Origin = "Center",
Body = "TLE",
Billboard = true,
Texture = "satB.png"
},
Transform = {
Translation = {
Type = "TLETranslation",
Body = title,
Observer = "EarthInertial",
File = file,
LineNum = lineNum
},
Scale = {
Type = "StaticScale",
Scale = 1,
}
}
}
end
function getSatTrail(title, file, lineNum, per, color)
trailName = title .. "_trail"
return {
Name = trailName,
Parent = "EarthInertial",
Renderable = {
Type = "RenderableTrailOrbit",
Translation = {
Type = "TLETranslation",
Body = title,
Observer = "EarthInertial",
File = file,
LineNum = lineNum
},
Color = color,
Period = per,
Resolution = 160
},
GuiName = "/Satellites/" .. trailName
}
end
function getTestPoint(parent, name, x, y, z)
return {
Name = name,
Parent = parent,
Renderable = {
Type = "RenderablePlane",
Size = {3.0, 4.0},
Origin = "Center",
Body = "TLE",
Billboard = true,
Texture = "satB.png"
},
Transform = {
Translation = {
Type = "StaticTranslation",
Position = {x, y, z},
},
Scale = {
Type = "StaticScale",
Scale = 1,
}
}
}
end
-------------------------------------------------------------
--Name, URL, and color scheme for each satellite group
satelliteGroups = {
{ title = "GPS",
url = "http://celestrak.com/NORAD/elements/gps-ops.txt",
trailColor = {0.9, 0.5, 0.0}
},
{ title = "SpaceStations",
url = "http://celestrak.com/NORAD/elements/stations.txt",
trailColor = {0.9, 0.0, 0.0}
},
{ title = "Geostationary",
url = "http://celestrak.com/NORAD/elements/geo.txt",
trailColor = {0.9, 0.9, 0.0}
},
}
modElements = {}
fileErr = ""
for sOrbit in values(satelliteGroups) do
filename = sOrbit.url:match("([^/]+)$")
filenameSansExt = filename:gsub(filename:match "(%.%w+)$", "")
sOrbit.path = "satellites/tle/" .. filename
if DOWNLOAD then
openspace.downloadFile(sOrbit.url, sOrbit.path)
end
sOrbit.path = "../" .. sOrbit.path
pathFromScenegraphParent = "./" .. sOrbit.path
line = {}
myfile = io.open(sOrbit.path, "r")
lines = getNumLinesInFile(sOrbit.path)
--now loop through the tle file and get each set of 3 lines
if myfile then
for n=1,lines,3 do
line[1] = myfile:read('*l') --title line
line[2] = myfile:read('*l')
line[3] = myfile:read('*l')
if( checkTleFileFormat(line) == 0 ) then
title = trimString(line[1])
per = getPeriodFromFile(line[3])
per = 1.0 / per * 2 --trail for 2x a single revolution
table.insert(modElements, getSat(filenameSansExt .. "_" .. title, pathFromScenegraphParent, n))
table.insert(modElements, getSatTrail(filenameSansExt .. "_" .. title,
pathFromScenegraphParent, n, per, sOrbit.trailColor))
else
fileErr = " TLE file syntax error on line " .. n .. ": " .. sOrbit.path
break
end
end
else
fileErr = " File not found: " .. sOrbit.path
break
end
end
assert(fileErr == "", fileErr)
if (fileErr == "") then
return modElements
else
return "Invalid file: " .. fileErr
end
File diff suppressed because it is too large Load Diff
+93
View File
@@ -0,0 +1,93 @@
GPS BIIR-2 (PRN 13)
1 24876U 97035A 17109.73375644 -.00000012 00000-0 00000-0 0 9992
2 24876 55.5643 229.4105 0036557 106.5416 253.8548 2.00562036144850
GPS BIIR-3 (PRN 11)
1 25933U 99055A 17109.65740979 .00000008 00000-0 00000-0 0 9993
2 25933 51.5943 80.2017 0164482 93.5980 140.6974 2.00559092128473
GPS BIIR-4 (PRN 20)
1 26360U 00025A 17109.81822694 .00000034 00000-0 00000-0 0 9999
2 26360 53.1062 157.3245 0041561 90.8273 1.8392 2.00564454124177
GPS BIIR-5 (PRN 28)
1 26407U 00040A 17109.72770267 -.00000058 00000-0 00000-0 0 9993
2 26407 56.6488 347.4270 0199991 270.0939 38.2665 2.00567294122845
GPS BIIR-6 (PRN 14)
1 26605U 00071A 17109.91594260 -.00000014 00000-0 00000-0 0 9997
2 26605 55.1353 227.1576 0091621 248.1584 104.4436 2.00567152120445
GPS BIIR-7 (PRN 18)
1 26690U 01004A 17109.78566808 .00000030 00000-0 00000-0 0 9997
2 26690 53.0287 160.2705 0181728 256.2994 113.2448 2.00553627118851
GPS BIIR-8 (PRN 16)
1 27663U 03005A 17109.59259250 -.00000059 00000-0 00000-0 0 9992
2 27663 56.7184 347.1682 0092496 23.4683 306.5317 2.00563261104201
GPS BIIR-9 (PRN 21)
1 27704U 03010A 17109.45896894 .00000044 00000-0 00000-0 0 9993
2 27704 53.8252 100.6579 0242330 263.6172 289.5204 2.00560332102998
GPS BIIR-10 (PRN 22)
1 28129U 03058A 17108.92540211 .00000021 00000-0 00000-0 0 9992
2 28129 52.9154 160.3028 0078030 259.1988 99.9936 2.00579000 97688
GPS BIIR-11 (PRN 19)
1 28190U 04009A 17109.78405102 -.00000044 00000-0 00000-0 0 9997
2 28190 55.9742 48.2291 0100656 53.7277 206.5104 2.00565372 95887
GPS BIIR-12 (PRN 23)
1 28361U 04023A 17109.67197838 -.00000016 00000-0 00000-0 0 9994
2 28361 54.1189 222.3390 0116919 218.8962 232.5879 2.00552789 93943
GPS BIIR-13 (PRN 02)
1 28474U 04045A 17109.80139524 .00000047 00000-0 00000-0 0 9999
2 28474 54.2062 100.0906 0169972 246.2805 298.8317 2.00552002 91333
GPS BIIRM-1 (PRN 17)
1 28874U 05038A 17109.78616237 -.00000048 00000-0 00000-0 0 9996
2 28874 56.1319 45.4826 0118701 254.3506 28.1379 2.00570959 84737
GPS BIIRM-2 (PRN 31)
1 29486U 06042A 17109.84481250 .00000007 00000-0 00000-0 0 9998
2 29486 55.4369 284.6203 0085225 343.6385 263.4212 2.00562325 77337
GPS BIIRM-3 (PRN 12)
1 29601U 06052A 17109.44438112 -.00000058 00000-0 00000-0 0 9990
2 29601 56.6911 346.0938 0064836 46.5746 314.0087 2.00578841 76304
GPS BIIRM-4 (PRN 15)
1 32260U 07047A 17109.76747141 -.00000018 00000-0 00000-0 0 9996
2 32260 53.2450 218.7351 0089867 32.0784 328.4730 2.00550702 69758
GPS BIIRM-5 (PRN 29)
1 32384U 07062A 17109.82767948 -.00000047 00000-0 00000-0 0 9996
2 32384 56.1949 46.0590 0007162 349.1522 190.7070 2.00567498 68450
GPS BIIRM-6 (PRN 07)
1 32711U 08012A 17109.17017566 .00000005 00000-0 00000-0 0 9991
2 32711 55.1649 284.0298 0104617 211.6174 147.7414 2.00555102 66640
GPS BIIRM-8 (PRN 05)
1 35752U 09043A 17109.80875753 .00000030 00000-0 00000-0 0 9992
2 35752 54.2447 161.8840 0048052 28.4418 96.4367 2.00557153 56266
GPS BIIF-1 (PRN 25)
1 36585U 10022A 17109.45861331 -.00000056 00000-0 00000-0 0 9993
2 36585 56.0008 342.9525 0062857 43.8593 292.2361 2.00572192 50488
GPS BIIF-2 (PRN 01)
1 37753U 11036A 17109.65756309 .00000053 00000-0 00000-0 0 9993
2 37753 55.4143 103.1083 0063799 28.9219 177.7211 2.00561953 42171
GPS BIIF-3 (PRN 24)
1 38833U 12053A 17109.36112639 .00000003 00000-0 00000-0 0 9998
2 38833 54.1932 280.9976 0055446 25.7503 334.5131 2.00560911 33233
GPS BIIF-4 (PRN 27)
1 39166U 13023A 17109.71335229 -.00000054 00000-0 00000-0 0 9994
2 39166 55.8396 42.5193 0046353 15.5591 344.5802 2.00565270 28782
GPS BIIF-5 (PRN 30)
1 39533U 14008A 17109.71803235 .00000003 00000-0 00000-0 0 9996
2 39533 54.3474 286.2694 0026612 180.2094 179.7840 2.00561576 22608
GPS BIIF-6 (PRN 06)
1 39741U 14026A 17109.49522789 .00000051 00000-0 00000-0 0 9997
2 39741 55.4016 102.6345 0010242 287.2500 72.6522 2.00565694 21432
GPS BIIF-7 (PRN 09)
1 40105U 14045A 17109.58870938 -.00000015 00000-0 00000-0 0 9997
2 40105 54.6417 222.2176 0006094 114.5172 245.5503 2.00565991 19002
GPS BIIF-8 (PRN 03)
1 40294U 14068A 17109.45908091 .00000027 00000-0 00000-0 0 9991
2 40294 54.9913 162.8335 0006001 343.2122 16.8409 2.00553719 18104
GPS BIIF-9 (PRN 26)
1 40534U 15013A 17109.59579211 -.00000056 00000-0 00000-0 0 9995
2 40534 54.9576 342.1019 0018236 356.2473 3.7829 2.00562102 14725
GPS BIIF-10 (PRN 08)
1 40730U 15033A 17109.25722952 -.00000055 00000-0 00000-0 0 9999
2 40730 55.3741 42.2354 0027546 314.4917 45.2822 2.00570200 12905
GPS BIIF-11 (PRN 10)
1 41019U 15062A 17109.31059499 .00000026 00000-0 00000-0 0 9995
2 41019 55.0013 162.6249 0025268 204.7841 155.1668 2.00563458 10725
GPS BIIF-12 (PRN 32)
1 41328U 16007A 17109.39652641 -.00000014 00000-0 00000-0 0 9992
2 41328 54.8999 222.3973 0011692 216.7815 143.1423 2.00558460 8782
+180
View File
@@ -0,0 +1,180 @@
ISS (ZARYA)
1 25544U 98067A 17109.92096824 .00002787 00000-0 49344-4 0 9990
2 25544 51.6434 328.7262 0007243 75.4107 32.5712 15.54131334 52697
TIANGONG 1
1 37820U 11053A 17109.70783838 .00019763 00000-0 12539-3 0 9991
2 37820 42.7590 197.4071 0018147 19.0253 112.4332 15.75889937318739
AGGIESAT 4
1 41313U 98067HP 17109.81227259 .00031142 00000-0 24561-3 0 9998
2 41313 51.6371 301.8896 0003500 267.9298 92.1299 15.71127246 69747
BEVO 2
1 41314U 98067HQ 17109.68429905 .00156013 20027-4 50373-3 0 9996
2 41314 51.6235 283.2567 0005515 275.3685 84.6691 15.90548487 69787
MINXSS
1 41474U 98067HU 17109.73827802 .00306018 48569-4 71516-3 0 9992
2 41474 51.6472 293.8859 0006892 279.9569 80.0662 15.96438057 53089
STMSAT-1
1 41476U 98067HW 17109.88070258 .02335240 11870-4 10986-2 0 9994
2 41476 51.6204 288.5305 0012717 288.4489 71.5067 16.20615210 53079
NODES 2
1 41477U 98067HX 17109.78732856 .00065132 00000-0 42046-3 0 9993
2 41477 51.6317 305.4154 0003507 222.8310 137.2416 15.75484120 52843
NODES 1
1 41478U 98067HY 17109.81327838 .00066571 00000-0 43583-3 0 9993
2 41478 51.6337 305.5905 0003334 219.7891 140.2864 15.75153441 52848
FLOCK 2E'-1
1 41479U 98067HZ 17109.82905449 .00029193 00000-0 27831-3 0 9992
2 41479 51.6365 313.2731 0001172 62.9361 297.1754 15.66532776 52708
FLOCK 2E'-3
1 41480U 98067JA 17109.78977551 .00023981 00000-0 22881-3 0 9991
2 41480 51.6367 313.0301 0001516 116.2427 243.8724 15.66630662 52697
FLOCK 2E'-2
1 41481U 98067JB 17109.83105879 .00025245 00000-0 23401-3 0 9998
2 41481 51.6355 311.7758 0001181 45.0304 315.0788 15.67316853 52705
FLOCK 2E'-4
1 41482U 98067JC 17109.79676564 .00028405 00000-0 24875-3 0 9995
2 41482 51.6352 311.5368 0001631 168.7346 191.3688 15.68647594 52701
FLOCK 2E-1
1 41483U 98067ID 17109.65478592 .00019453 00000-0 19150-3 0 9995
2 41483 51.6381 314.4039 0002624 157.9400 202.1709 15.65994639 52522
FLOCK 2E-2
1 41484U 98067JE 17109.82139276 .00023265 00000-0 21668-3 0 9991
2 41484 51.6388 312.5323 0002244 167.0663 193.0391 15.67251790 52561
FLOCK 2E-3
1 41486U 98067JG 17109.83030932 .00019642 00000-0 19928-3 0 9993
2 41486 51.6376 314.8200 0002650 199.1890 160.9006 15.65226077 52551
FLOCK 2E-4
1 41487U 98067JH 17109.84556035 .00021562 00000-0 21013-3 0 9994
2 41487 51.6376 313.3996 0002901 202.4468 157.6401 15.66171142 52573
FLOCK 2E-6
1 41563U 98067JM 17109.78874028 .00018524 00000-0 19029-3 0 9995
2 41563 51.6372 315.2682 0001335 51.8098 308.3017 15.64958450 50616
FLOCK 2E-5
1 41564U 98067JN 17109.79523798 .00018624 00000-0 19210-3 0 9995
2 41564 51.6372 315.3186 0001291 58.7101 301.4020 15.64849440 50604
FLOCK 2E-7
1 41565U 98067JP 17109.77087667 .00027808 00000-0 25811-3 0 9992
2 41565 51.6365 312.8853 0002940 243.9307 116.1387 15.67223362 50539
FLOCK 2E-8
1 41566U 98067JQ 17109.80005150 .00089692 00000-0 42658-3 0 9991
2 41566 51.6335 301.7154 0005913 241.2167 118.8242 15.82123501 50671
FLOCK 2E'-5
1 41567U 98067JR 17109.82240982 .00018645 00000-0 19803-3 0 9994
2 41567 51.6378 316.2578 0003052 269.9747 90.0898 15.64101875 50468
FLOCK 2E'-6
1 41568U 98067JS 17109.73365885 .00019933 00000-0 19922-3 0 9998
2 41568 51.6366 314.8878 0002651 264.8215 95.2478 15.65593919 50502
FLOCK 2E'-8
1 41569U 98067JT 17109.81323064 .00028772 00000-0 26479-3 0 9997
2 41569 51.6363 312.4223 0001607 185.1389 174.9591 15.67417153 50424
FLOCK 2E'-7
1 41570U 98067JU 17109.84953955 .00031567 00000-0 26673-3 0 9992
2 41570 51.6369 310.4309 0002960 184.1959 175.9014 15.69458790 50470
FLOCK 2E-9
1 41571U 98067JV 17109.82645424 .00028760 00000-0 26059-3 0 9999
2 41571 51.6370 311.7739 0002674 242.4455 117.6270 15.67801154 50410
FLOCK 2E-10
1 41572U 98067JW 17109.81540411 .00024857 00000-0 23657-3 0 9993
2 41572 51.6371 313.2010 0003003 248.3230 111.7447 15.66668690 50397
FLOCK 2E-12
1 41573U 98067JX 17109.77960367 .00027556 00000-0 25527-3 0 9992
2 41573 51.6367 312.9551 0002571 267.1560 92.9142 15.67278525 50390
FLOCK 2E-11
1 41574U 98067JY 17109.78226357 .00026708 00000-0 24509-3 0 9995
2 41574 51.6353 312.1863 0003298 269.1599 90.9019 15.67528751 50407
FLOCK 2E'-9
1 41575U 98067JZ 17109.81056748 .00029764 00000-0 26509-3 0 9992
2 41575 51.6348 311.6084 0002751 288.6496 71.4202 15.68204720 50402
FLOCK 2E'-10
1 41576U 98067KA 17109.77269490 .00030074 00000-0 27691-3 0 9997
2 41576 51.6376 312.9270 0002762 288.6796 71.3901 15.67378357 50288
FLOCK 2E'-11
1 41577U 98067KB 17109.79101284 .00023668 00000-0 22296-3 0 9993
2 41577 51.6378 313.0548 0003312 262.9815 97.0805 15.66954445 50106
FLOCK 2E'-12
1 41578U 98067KC 17109.83071225 .00028915 00000-0 26144-3 0 9996
2 41578 51.6355 312.5190 0003879 246.8376 113.2211 15.67846378 50119
FLOCK 2E'-13
1 41761U 98067KH 17109.80002983 .00014655 00000-0 18690-3 0 9995
2 41761 51.6392 324.4021 0007265 49.8199 310.3429 15.59526131 33795
FLOCK 2E'-14
1 41762U 98067KJ 17109.85521685 .00012951 00000-0 16504-3 0 9995
2 41762 51.6404 324.0354 0007100 50.3983 309.7636 15.59672213 33808
FLOCK 2E'-16
1 41763U 98067KK 17109.84145497 .00015760 00000-0 19696-3 0 9994
2 41763 51.6404 323.9389 0006632 60.9401 299.2256 15.59999189 33766
FLOCK 2E'-15
1 41764U 98067KL 17109.87177553 .00013668 00000-0 17536-3 0 9992
2 41764 51.6402 324.1424 0006951 56.4927 303.6730 15.59436947 33760
TIANGONG-2
1 41765U 16057A 17109.88457597 .00006208 00000-0 76612-4 0 9995
2 41765 42.7849 342.3366 0007020 274.6731 154.6477 15.60877974 33874
FLOCK 2E'-18
1 41769U 98067KM 17109.85904600 .00012974 00000-0 16652-3 0 9993
2 41769 51.6402 324.0512 0006179 77.3335 282.8349 15.59486030 33761
FLOCK 2E'-17
1 41776U 98067KN 17109.85282571 .00010304 00000-0 13324-3 0 9995
2 41776 51.6411 324.0213 0006338 78.3972 281.7732 15.59560942 33750
FLOCK 2E'-19
1 41777U 98067KP 17109.85740966 .00015381 00000-0 18245-3 0 9990
2 41777 51.6392 322.5300 0005414 79.0163 281.1440 15.61402073 33734
FLOCK 2E'-20
1 41782U 98067KQ 17109.83324911 .00018487 00000-0 22266-3 0 9990
2 41782 51.6405 323.1334 0005543 75.7821 284.3788 15.60844608 33593
SOYUZ-MS 02
1 41820U 16063A 17099.31803792 .00003510 00000-0 60428-4 0 9993
2 41820 51.6436 21.5790 0006756 40.2971 107.7536 15.54046698 51040
BANXING-2
1 41834U 16057H 17109.90404225 .00010491 00000-0 10102-3 0 9995
2 41834 42.7856 340.6951 0007273 205.2685 229.1726 15.66598364 27965
SOYUZ-MS 03
1 41864U 16070A 17108.56623476 .00002987 00000-0 52374-4 0 9994
2 41864 51.6439 335.4785 0007166 70.0921 13.3272 15.54123193 23600
STARS-C
1 41895U 98067KR 17109.79899468 .00030018 00000-0 38671-3 0 9995
2 41895 51.6404 327.3984 0005536 106.1447 254.0155 15.58751599 18878
TANCREDO-1
1 41931U 98067KT 17109.86190081 .00052089 00000-0 58691-3 0 9995
2 41931 51.6395 326.3112 0006129 69.5695 290.5957 15.61995558 14461
ITF-2
1 41932U 98067KU 17109.85588580 .00016634 00000-0 22758-3 0 9991
2 41932 51.6413 327.7805 0006108 60.3108 299.8492 15.57538630 14445
WASEDA-SAT3
1 41933U 98067KV 17109.84844175 .00021108 00000-0 28355-3 0 9997
2 41933 51.6407 327.7291 0005970 62.7540 297.4060 15.57848382 14443
EGG
1 41934U 98067KW 17109.82873718 .00359689 00000-0 22549-2 0 9997
2 41934 51.6334 324.5691 0004769 232.7194 127.3371 15.75166791 14578
AOBA-VELOX 3
1 41935U 98067KX 17109.85496819 .00018693 00000-0 25356-3 0 9991
2 41935 51.6411 327.7732 0005547 65.6383 294.5187 15.57678773 14541
TUPOD
1 41936U 98067KY 17109.76502401 .00076370 00000-0 79702-3 0 9997
2 41936 51.6390 326.4192 0004334 84.8776 275.2714 15.63809782 13933
OSNSAT
1 41939U 98067KZ 17109.84725302 .00038473 00000-0 46963-3 0 9991
2 41939 51.6399 326.9674 0006966 65.0500 295.1216 15.60039674 13811
PROGRESS-MS 05
1 42056U 17010A 17108.56623476 .00002987 00000-0 52374-4 0 9993
2 42056 51.6439 335.4785 0007166 70.0921 13.3272 15.54123193 8629
LEMUR-2-REDFERN-GOES
1 42059U 98067LA 17109.86490573 .00020711 00000-0 29467-3 0 9992
2 42059 51.6413 328.5872 0009106 82.8311 277.3716 15.56286742 6922
TECHEDSAT 5
1 42066U 98067LB 17109.86435488 .00105210 00000-0 11946-2 0 9994
2 42066 51.6390 327.8308 0003545 127.5897 232.5420 15.61508635 6667
LEMUR-2-TRUTNA
1 42067U 98067LC 17109.85891074 .00025317 00000-0 35271-3 0 9998
2 42067 51.6412 328.5475 0008572 83.5926 276.6041 15.56728774 6755
LEMUR-2-AUSTINTACIOUS
1 42068U 98067LD 17109.86578689 .00018494 00000-0 26447-3 0 9997
2 42068 51.6410 328.5924 0008622 83.6075 276.5898 15.56237023 6857
LEMUR-2-TRUTNAHD
1 42069U 98067LE 17109.86629258 .00021052 00000-0 29958-3 0 9991
2 42069 51.6412 328.5961 0008488 82.8885 277.3071 15.56276065 6908
ISS DEB
1 42434U 98067LF 17109.82210271 .00056714 00000-0 79599-3 0 9993
2 42434 51.6406 329.0485 0005861 67.1845 292.9765 15.56154397 3068
CYGNUS OA-7
1 42681U 17019A 17109.46972691 -.00000487 00000-0 00000-0 0 9991
2 42681 51.6511 331.0240 0010106 169.9930 268.8149 15.53958196 134
@@ -0,0 +1,48 @@
#!/bin/lua
function tableLength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
output = dofile("satellites.mod")
outputLen = tableLength(output)
for i=1,outputLen do
type=output[i].Renderable.Type
print("------------", i)
if( type == "RenderablePlane" ) then
print(output[i].Name)
print(output[i].Parent)
print(output[i].Renderable.Type)
print(output[i].Renderable.Size[1])
print(output[i].Renderable.Size[2])
print(output[i].Renderable.Origin)
print(output[i].Renderable.Body)
print(output[i].Renderable.Billboard)
print(output[i].Renderable.Texture)
print(output[i].Transform.Translation.Type)
print(output[i].Transform.Translation.Body)
print(output[i].Transform.Translation.Observer)
print(output[i].Transform.Translation.File)
print(output[i].Transform.Translation.LineNum)
print(output[i].Transform.Scale.Type)
print(output[i].Transform.Scale.Scale)
elseif( type == "RenderableTrailOrbit" ) then
print(output[i].Name)
print(output[i].Parent)
print(output[i].Renderable.Type)
print(output[i].Renderable.Translation.Type)
print(output[i].Renderable.Translation.Body)
print(output[i].Renderable.Translation.Observer)
print(output[i].Renderable.Translation.File)
print(output[i].Renderable.Translation.LineNum)
print(output[i].Renderable.Color[1])
print(output[i].Renderable.Color[2])
print(output[i].Renderable.Color[3])
print(output[i].Renderable.Period)
print(output[i].Renderable.Resolution)
print(output[i].GuiName)
end
end
+12 -2
View File
@@ -85,9 +85,19 @@ public:
DownloadManager(std::string requestURL, int applicationVersion,
bool useMultithreadedDownload = true);
// callbacks happen on a different thread
std::shared_ptr<FileFuture> downloadFile(const std::string& url, const ghoul::filesystem::File& file,
//downloadFile
// url - specifies the target of the download
// file - specifies path to local saved file
// overrideFile - if true, overrides existing file of same name
// failOnError - if true, http codes >= 400 (client/server errors) result in fail
// timeout_secs - timeout in seconds before giving up on download (0 = no timeout)
// finishedCallback - callback when download finished (happens on different thread)
// progressCallback - callback for status during (happens on different thread)
std::shared_ptr<FileFuture> downloadFile(const std::string& url,
const ghoul::filesystem::File& file,
bool overrideFile = true,
bool failOnError = false,
unsigned int timeout_secs = 0,
DownloadFinishedCallback finishedCallback = DownloadFinishedCallback(),
DownloadProgressCallback progressCallback = DownloadProgressCallback()
);
+90 -94
View File
@@ -31,9 +31,11 @@
#include <chrono>
#include <fstream>
#include <vector>
#include <system_error>
namespace {
const char* KeyFile = "File";
const char* KeyLineNum = "LineNum";
// The list of leap years only goes until 2056 as we need to touch this file then
// again anyway ;)
@@ -183,7 +185,8 @@ namespace {
// 3
using namespace std::chrono;
int SecondsPerDay = static_cast<int>(seconds(hours(24)).count());
double nSecondsSince2000 = (daysSince2000 + daysInYear) * SecondsPerDay;
//Need to subtract 1 from daysInYear since it is not a zero-based count
double nSecondsSince2000 = (daysSince2000 + daysInYear - 1) * SecondsPerDay;
// 4
// We need to remove additionbal leap seconds past 2000 and add them prior to
@@ -244,6 +247,12 @@ documentation::Documentation TLETranslation::Documentation() {
new StringVerifier,
"Specifies the filename of the Two-Line-Element file",
Optional::No
},
{
KeyLineNum,
new DoubleGreaterVerifier(0),
"Specifies the line number within the file where the group of 3 TLE lines begins (1-based)",
Optional::No
}
},
Exhaustive::No
@@ -261,10 +270,11 @@ TLETranslation::TLETranslation(const ghoul::Dictionary& dictionary)
);
std::string file = dictionary.value<std::string>(KeyFile);
readTLEFile(file);
int lineNum = dictionary.value<double>(KeyLineNum);
readTLEFile(file, lineNum);
}
void TLETranslation::readTLEFile(const std::string& filename) {
void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
ghoul_assert(FileSys.fileExists(filename), "The filename must exist");
std::ifstream file;
@@ -283,101 +293,87 @@ void TLETranslation::readTLEFile(const std::string& filename) {
double epoch = 0.0;
} keplerElements;
enum class State {
Initial = 0,
ReadFirstLine,
ReadSecondLine,
Finished = ReadSecondLine
};
State state = State::Initial;
std::string line;
while (std::getline(file, line)) {
if (line[0] == '1') {
// First line
// Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 08-08 Classification (U = Unclassified)
// 4 10-11 International Designator (Last two digits of launch year)
// 5 12-14 International Designator (Launch number of the year)
// 6 15-17 International Designator(piece of the launch) A
// 7 19-20 Epoch Year(last two digits of year)
// 8 21-32 Epoch(day of the year and fractional portion of the day)
// 9 34-43 First Time Derivative of the Mean Motion divided by two
// 10 45-52 Second Time Derivative of Mean Motion divided by six
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
// 12 63-63 The "Ephemeris type"
// 13 65-68 Element set number.Incremented when a new TLE is generated
// 14 69-69 Checksum (modulo 10)
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
state = State::ReadFirstLine;
}
else if (line[0] == '2') {
if (state != State::ReadFirstLine) {
throw ghoul::RuntimeError(
"Malformed TLE file: '" + filename + "'. Line 2 before line 1",
"TLETranslation"
);
}
// Second line
//Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 09-16 Inclination (degrees)
// 4 18-25 Right ascension of the ascending node (degrees)
// 5 27-33 Eccentricity (decimal point assumed)
// 6 35-42 Argument of perigee (degrees)
// 7 44-51 Mean Anomaly (degrees)
// 8 53-63 Mean Motion (revolutions per day)
// 9 64-68 Revolution number at epoch (revolutions)
// 10 69-69 Checksum (modulo 10)
std::stringstream stream;
stream.exceptions(std::ios::failbit);
// Get inclination
stream.str(line.substr(8, 8));
stream >> keplerElements.inclination;
stream.clear();
// Get Right ascension of the ascending node
stream.str(line.substr(17, 8));
stream >> keplerElements.ascendingNode;
stream.clear();
//Loop through and throw out lines until getting to the linNum of interest
for (unsigned int i = 1; i < lineNum; ++i)
std::getline(file, line);
std::getline(file, line); //Throw out the TLE title line (1st)
// Get Eccentricity
stream.str("0." + line.substr(26, 7));
stream >> keplerElements.eccentricity;
stream.clear();
// Get argument of periapsis
stream.str(line.substr(34, 8));
stream >> keplerElements.argumentOfPeriapsis;
stream.clear();
// Get mean anomaly
stream.str(line.substr(43, 8));
stream >> keplerElements.meanAnomaly;
stream.clear();
// Get mean motion
stream.str(line.substr(52, 11));
stream >> keplerElements.meanMotion;
state = State::ReadSecondLine;
break;
}
std::getline(file, line); //Get line 1 of TLE format
if (line[0] == '1') {
// First line
// Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 08-08 Classification (U = Unclassified)
// 4 10-11 International Designator (Last two digits of launch year)
// 5 12-14 International Designator (Launch number of the year)
// 6 15-17 International Designator(piece of the launch) A
// 7 19-20 Epoch Year(last two digits of year)
// 8 21-32 Epoch(day of the year and fractional portion of the day)
// 9 34-43 First Time Derivative of the Mean Motion divided by two
// 10 45-52 Second Time Derivative of Mean Motion divided by six
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
// 12 63-63 The "Ephemeris type"
// 13 65-68 Element set number.Incremented when a new TLE is generated
// 14 69-69 Checksum (modulo 10)
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
} else {
throw ghoul::RuntimeError("File " + filename + " @ line "
+ std::to_string(lineNum + 1) + " doesn't have '1' header");
}
if (state != State::Finished) {
throw ghoul::RuntimeError(
"Malformed TLE file: Line 1 or 2 missing",
"TLETranslation"
);
std::getline(file, line); //Get line 2 of TLE format
if (line[0] == '2') {
// Second line
//Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 09-16 Inclination (degrees)
// 4 18-25 Right ascension of the ascending node (degrees)
// 5 27-33 Eccentricity (decimal point assumed)
// 6 35-42 Argument of perigee (degrees)
// 7 44-51 Mean Anomaly (degrees)
// 8 53-63 Mean Motion (revolutions per day)
// 9 64-68 Revolution number at epoch (revolutions)
// 10 69-69 Checksum (modulo 10)
std::stringstream stream;
stream.exceptions(std::ios::failbit);
// Get inclination
stream.str(line.substr(8, 8));
stream >> keplerElements.inclination;
stream.clear();
// Get Right ascension of the ascending node
stream.str(line.substr(17, 8));
stream >> keplerElements.ascendingNode;
stream.clear();
// Get Eccentricity
stream.str("0." + line.substr(26, 7));
stream >> keplerElements.eccentricity;
stream.clear();
// Get argument of periapsis
stream.str(line.substr(34, 8));
stream >> keplerElements.argumentOfPeriapsis;
stream.clear();
// Get mean anomaly
stream.str(line.substr(43, 8));
stream >> keplerElements.meanAnomaly;
stream.clear();
// Get mean motion
stream.str(line.substr(52, 11));
stream >> keplerElements.meanMotion;
} else {
throw ghoul::RuntimeError("File " + filename + " @ line "
+ std::to_string(lineNum + 2) + " doesn't have '2' header");
}
file.close();
// Calculate the semi major axis based on the mean motion using kepler's laws
keplerElements.semiMajorAxis = calculateSemiMajorAxis(keplerElements.meanMotion);
+7 -1
View File
@@ -38,6 +38,11 @@ namespace openspace {
*/
class TLETranslation : public KeplerTranslation {
public:
struct FileFormatError : public ghoul::RuntimeError {
explicit FileFormatError(std::string offense);
std::string offense;
};
/**
* Constructor for the TLETranslation class. The \p dictionary must contain a key for
* the file that contains the TLE information. The ghoul::Dictionary will be tested
@@ -61,13 +66,14 @@ private:
* disallowed values (see KeplerTranslation::setKeplerElements), a
* KeplerTranslation::RangeError is thrown.
* \param filename The path to the file that contains the TLE file.
* \param lineNum The line number in the file where the set of 3 TLE lines starts
* \throw std::system_error if the TLE file is malformed (does not contain at least
* two lines that start with \c 1 and \c 2.
* \throw KeplerTranslation::RangeError If the Keplerian elements are outside of
* the valid range supported by Kepler::setKeplerElements
* \pre The \p filename must exist
*/
void readTLEFile(const std::string& filename);
void readTLEFile(const std::string& filename, int lineNum);
};
} // namespace openspace
+23
View File
@@ -0,0 +1,23 @@
--[[ OpenSpace keybinding script loaded from the satellites.scene file ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
-- Set focuses
openspace.bindKey(
"p" ,
"if gpsVis then gpsVis = false; else gpsVis = true; end; openspace.setPropertyValue('gps-ops*.renderable.enabled', not gpsVis)",
"Toggles visibility of gps satellites."
)
openspace.bindKey(
"s" ,
"if stVis then stVis = false; else stVis = true; end; openspace.setPropertyValue('station*.renderable.enabled', not stVis)",
"Toggles visibility of stations."
)
openspace.bindKey(
"g" ,
"if geoVis then geoVis = false; else geoVis = true; end; openspace.setPropertyValue('geo*.renderable.enabled', not geoVis)",
"Toggles visibility of geostationary."
)
+16 -1
View File
@@ -158,6 +158,7 @@ DownloadManager::DownloadManager(std::string requestURL, int applicationVersion,
std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadFile(
const std::string& url, const ghoul::filesystem::File& file, bool overrideFile,
bool failOnError, unsigned int timeout_secs,
DownloadFinishedCallback finishedCallback, DownloadProgressCallback progressCallback)
{
if (!overrideFile && FileSys.fileExists(file))
@@ -182,13 +183,23 @@ std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadFile(
//LDEBUG("Start downloading file: '" << url << "' into file '" << file.path() << "'");
auto downloadFunction = [url, finishedCallback, progressCallback, future, fp]() {
auto downloadFunction = [url,
failOnError,
timeout_secs,
finishedCallback,
progressCallback,
future,
fp]() {
CURL* curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeData);
if (timeout_secs)
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout_secs);
if (failOnError)
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
ProgressInformation p = {
future,
@@ -337,6 +348,8 @@ std::vector<std::shared_ptr<DownloadManager::FileFuture>> DownloadManager::downl
line,
destination.path() + "/" + file,
overrideFiles,
false,
0,
[](const FileFuture& f) { LDEBUG("Finished: " << f.filePath); }
);
if (future)
@@ -349,6 +362,8 @@ std::vector<std::shared_ptr<DownloadManager::FileFuture>> DownloadManager::downl
fullRequest,
requestFile,
true,
false,
0,
callback
);
+6
View File
@@ -1242,6 +1242,12 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
"",
"Writes out documentation files"
},
{
"downloadFile",
&luascriptfunctions::downloadFile,
"",
"Downloads a file from Lua scope"
},
{
"addVirtualProperty",
&luascriptfunctions::addVirtualProperty,
+25
View File
@@ -139,6 +139,31 @@ int removeAllVirtualProperties(lua_State* L) {
return 0;
}
/**
* \ingroup LuaScripts
* downloadFile():
* Downloads a file from Lua interpreter
*/
int downloadFile(lua_State* L) {
int nArguments = lua_gettop(L);
if (nArguments != 2)
return luaL_error(L, "Expected %i arguments, got %i", 2, nArguments);
std::string uri = luaL_checkstring(L, -2);
std::string savePath = luaL_checkstring(L, -1);
const std::string _loggerCat = "OpenSpaceEngine";
LINFO("Downloading file from " << uri);
DownloadManager dm = openspace::DownloadManager("", 1, false);
std::shared_ptr<openspace::DownloadManager::FileFuture> future =
dm.downloadFile(uri, absPath("${SCENE}/" + savePath), true, true, 5);
if (!future || (future && !future->isFinished)) {
std::string errorMsg = "Download failed";
if (future)
errorMsg += ": " + future->errorMessage;
return luaL_error(L, errorMsg.c_str());
}
return 1;
}
} // namespace luascriptfunctions
} // namespace openspace