From 49308c658c9d5519710771b49af6b3e88a686850 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 24 Sep 2016 19:32:42 +0200 Subject: [PATCH] Moved Missions from NewHorizons module into core --- .../osirisrex/osirisrex/osirisrex.mission | 474 +++++++++++++----- include/openspace/mission/mission.h | 91 ++++ .../openspace/mission}/missionmanager.h | 62 +-- modules/newhorizons/CMakeLists.txt | 2 - src/CMakeLists.txt | 5 + .../mission/mission.cpp | 137 ++--- .../mission/missionmanager.cpp | 119 +---- src/rendering/renderengine.cpp | 2 +- 8 files changed, 511 insertions(+), 381 deletions(-) create mode 100644 include/openspace/mission/mission.h rename {modules/newhorizons/util => include/openspace/mission}/missionmanager.h (71%) rename modules/newhorizons/util/missionmanager.cpp => src/mission/mission.cpp (69%) rename modules/newhorizons/util/missionphasesequencer.cpp => src/mission/missionmanager.cpp (61%) diff --git a/data/scene/osirisrex/osirisrex/osirisrex.mission b/data/scene/osirisrex/osirisrex/osirisrex.mission index 5152f5fda4..3e35cffd28 100644 --- a/data/scene/osirisrex/osirisrex/osirisrex.mission +++ b/data/scene/osirisrex/osirisrex/osirisrex.mission @@ -24,125 +24,363 @@ References: --]] -return -{ Name = "OSIRIS-REx", Phases = { - - -- All 1-level phases based on [1] - { Name = "Planning and Fabrication", TimeRange = { Start = "2012 JAN 01 00:00:00", End = "2016 SEP 08 23:05:00" } }, - { Name = "Outbound Cruise", TimeRange = { Start = "2016 SEP 03 00:00:00", End = "2018 SEP 01 01:00:00" }, Phases = { - - -- Phases from [4] - { Name = "Pre Launch", TimeRange = { Start = "2016 SEP 03 01:00:00", End = "2016 SEP 08 23:05:05" } }, - { Name = "Launch", TimeRange = { Start = "2016 SEP 08 23:05:05", End = "2016 SEP 08 23:09:00" } }, - { Name = "Earth Orbit", TimeRange = { Start = "2016 SEP 08 23:09:00", End = "2016 SEP 08 23:45:00" } }, - { Name = "Solar Orbit", TimeRange = { Start = "2016 SEP 08 23:45:00", End = "2018 SEP 01 00:00:00" } }, - { Name = "Upcoming Gravity Assist", TimeRange = { Start = "2017 JAN 22 15:00:00", End = "2017 SEP 22 15:00:00" } }, - { Name = "Gravity Assist", TimeRange = { Start = "2017 SEP 22 15:00:00", End = "2017 SEP 22 21:00:00" } }, - - } }, - - { Name = "Asteroid Operations", Phases = { - - -- Nested Levels from [3] - { Name = "03_Approach", Phases = { - { Name = "DustSearch_v1", Phases = { - { Name = "Phase03_AP_DustSearch_1.bc", TimeRange = { Start = "2018-SEP-11 21:31:01.183", End = "2018-SEP-12 02:18:41.183" }}, - }}, - { Name = "LightCurve_v1", Phases = { - { Name = "Phase03_AP_LightCurve_1.bc", TimeRange = { Start = "2018-OCT-09 21:50:48.182", End = "2018-OCT-10 02:33:16.183" }}, - { Name = "Phase03_AP_LightCurve_2.bc", TimeRange = { Start = "2018-OCT-10 21:50:48.182", End = "2018-OCT-11 02:33:16.183" }}, - }}, - { Name = "NatSatSearch_v1", Phases = { - { Name = "Phase03_AP_SatSearch_1.bc", TimeRange = { Start = "2018-OCT-26 19:38:30.183", End = "2018-OCT-27 00:22:34.183" }}, - { Name = "Phase03_AP_SatSearch_2.bc", TimeRange = { Start = "2018-NOV-05 17:10:20.183", End = "2018-NOV-05 21:59:48.183" }}, - }}, - { Name = "PhaseFunction_v1", Phases = { - { Name = "Phase03_AP_PhaseFunction_1.bc", TimeRange = { Start = "2018-OCT-12 21:42:26.183", End = "2018-OCT-13 02:24:54.183" }}, - }}, - { Name = "ShapeModel_v1", Phases = { - { Name = "Phase03_AP_ShapeModel_1.bc", TimeRange = { Start = "2018-NOV-09 11:02:59.183", End = "2018-NOV-09 15:52:27.183" }}, - { Name = "Phase03_AP_ShapeModel_2.bc", TimeRange = { Start = "2018-NOV-10 11:02:59.183", End = "2018-NOV-10 15:52:27.183" }}, - { Name = "Phase03_AP_ShapeModel_3.bc", TimeRange = { Start = "2018-NOV-11 11:02:59.183", End = "2018-NOV-11 15:52:27.183" }}, - { Name = "Phase03_AP_ShapeModel_4.bc", TimeRange = { Start = "2018-NOV-12 11:02:59.183", End = "2018-NOV-12 15:52:27.183" }}, - { Name = "Phase03_AP_ShapeModel_5.bc", TimeRange = { Start = "2018-NOV-13 11:02:59.183", End = "2018-NOV-13 15:52:27.183" }}, - { Name = "Phase03_AP_ShapeModel_6.bc", TimeRange = { Start = "2018-NOV-14 11:03:53.183", End = "2018-NOV-14 15:51:33.183" }}, - { Name = "Phase03_AP_ShapeModel_7.bc", TimeRange = { Start = "2018-NOV-15 11:03:53.183", End = "2018-NOV-15 15:51:33.183" }}, - { Name = "Phase03_AP_ShapeModel_8.bc", TimeRange = { Start = "2018-NOV-16 11:03:53.183", End = "2018-NOV-16 15:51:33.183" }}, - { Name = "Phase03_AP_ShapeModel_9_Forced4x4.bc", TimeRange = { Start = "2018-NOV-17 11:03:54.183", End = "2018-NOV-17 15:51:34.183" }}, - }}, - { Name = "SpectraMap_v1", Phases = { - { Name = "Phase03_AP_SpectraMap_1.bc", TimeRange = { Start = "2018-OCT-30 20:44:53.183", End = "2018-OCT-31 01:34:21.183" }}, - }}, - }}, - { Name = "04_PrelimSurvey", Phases = { - { Name = "MapCamOLA_v1", Phases = { - { Name = "Phase04_PS_MC_1_v1_1a.bc", TimeRange = { Start = "2018-NOV-20 01:13:12.183", End = "2018-NOV-20 06:13:04.183" }}, - { Name = "Phase04_PS_MC_2_v1_1a.bc", TimeRange = { Start = "2018-NOV-28 01:13:12.183", End = "2018-NOV-28 06:13:04.183" }}, - }}, - { Name = "OLA_v1", Phases = { - { Name = "Phase04_PS_OLA_Nominal_1.bc", TimeRange = { Start = "2018-NOV-19 22:30:00.184", End = "2018-NOV-19 23:19:28.183" }}, - { Name = "Phase04_PS_OLA_Nominal_2.bc", TimeRange = { Start = "2018-NOV-23 22:19:34.184", End = "2018-NOV-23 23:19:26.183" }}, - { Name = "Phase04_PS_OLA_Nominal_3.bc", TimeRange = { Start = "2018-NOV-24 00:48:38.184", End = "2018-NOV-24 01:38:06.184" }}, - { Name = "Phase04_PS_OLA_Nominal_4.bc", TimeRange = { Start = "2018-NOV-27 22:29:58.184", End = "2018-NOV-27 23:19:26.183" }}, - }}, - { Name = "PolyCam_v1", Phases = { - { Name = "Phase04_PS_PolyCam_1.bc", TimeRange = { Start = "2018-NOV-19 12:00:33.183", End = "2018-NOV-19 16:46:25.183" }}, - { Name = "Phase04_PS_PolyCam_2.bc", TimeRange = { Start = "2018-NOV-20 07:10:26.183", End = "2018-NOV-20 12:10:18.183" }}, - { Name = "Phase04_PS_PolyCam_3.bc", TimeRange = { Start = "2018-NOV-23 11:51:29.184", End = "2018-NOV-23 16:51:21.184" }}, - { Name = "Phase04_PS_PolyCam_4.bc", TimeRange = { Start = "2018-NOV-24 07:17:39.184", End = "2018-NOV-24 12:03:31.184" }}, - { Name = "Phase04_PS_PolyCam_5.bc", TimeRange = { Start = "2018-NOV-27 12:00:20.184", End = "2018-NOV-27 16:46:12.184" }}, - { Name = "Phase04_PS_PolyCam_6.bc", TimeRange = { Start = "2018-NOV-28 07:10:35.183", End = "2018-NOV-28 12:10:27.183" }}, - }}, - }}, - { Name = "06_DetailedSurvey", Phases = { - { Name = "BaseballDiamond_v2", Phases = { - { Name = "atl_19013_18_BBD1_v2.bc", TimeRange = { Start = "2019-JAN-13 18:59:31.195", End = "2019-JAN-13 23:59:29.179" }}, - { Name = "atl_19014_16_BBD2_v2.bc", TimeRange = { Start = "2019-JAN-14 16:56:01.185", End = "2019-JAN-14 21:55:58.219" }}, - { Name = "atl_19020_18_BBD3_v2.bc", TimeRange = { Start = "2019-JAN-20 18:59:15.211", End = "2019-JAN-20 23:59:13.195" }}, - { Name = "atl_19021_19_BBD4_v2.bc", TimeRange = { Start = "2019-JAN-21 19:26:47.179", End = "2019-JAN-22 00:26:44.213" }}, - }}, - { Name = "EquatorialStations_v1", Phases = { - { Name = "Phase06_DS_Equatorial_Stations_1.bc", TimeRange = { Start = "2019-JAN-27 10:36:24.185", End = "2019-JAN-27 15:20:28.185" }}, - { Name = "Phase06_DS_Equatorial_Stations_2.bc", TimeRange = { Start = "2019-FEB-03 10:35:30.185", End = "2019-FEB-03 15:21:22.185" }}, - { Name = "Phase06_DS_Equatorial_Stations_3.bc", TimeRange = { Start = "2019-FEB-10 10:51:50.185", End = "2019-FEB-10 15:51:42.185" }}, - { Name = "Phase06_DS_Equatorial_Stations_4.bc", TimeRange = { Start = "2019-FEB-17 10:29:11.186", End = "2019-FEB-17 15:29:03.186" }}, - { Name = "Phase06_DS_Equatorial_Stations_5.bc", TimeRange = { Start = "2019-FEB-24 10:08:28.186", End = "2019-FEB-24 15:08:20.185" }}, - { Name = "Phase06_DS_Equatorial_Stations_6.bc", TimeRange = { Start = "2019-MAR-03 09:52:58.186", End = "2019-MAR-03 14:42:26.186" }}, - { Name = "Phase06_DS_Equatorial_Stations_7.bc", TimeRange = { Start = "2019-MAR-10 09:57:47.186", End = "2019-MAR-10 14:36:33.186" }}, - }}, - { Name = "PlumeSearch_v1", Phases = { - { Name = "Phase06_DS_Plume_Search_1.bc", TimeRange = { Start = "2019-JAN-28 10:34:36.185", End = "2019-JAN-28 15:22:16.185" }}, - { Name = "Phase06_DS_Plume_Search_2.bc", TimeRange = { Start = "2019-FEB-18 10:29:11.186", End = "2019-FEB-18 15:29:03.186" }}, - }}, - }}, - { Name = "07_OrbitalB", Phases = { - { Name = "CandidateSampleSite_v1", Phases = { - { Name = "Phase07_OB_CSS_Mapping_1.bc", TimeRange = { Start = "2019-APR-08 10:35:27.186", End = "2019-APR-08 15:22:06.186" }}, - { Name = "Phase07_OB_CSS_Mapping_2.bc", TimeRange = { Start = "2019-APR-08 16:16:06.186", End = "2019-APR-11 10:38:58.186" }}, - { Name = "Phase07_OB_CSS_Mapping_3.bc", TimeRange = { Start = "2019-APR-22 17:51:23.186", End = "2019-APR-29 19:41:03.186" }}, - }}, - }}, - { Name = "08_Recon", Phases = { - { Name = "225m_Sortie_v2", Phases = { - { Name = "Recon_225mSortie_Case02_0Latitude.bc", TimeRange = { Start = "2019-MAY-25 03:50:31.195", End = "2019-MAY-25 04:32:17.227" }}, - { Name = "Recon_225mSortie_Case05_20negLatitude.bc", TimeRange = { Start = "2019-MAY-25 03:50:48.216", End = "2019-MAY-25 04:37:10.209" }}, - { Name = "Recon_225mSortie_Case08_40negLatitude.bc", TimeRange = { Start = "2019-MAY-25 04:02:43.176", End = "2019-MAY-25 04:54:41.179" }}, - { Name = "Recon_225mSortie_Case11_60negLatitude.bc", TimeRange = { Start = "2019-MAY-25 04:21:46.161", End = "2019-MAY-25 05:18:44.232" }}, - }}, - { Name = "525m_Sortie_v2", Phases = { - { Name = "Recon_525mSortie_Case02_0Latitude.bc", TimeRange = { Start = "2019-MAY-25 04:06:39.220", End = "2019-MAY-25 04:44:17.198" }}, - { Name = "Recon_525mSortie_Case05_20negLatitude.bc", TimeRange = { Start = "2019-MAY-25 04:11:39.201", End = "2019-MAY-25 04:49:37.224" }}, - { Name = "Recon_525mSortie_Case05_NominalProfile.bc", TimeRange = { Start = "2019-MAY-25 03:01:50.184", End = "2019-MAY-25 06:38:50.232" }}, - { Name = "Recon_525mSortie_Case08_NominalProfile.bc", TimeRange = { Start = "2019-MAY-25 03:01:50.184", End = "2019-MAY-25 06:38:50.232" }}, - }}, - }}, +return { + Name = "OSIRIS-REx", + Phases = { + -- All 1-level phases based on [1] + { + Name = "Planning and Fabrication", + TimeRange = { Start = "2012 JAN 01 00:00:00", End = "2016 SEP 08 23:05:00" } + }, + { + Name = "Outbound Cruise", + TimeRange = { Start = "2016 SEP 03 00:00:00", End = "2018 SEP 01 01:00:00" }, + Phases = { + -- Phases from [4] + { + Name = "Pre Launch", + TimeRange = { Start = "2016 SEP 03 01:00:00", End = "2016 SEP 08 23:05:05" } + }, + { + Name = "Launch", TimeRange = { Start = "2016 SEP 08 23:05:05", End = "2016 SEP 08 23:09:00" } + }, + { + Name = "Earth Orbit", TimeRange = { Start = "2016 SEP 08 23:09:00", End = "2016 SEP 08 23:45:00" } + }, + { + Name = "Solar Orbit", TimeRange = { Start = "2016 SEP 08 23:45:00", End = "2018 SEP 01 00:00:00" } + }, + { + Name = "Upcoming Gravity Assist", TimeRange = { Start = "2017 JAN 22 15:00:00", End = "2017 SEP 22 15:00:00" } + }, + { + Name = "Gravity Assist", TimeRange = { Start = "2017 SEP 22 15:00:00", End = "2017 SEP 22 21:00:00" } + } + } + }, + { + Name = "Asteroid Operations", + Phases = { + -- Nested Levels from [3] + { + Name = "03_Approach", Phases = { + { + Name = "DustSearch_v1", + Phases = { + { + Name = "Phase03_AP_DustSearch_1.bc", + TimeRange = { Start = "2018-SEP-11 21:31:01.183", End = "2018-SEP-12 02:18:41.183" } + } + } + }, + { + Name = "LightCurve_v1", + Phases = { + { + Name = "Phase03_AP_LightCurve_1.bc", + TimeRange = { Start = "2018-OCT-09 21:50:48.182", End = "2018-OCT-10 02:33:16.183" } + }, + { + Name = "Phase03_AP_LightCurve_2.bc", + TimeRange = { Start = "2018-OCT-10 21:50:48.182", End = "2018-OCT-11 02:33:16.183" } + } + } + }, + { + Name = "NatSatSearch_v1", + Phases = { + { + Name = "Phase03_AP_SatSearch_1.bc", + TimeRange = { Start = "2018-OCT-26 19:38:30.183", End = "2018-OCT-27 00:22:34.183" } + }, + { + Name = "Phase03_AP_SatSearch_2.bc", + TimeRange = { Start = "2018-NOV-05 17:10:20.183", End = "2018-NOV-05 21:59:48.183" } + } + } + }, + { + Name = "PhaseFunction_v1", + Phases = { + { + Name = "Phase03_AP_PhaseFunction_1.bc", + TimeRange = { Start = "2018-OCT-12 21:42:26.183", End = "2018-OCT-13 02:24:54.183" } + } + } + }, + { + Name = "ShapeModel_v1", Phases = { + { + Name = "Phase03_AP_ShapeModel_1.bc", + TimeRange = { Start = "2018-NOV-09 11:02:59.183", End = "2018-NOV-09 15:52:27.183" } + }, + { + Name = "Phase03_AP_ShapeModel_2.bc", + TimeRange = { Start = "2018-NOV-10 11:02:59.183", End = "2018-NOV-10 15:52:27.183" } + }, + { + Name = "Phase03_AP_ShapeModel_3.bc", + TimeRange = { Start = "2018-NOV-11 11:02:59.183", End = "2018-NOV-11 15:52:27.183" } + }, + { + Name = "Phase03_AP_ShapeModel_4.bc", + TimeRange = { Start = "2018-NOV-12 11:02:59.183", End = "2018-NOV-12 15:52:27.183" } + }, + { + Name = "Phase03_AP_ShapeModel_5.bc", + TimeRange = { Start = "2018-NOV-13 11:02:59.183", End = "2018-NOV-13 15:52:27.183" } + }, + { + Name = "Phase03_AP_ShapeModel_6.bc", + TimeRange = { Start = "2018-NOV-14 11:03:53.183", End = "2018-NOV-14 15:51:33.183" } + }, + { + Name = "Phase03_AP_ShapeModel_7.bc", + TimeRange = { Start = "2018-NOV-15 11:03:53.183", End = "2018-NOV-15 15:51:33.183" } + }, + { + Name = "Phase03_AP_ShapeModel_8.bc", + TimeRange = { Start = "2018-NOV-16 11:03:53.183", End = "2018-NOV-16 15:51:33.183" } + }, + { + Name = "Phase03_AP_ShapeModel_9_Forced4x4.bc", + TimeRange = { Start = "2018-NOV-17 11:03:54.183", End = "2018-NOV-17 15:51:34.183" } + } + } + }, + { + Name = "SpectraMap_v1", + Phases = { + { + Name = "Phase03_AP_SpectraMap_1.bc", + TimeRange = { Start = "2018-OCT-30 20:44:53.183", End = "2018-OCT-31 01:34:21.183" } + } + } + } + } + }, + { + Name = "04_PrelimSurvey", + Phases = { + { + Name = "MapCamOLA_v1", + Phases = { + { + Name = "Phase04_PS_MC_1_v1_1a.bc", + TimeRange = { Start = "2018-NOV-20 01:13:12.183", End = "2018-NOV-20 06:13:04.183" } + }, + { + Name = "Phase04_PS_MC_2_v1_1a.bc", + TimeRange = { Start = "2018-NOV-28 01:13:12.183", End = "2018-NOV-28 06:13:04.183" } + } + } + }, + { + Name = "OLA_v1", + Phases = { + { + Name = "Phase04_PS_OLA_Nominal_1.bc", + TimeRange = { Start = "2018-NOV-19 22:30:00.184", End = "2018-NOV-19 23:19:28.183" } + }, + { + Name = "Phase04_PS_OLA_Nominal_2.bc", + TimeRange = { Start = "2018-NOV-23 22:19:34.184", End = "2018-NOV-23 23:19:26.183" } + }, + { + Name = "Phase04_PS_OLA_Nominal_3.bc", + TimeRange = { Start = "2018-NOV-24 00:48:38.184", End = "2018-NOV-24 01:38:06.184" } + }, + { + Name = "Phase04_PS_OLA_Nominal_4.bc", + TimeRange = { Start = "2018-NOV-27 22:29:58.184", End = "2018-NOV-27 23:19:26.183" } + } + } + }, + { + Name = "PolyCam_v1", + Phases = { + { + Name = "Phase04_PS_PolyCam_1.bc", + TimeRange = { Start = "2018-NOV-19 12:00:33.183", End = "2018-NOV-19 16:46:25.183" } + }, + { + Name = "Phase04_PS_PolyCam_2.bc", + TimeRange = { Start = "2018-NOV-20 07:10:26.183", End = "2018-NOV-20 12:10:18.183" } + }, + { + Name = "Phase04_PS_PolyCam_3.bc", + TimeRange = { Start = "2018-NOV-23 11:51:29.184", End = "2018-NOV-23 16:51:21.184" } + }, + { + Name = "Phase04_PS_PolyCam_4.bc", + TimeRange = { Start = "2018-NOV-24 07:17:39.184", End = "2018-NOV-24 12:03:31.184" } + }, + { + Name = "Phase04_PS_PolyCam_5.bc", + TimeRange = { Start = "2018-NOV-27 12:00:20.184", End = "2018-NOV-27 16:46:12.184" } + }, + { + Name = "Phase04_PS_PolyCam_6.bc", + TimeRange = { Start = "2018-NOV-28 07:10:35.183", End = "2018-NOV-28 12:10:27.183" } + } + } + }, + } + }, + { + Name = "06_DetailedSurvey", + Phases = { + { + Name = "BaseballDiamond_v2", + Phases = { + { + Name = "atl_19013_18_BBD1_v2.bc", + TimeRange = { Start = "2019-JAN-13 18:59:31.195", End = "2019-JAN-13 23:59:29.179" } + }, + { + Name = "atl_19014_16_BBD2_v2.bc", + TimeRange = { Start = "2019-JAN-14 16:56:01.185", End = "2019-JAN-14 21:55:58.219" } + }, + { + Name = "atl_19020_18_BBD3_v2.bc", + TimeRange = { Start = "2019-JAN-20 18:59:15.211", End = "2019-JAN-20 23:59:13.195" } + }, + { + Name = "atl_19021_19_BBD4_v2.bc", + TimeRange = { Start = "2019-JAN-21 19:26:47.179", End = "2019-JAN-22 00:26:44.213" } + } + } + }, + { + Name = "EquatorialStations_v1", + Phases = { + { + Name = "Phase06_DS_Equatorial_Stations_1.bc", + TimeRange = { Start = "2019-JAN-27 10:36:24.185", End = "2019-JAN-27 15:20:28.185" } + }, + { + Name = "Phase06_DS_Equatorial_Stations_2.bc", + TimeRange = { Start = "2019-FEB-03 10:35:30.185", End = "2019-FEB-03 15:21:22.185" } + }, + { + Name = "Phase06_DS_Equatorial_Stations_3.bc", + TimeRange = { Start = "2019-FEB-10 10:51:50.185", End = "2019-FEB-10 15:51:42.185" } + }, + { + Name = "Phase06_DS_Equatorial_Stations_4.bc", + TimeRange = { Start = "2019-FEB-17 10:29:11.186", End = "2019-FEB-17 15:29:03.186" } + }, + { + Name = "Phase06_DS_Equatorial_Stations_5.bc", + TimeRange = { Start = "2019-FEB-24 10:08:28.186", End = "2019-FEB-24 15:08:20.185" } + }, + { + Name = "Phase06_DS_Equatorial_Stations_6.bc", + TimeRange = { Start = "2019-MAR-03 09:52:58.186", End = "2019-MAR-03 14:42:26.186" } + }, + { + Name = "Phase06_DS_Equatorial_Stations_7.bc", + TimeRange = { Start = "2019-MAR-10 09:57:47.186", End = "2019-MAR-10 14:36:33.186" } + } + } + }, + { + Name = "PlumeSearch_v1", + Phases = { + { + Name = "Phase06_DS_Plume_Search_1.bc", + TimeRange = { Start = "2019-JAN-28 10:34:36.185", End = "2019-JAN-28 15:22:16.185" } + }, + { + Name = "Phase06_DS_Plume_Search_2.bc", + TimeRange = { Start = "2019-FEB-18 10:29:11.186", End = "2019-FEB-18 15:29:03.186" } + } + } + } + } + }, + { + Name = "07_OrbitalB", + Phases = { + { + Name = "CandidateSampleSite_v1", + Phases = { + { + Name = "Phase07_OB_CSS_Mapping_1.bc", + TimeRange = { Start = "2019-APR-08 10:35:27.186", End = "2019-APR-08 15:22:06.186" } + }, + { + Name = "Phase07_OB_CSS_Mapping_2.bc", + TimeRange = { Start = "2019-APR-08 16:16:06.186", End = "2019-APR-11 10:38:58.186" } + }, + { + Name = "Phase07_OB_CSS_Mapping_3.bc", + TimeRange = { Start = "2019-APR-22 17:51:23.186", End = "2019-APR-29 19:41:03.186" } + } + } + } + } + }, + { + Name = "08_Recon", + Phases = { + { + Name = "225m_Sortie_v2", + Phases = { + { + Name = "Recon_225mSortie_Case02_0Latitude.bc", + TimeRange = { Start = "2019-MAY-25 03:50:31.195", End = "2019-MAY-25 04:32:17.227" } + }, + { + Name = "Recon_225mSortie_Case05_20negLatitude.bc", + TimeRange = { Start = "2019-MAY-25 03:50:48.216", End = "2019-MAY-25 04:37:10.209" } + }, + { + Name = "Recon_225mSortie_Case08_40negLatitude.bc", + TimeRange = { Start = "2019-MAY-25 04:02:43.176", End = "2019-MAY-25 04:54:41.179" } + }, + { + Name = "Recon_225mSortie_Case11_60negLatitude.bc", + TimeRange = { Start = "2019-MAY-25 04:21:46.161", End = "2019-MAY-25 05:18:44.232" } + } + } + }, + { + Name = "525m_Sortie_v2", + Phases = { + { + Name = "Recon_525mSortie_Case02_0Latitude.bc", + TimeRange = { Start = "2019-MAY-25 04:06:39.220", End = "2019-MAY-25 04:44:17.198" } + }, + { + Name = "Recon_525mSortie_Case05_20negLatitude.bc", + TimeRange = { Start = "2019-MAY-25 04:11:39.201", End = "2019-MAY-25 04:49:37.224" } + }, + { + Name = "Recon_525mSortie_Case05_NominalProfile.bc", + TimeRange = { Start = "2019-MAY-25 03:01:50.184", End = "2019-MAY-25 06:38:50.232" } + }, + { + Name = "Recon_525mSortie_Case08_NominalProfile.bc", + TimeRange = { Start = "2019-MAY-25 03:01:50.184", End = "2019-MAY-25 06:38:50.232" } + } + } + } + } + } -- End of [3] - }}, - - { Name = "Backup Time", TimeRange = { Start = "2020 JAN 01 00:00:00", End = "2021 JAN 01 00:00:00" } }, - { Name = "Return Cruise", TimeRange = { Start = "2021 JAN 01 00:00:00", End = "2023 SEP 20 00:00:00" } }, - + } + }, + { + Name = "Backup Time", + TimeRange = { Start = "2020 JAN 01 00:00:00", End = "2021 JAN 01 00:00:00" } + }, + { + Name = "Return Cruise", + TimeRange = { Start = "2021 JAN 01 00:00:00", End = "2023 SEP 20 00:00:00"} + }, -- Not too interesting in terms of space visualization --> out commented -- { Name = "Sample Analysis", TimeRange = { Start = "2023 JAN 01 00:00:00", End = "2025 JUN 01 00:00:00" } }, -- End of [1] -}} \ No newline at end of file + } +} diff --git a/include/openspace/mission/mission.h b/include/openspace/mission/mission.h new file mode 100644 index 0000000000..c879bb4837 --- /dev/null +++ b/include/openspace/mission/mission.h @@ -0,0 +1,91 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2016 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#ifndef __MISSION_H__ +#define __MISSION_H__ + +#include + +#include +#include +#include + +namespace ghoul { class Dictionary; } + +namespace openspace { + +/** +* Used to represent a named period of time within a mission. Allows nested phases, i.e. +* phases within phases. Designed for WORM usage (Write Once, Read Multiple), and therefor +* has only accessors. +*/ +class MissionPhase { +public: + MissionPhase() = default; + MissionPhase(const ghoul::Dictionary& dict); + + const std::string& name() const; + + const TimeRange& timeRange() const; + + const std::string& description() const; + + /** + * Returns all subphases sorted by start time + */ + const std::vector& phases() const; + + /** + * Returns the i:th subphase, sorted by start time + */ + const MissionPhase& phase(size_t i) const; + + std::list phaseTrace(double time, int maxDepth = -1) const; + + //TimeRange parseTimeRange(const ghoul::Dictionary& dict); + +protected: + bool phaseTrace(double time, std::list& trace, int maxDepth) const; + + std::string _name; + std::string _description; + TimeRange _timeRange; + std::vector _subphases; +}; + + +class Mission : public MissionPhase { +public: + Mission() = default; + Mission(std::string filename); + +private: + static ghoul::Dictionary readDictFromFile(std::string filepath); + std::string _filepath; +}; + +} // namespace openspace + + +#endif // __MISSION_H__ diff --git a/modules/newhorizons/util/missionmanager.h b/include/openspace/mission/missionmanager.h similarity index 71% rename from modules/newhorizons/util/missionmanager.h rename to include/openspace/mission/missionmanager.h index c23046f004..52888afa81 100644 --- a/modules/newhorizons/util/missionmanager.h +++ b/include/openspace/mission/missionmanager.h @@ -25,77 +25,23 @@ #ifndef __MISSIONPHASEEQUENCER_H__ #define __MISSIONPHASEEQUENCER_H__ - #include #include #include #include #include +#include #include #include - namespace openspace { - -/** -* Used to represent a named period of time within a mission. Allows nested phases, i.e. -* phases within phases. Designed for WORM usage (Write Once, Read Multiple), and therefor -* has only accessors. -*/ -class MissionPhase { -public: - MissionPhase() : _name(""), _description("") {}; - MissionPhase(const ghoul::Dictionary& dict); - - const std::string& name() const { return _name; } - - const TimeRange& timeRange() const { return _timeRange; }; - - const std::string& description() const { return _description; }; - - /** - * Returns all subphases sorted by start time - */ - const std::vector& phases() const { return _subphases; } - - /** - * Returns the i:th subphase, sorted by start time - */ - const MissionPhase& phase(size_t i) const { return _subphases[i]; } - - std::list phaseTrace(double time, int maxDepth = -1) const; - -protected: - - bool phaseTrace(double time, std::list& trace, int maxDepth) const; - - - std::string _name; - std::string _description; - TimeRange _timeRange; - std::vector _subphases; -}; - - - -class Mission : public MissionPhase { -public: - Mission() {}; - Mission(std::string filename); - -private: - static ghoul::Dictionary readDictFromFile(std::string filepath); - std::string _filepath; -}; - /** * Singleton class keeping track of space missions. */ class MissionManager { public: - static MissionManager& ref(); static void initialize(); @@ -117,7 +63,7 @@ public: /** * Returns true if a current mission exists */ - bool hasCurrentMission() const { return _currentMissionIter != _missionMap.end(); } + bool hasCurrentMission() const; /** * Returns the latest mission specified to `setCurrentMission()`. If no mission has @@ -125,10 +71,8 @@ public: * loaded, a warning will be printed and a dummy mission will be returned. */ const Mission& currentMission(); - private: - static scripting::LuaLibrary luaLibrary(); static MissionManager* _instance; @@ -137,7 +81,7 @@ private: MissionMap::iterator _currentMissionIter; // Singleton - MissionManager() : _currentMissionIter(_missionMap.end()) { }; + MissionManager(); }; } // namespace openspace diff --git a/modules/newhorizons/CMakeLists.txt b/modules/newhorizons/CMakeLists.txt index 24f465e439..131d181ccf 100644 --- a/modules/newhorizons/CMakeLists.txt +++ b/modules/newhorizons/CMakeLists.txt @@ -36,7 +36,6 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/util/hongkangparser.h ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumenttimesparser.h ${CMAKE_CURRENT_SOURCE_DIR}/util/imagesequencer.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/missionmanager.h ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumentdecoder.h ${CMAKE_CURRENT_SOURCE_DIR}/util/labelparser.h ${CMAKE_CURRENT_SOURCE_DIR}/util/projectioncomponent.h @@ -59,7 +58,6 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/util/hongkangparser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumenttimesparser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/imagesequencer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/missionmanager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumentdecoder.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/labelparser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/util/projectioncomponent.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f23b24e3bf..092124b3c8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,6 +55,9 @@ set(OPENSPACE_SOURCE ${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/mouseexternalcontrol.cpp ${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/pythonexternalcontrol.cpp ${OPENSPACE_BASE_DIR}/src/interaction/externalcontrol/randomexternalcontrol.cpp + ${OPENSPACE_BASE_DIR}/src/mission/mission.cpp + ${OPENSPACE_BASE_DIR}/src/mission/missionmanager.cpp + # ${OPENSPACE_BASE_DIR}/src/mission/missionphasesequencer.cpp ${OPENSPACE_BASE_DIR}/src/network/networkengine.cpp ${OPENSPACE_BASE_DIR}/src/network/parallelconnection.cpp ${OPENSPACE_BASE_DIR}/src/network/parallelconnection_lua.inl @@ -143,6 +146,8 @@ set(OPENSPACE_HEADER ${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/mouseexternalcontrol.h ${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/pythonexternalcontrol.h ${OPENSPACE_BASE_DIR}/include/openspace/interaction/externalcontrol/randomexternalcontrol.h + ${OPENSPACE_BASE_DIR}/include/openspace/mission/mission.h + ${OPENSPACE_BASE_DIR}/include/openspace/mission/missionmanager.h ${OPENSPACE_BASE_DIR}/include/openspace/network/networkengine.h ${OPENSPACE_BASE_DIR}/include/openspace/network/parallelconnection.h ${OPENSPACE_BASE_DIR}/include/openspace/network/messagestructures.h diff --git a/modules/newhorizons/util/missionmanager.cpp b/src/mission/mission.cpp similarity index 69% rename from modules/newhorizons/util/missionmanager.cpp rename to src/mission/mission.cpp index 0fc2c67787..20696218d9 100644 --- a/modules/newhorizons/util/missionmanager.cpp +++ b/src/mission/mission.cpp @@ -22,10 +22,12 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include + #include #include #include -#include +#include #include #include @@ -39,10 +41,6 @@ namespace { const std::string KEY_TIME_RANGE = "TimeRange"; } - - - - namespace openspace { MissionPhase::MissionPhase(const ghoul::Dictionary& dict) { @@ -96,7 +94,35 @@ MissionPhase::MissionPhase(const ghoul::Dictionary& dict) { throw std::runtime_error("Must specify key: " + KEY_TIME_RANGE); } } -}; +} + +const std::string & MissionPhase::name() const { + return _name; +} + +const TimeRange & MissionPhase::timeRange() const { + return _timeRange; +} + +const std::string & MissionPhase::description() const { + return _description; +} + +/** +* Returns all subphases sorted by start time +*/ + +const std::vector& MissionPhase::phases() const { + return _subphases; +} + +/** +* Returns the i:th subphase, sorted by start time +*/ + +const MissionPhase& MissionPhase::phase(size_t i) const { + return _subphases[i]; +} std::list MissionPhase::phaseTrace(double time, int maxDepth) const { std::list trace; @@ -130,7 +156,9 @@ bool MissionPhase::phaseTrace(double time, std::list& trace -Mission::Mission(std::string filepath) +//inline Mission::Mission() {} + +Mission::Mission(std::string filepath) : MissionPhase(readDictFromFile(filepath)) , _filepath(filepath) { @@ -155,99 +183,4 @@ ghoul::Dictionary Mission::readDictFromFile(std::string filepath) { return {}; } - - - -MissionManager* MissionManager::_instance = nullptr; - -MissionManager& MissionManager::ref() { - assert(_instance != nullptr); - return *_instance; -} - -void MissionManager::initialize() { - assert(_instance == nullptr); - _instance = new MissionManager; - OsEng.scriptEngine().addLibrary(MissionManager::luaLibrary()); -} - -void MissionManager::deinitialize() { - delete _instance; - _instance = nullptr; -} - -void MissionManager::setCurrentMission(const std::string missionName) { - auto it = _missionMap.find(missionName); - if (it == _missionMap.end()) { - LWARNING("Mission with name \"" << missionName << "\" has not been loaded!"); - } - else { - _currentMissionIter = it; - } -} - -void MissionManager::loadMission(const std::string& filepath) { - Mission mission(filepath); - _missionMap[mission.name()] = mission; - if (_missionMap.size() == 1) { - setCurrentMission(mission.name()); - } -} - -const Mission& MissionManager::currentMission() { - if (_currentMissionIter == _missionMap.end()) { - LWARNING("No current mission has been specified. returning dummy mission"); - return Mission(); - } - return _currentMissionIter->second; -} - -namespace luascriptfunctions { - int loadMission(lua_State* L) { - using ghoul::lua::luaTypeToString; - int nArguments = lua_gettop(L); - if (nArguments != 1) - return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments); - - std::string missionFileName = luaL_checkstring(L, -1); - if (missionFileName.empty()) { - return luaL_error(L, "filepath string is empty"); - } - MissionManager::ref().loadMission(missionFileName); - } - - int setCurrentMission(lua_State* L) { - using ghoul::lua::luaTypeToString; - int nArguments = lua_gettop(L); - if (nArguments != 1) - return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments); - - std::string missionName = luaL_checkstring(L, -1); - if (missionName.empty()) { - return luaL_error(L, "mission name string is empty"); - } - MissionManager::ref().setCurrentMission(missionName); - } -} // namespace luascriptfunction - -scripting::LuaLibrary MissionManager::luaLibrary() { - return{ - "", - { - { - "loadMission", - &luascriptfunctions::loadMission, - "string", - "Load mission phases from file" - }, - { - "setCurrentMission", - &luascriptfunctions::setCurrentMission, - "string", - "Set the currnet mission" - }, - } - }; -} - } // namespace openspace diff --git a/modules/newhorizons/util/missionphasesequencer.cpp b/src/mission/missionmanager.cpp similarity index 61% rename from modules/newhorizons/util/missionphasesequencer.cpp rename to src/mission/missionmanager.cpp index 174c03e6c5..a3b89138f9 100644 --- a/modules/newhorizons/util/missionphasesequencer.cpp +++ b/src/mission/missionmanager.cpp @@ -25,114 +25,22 @@ #include #include #include -#include +#include #include - +#include namespace { const std::string _loggerCat = "MissionPhaseSequencer"; + + const std::string KEY_PHASE_NAME = "Name"; + const std::string KEY_PHASE_DESCRIPTION = "Description"; + const std::string KEY_PHASE_SUBPHASES = "Phases"; + const std::string KEY_TIME_RANGE = "TimeRange"; } - - - - namespace openspace { -MissionPhase::MissionPhase(const ghoul::Dictionary& dict) { - const auto byPhaseStartTime = [](const MissionPhase& a, const MissionPhase& b)->bool{ - return a.timeRange().start < b.timeRange().start; - }; - - _name = dict.value("Name"); - ghoul::Dictionary childDicts; - if (dict.getValue("Phases", childDicts)) { - // This is a nested mission phase - size_t numSubPhases = childDicts.size(); - _subphases.resize(numSubPhases); - for (size_t i = 0; i < numSubPhases; ++i) { - std::string key = std::to_string(i + 1); - _subphases[i] = MissionPhase(childDicts.value(key)); - } - - std::stable_sort(_subphases.begin(), _subphases.end(), byPhaseStartTime); - - // The subphases will have a total time phases - TimeRange timeRangeSubPhases; - timeRangeSubPhases.start = _subphases[0].timeRange().start; - timeRangeSubPhases.end = _subphases.back().timeRange().end; - - // user may specify an overall time range. In that case expand this timerange. - TimeRange overallTimeRange; - try { - overallTimeRange = parseTimeRange(dict); - ghoul_assert(overallTimeRange.includes(timeRangeSubPhases), - "User specified time range must at least include its subphases'"); - _timeRange.include(overallTimeRange); - } - catch (...) { - // Its OK to not specify an overall time range, the time range for the - // subphases will simply be used. - _timeRange.include(timeRangeSubPhases); - } - } - else { - _timeRange = parseTimeRange(dict); - } -}; - -TimeRange MissionPhase::parseTimeRange(const ghoul::Dictionary& dict) { - std::string startTimeStr; - std::string endTimeStr; - bool success = true; - success &= dict.getValue("StartTime", startTimeStr); - success &= dict.getValue("EndTime", endTimeStr); - - if (!success) { - // Had to do this because ghoul::Dictionary::value<>(std::string key) throws - // uncatchable xtree error on my AMNH windwos machine/ eb) - throw "meh"; - } - // Parse to date - TimeRange timeRange; - timeRange.start = SpiceManager::ref().ephemerisTimeFromDate(startTimeStr); - timeRange.end = SpiceManager::ref().ephemerisTimeFromDate(endTimeStr); - return timeRange; -} - - - - - -Mission::Mission(std::string filepath) - : MissionPhase(readDictFromFile(filepath)) - , _filepath(filepath) -{ - -} - -ghoul::Dictionary Mission::readDictFromFile(std::string filepath) { - filepath = absPath(filepath); - LINFO("Reading mission phases fomr file: " << filepath); - if (!FileSys.fileExists(filepath)) - throw ghoul::FileNotFoundError(filepath, "Mission file path"); - - ghoul::Dictionary missionDict; - try { - ghoul::lua::loadDictionaryFromFile(filepath, missionDict); - return missionDict; - } - catch (ghoul::RuntimeError& e) { - LWARNING("Unable to load mission phases"); - LWARNING(e.message); - } - return {}; -} - - - - MissionManager* MissionManager::_instance = nullptr; MissionManager& MissionManager::ref() { @@ -161,6 +69,14 @@ void MissionManager::setCurrentMission(const std::string missionName) { } } +/** +* Returns true if a current mission exists +*/ + +bool MissionManager::hasCurrentMission() const { + return _currentMissionIter != _missionMap.end(); +} + void MissionManager::loadMission(const std::string& filepath) { Mission mission(filepath); _missionMap[mission.name()] = mission; @@ -172,6 +88,7 @@ void MissionManager::loadMission(const std::string& filepath) { const Mission& MissionManager::currentMission() { if (_currentMissionIter == _missionMap.end()) { LWARNING("No current mission has been specified. returning dummy mission"); + return Mission(); } return _currentMissionIter->second; } @@ -224,4 +141,8 @@ scripting::LuaLibrary MissionManager::luaLibrary() { }; } +// Singleton + +inline MissionManager::MissionManager() : _currentMissionIter(_missionMap.end()) {} + } // namespace openspace diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 9adb7c58c9..12a922476f 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -26,8 +26,8 @@ #ifdef OPENSPACE_MODULE_NEWHORIZONS_ENABLED #include -#include #endif +#include #include #include