diff --git a/data/scene/osirisrex.scene b/data/scene/osirisrex.scene index ba42cfe1e8..65d1e13774 100644 --- a/data/scene/osirisrex.scene +++ b/data/scene/osirisrex.scene @@ -10,8 +10,6 @@ function preInitialization() critical objects. ]]-- - dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua')) - -- Load Spice Kernels openspace.spice.loadKernel("${OPENSPACE_DATA}/spice/de430_1850-2150.bsp") @@ -142,6 +140,9 @@ function preInitialization() -- Load planetary constants openspace.spice.loadKernel("${SPICE}/pck00010.tpc") + dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua')) + dofile(openspace.absPath('${SCRIPTS}/bind_keys_osirisrex.lua')) + -- openspace.time.setTime("2018-12-20T22:47:00.00") --openspace.time.setTime("2019-05-25T03:57:55.00") --openspace.time.setTime("2016 SEP 8 23:05:00.50") diff --git a/modules/newhorizons/util/instrumenttimesparser.cpp b/modules/newhorizons/util/instrumenttimesparser.cpp index de20b5b2bb..4b0b679a12 100644 --- a/modules/newhorizons/util/instrumenttimesparser.cpp +++ b/modules/newhorizons/util/instrumenttimesparser.cpp @@ -104,54 +104,50 @@ bool InstrumentTimesParser::create() { // Read file into string std::ifstream inFile(filepath); - std::string line; std::smatch matches; - TimeRange instrumentActiveTimeRange; - bool sucessfulRead = false; - + bool successfulRead = true; while (std::getline(inFile, line)) { if (std::regex_match(line, matches, _pattern)) { - try { - if (matches.size() != 3) { - throw ghoul::RuntimeError("Bad event data formatting. Must \ + if (matches.size() != 3) { + LERROR("Bad event data formatting. Must \ have regex 3 matches (source string, start time, stop time)."); - } + successfulRead = false; + break; + } + + TimeRange captureTimeRange; + try { // parse date strings std::string start = matches[1].str(); std::string stop = matches[2].str(); - - TimeRange captureTimeRange; captureTimeRange.start = SpiceManager::ref().ephemerisTimeFromDate(start); captureTimeRange.end = SpiceManager::ref().ephemerisTimeFromDate(stop); - - instrumentActiveTimeRange.include(captureTimeRange); - - //_instrumentTimes.push_back({ instrumentID, timeRange }); - _targetTimes.push_back({ captureTimeRange.start, _target }); - _captureProgression.push_back(captureTimeRange.start); - - Image image; - image.timeRange = captureTimeRange; - image.path = ""; - image.isPlaceholder = true; - image.activeInstruments.push_back(instrumentID); - image.target = _target; - image.projected = false; - - _subsetMap[_target]._subset.push_back(image); - - sucessfulRead = true; } - catch (const ghoul::RuntimeError& e) { + catch (const SpiceManager::SpiceException& e){ LERROR(e.what()); - sucessfulRead = false; - continue; + successfulRead = false; + break; } + + instrumentActiveTimeRange.include(captureTimeRange); + + //_instrumentTimes.push_back({ instrumentID, timeRange }); + _targetTimes.push_back({ captureTimeRange.start, _target }); + _captureProgression.push_back(captureTimeRange.start); + + Image image; + image.timeRange = captureTimeRange; + image.path = ""; + image.isPlaceholder = true; + image.activeInstruments.push_back(instrumentID); + image.target = _target; + image.projected = false; + + _subsetMap[_target]._subset.push_back(image); } } - if (sucessfulRead) - { + if (successfulRead){ _subsetMap[_target]._range.include(instrumentActiveTimeRange); _instrumentTimes.push_back({ instrumentID, instrumentActiveTimeRange }); } diff --git a/scripts/bind_keys.lua b/scripts/bind_keys.lua index 3dba610ecf..1a0c56dcad 100644 --- a/scripts/bind_keys.lua +++ b/scripts/bind_keys.lua @@ -6,10 +6,19 @@ dofile(openspace.absPath('${SCRIPTS}/common.lua')) openspace.clearKeys() helper.setCommonKeys() helper.setDeltaTimeKeys({ - 1, 5, 10, 20, 40, 60, 120, 360, 720, 1440, - 2880, 5760, 11520, 23040, 46080, 92160, 184320, 368640, 737280, 1474560, - 2949120, 5898240, 11796480, 23592960, 47185920, 94371840, 188743680, 377487360 +-- 1 2 3 4 5 6 7 8 9 0 +-------------------------------------------------------------------------------------------------------------------------- +-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30 min + 1, 2, 5, 10, 30, 60, 120, 300, 600, 1800, + +-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w + 3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600, + +-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y + 2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000 }) +-- OBS: One month (1mo) is approximated by 30 days. + openspace.bindKey("q", helper.renderable.toggle('SunMarker')) openspace.bindKey("e", helper.renderable.toggle('EarthMarker')) diff --git a/scripts/bind_keys_osirisrex.lua b/scripts/bind_keys_osirisrex.lua new file mode 100644 index 0000000000..14dce2872a --- /dev/null +++ b/scripts/bind_keys_osirisrex.lua @@ -0,0 +1,31 @@ +--[[ OpenSpace keybinding script ]]-- + +-- Load the common helper functions +dofile(openspace.absPath('${SCRIPTS}/common.lua')) + +--openspace.clearKeys() +helper.setCommonKeys() + +-- Set focuses +openspace.bindKey("o", "openspace.setPropertyValue('Interaction.origin', 'OsirisRex')") +openspace.bindKey("b", "openspace.setPropertyValue('Interaction.origin', 'Bennu2')") + + +-- Quickfix backjumps in Osiris rex +openspace.bindKey("F6" , "openspace.printInfo('Set time: Launch'); openspace.time.setTime('2016 SEP 08 23:05:00');") +openspace.bindKey("F7" , "openspace.printInfo('Set time: Gravity Assist'); openspace.time.setTime('2017 SEP 22 15:00:00');") +openspace.bindKey("F8" , "openspace.printInfo('Set time: Approach'); openspace.time.setTime('2018-SEP-11 21:31:01.183');") +openspace.bindKey("F9" , "openspace.printInfo('Set time: Preliminary Survey'); openspace.time.setTime('2018-NOV-20 01:13:12.183');") +openspace.bindKey("F10", "openspace.printInfo('Set time: Orbital B'); openspace.time.setTime('2019-APR-08 10:35:27.186');") +openspace.bindKey("F11", "openspace.printInfo('Set time: Recon'); openspace.time.setTime('2019-MAY-25 03:50:31.195');") +-- OBS!! Avoid key F12 +-- Pressing F12 triggers a breakpoint on AMNH Windows machine, with with the following stack trace: +-- ntdll.dll!DbgBreakPoint() +-- ntdll.dll!DbgUiRemoteBreakin() +-- kernel32.dll!BaseThreadInitThunk() +-- ntdll.dll!RtUserThreadStart() + +openspace.bindKey("q", helper.property.invert('SunMarker.renderable.enabled')) +openspace.bindKey("e", helper.property.invert('EarthMarker.renderable.enabled')) + +openspace.bindKey("c", "openspace.parallel.setAddress('130.236.142.51');openspace.parallel.setPassword('osiris2016');openspace.parallel.connect();")