1
+ #pragma once
2
+
3
+ #include < string>
4
+ #include < vector>
5
+ #include < nlohmann/json.hpp>
6
+
7
+ namespace SpiceQL {
8
+ std::string url_encode (const std::string &value);
9
+ nlohmann::json spiceAPIQuery (std::string functionName, nlohmann::json args, std::string method=" GET" );
10
+
11
+ /* *
12
+ * @brief Gives the positions and velocities for a given frame given a set of ephemeris times
13
+ *
14
+ * Mostly a C++ wrap for NAIF's spkezr_c
15
+ *
16
+ * @param ets ephemeris times at which you want to obtain the target state
17
+ * @param target NAIF ID for the target frame
18
+ * @param observer NAIF ID for the observing frame
19
+ * @param frame The reference frame in which to get the positions in
20
+ * @param abcorr aborration correction flag, default it NONE.
21
+ * This can set to:
22
+ * "NONE" - No correction
23
+ * For the "reception" case, i.e. photons from the target being recieved by the observer at the given time.
24
+ * "LT" - One way light time correction
25
+ * "LT+S" - Correct for one-way light time and stellar aberration correction
26
+ * "CN" - Converging Newtonian light time correction
27
+ * "CN+S" - Converged Newtonian light time correction and stellar aberration correction
28
+ * For the "transmission" case, i.e. photons emitted from the oberver hitting at target at the given time
29
+ * "XLT" - One-way light time correction using a newtonian formulation
30
+ * "XLT+S" - One-way light time and stellar aberration correction using a newtonian formulation
31
+ * "XCN" - converged Newtonian light time correction
32
+ * "XCN+S" - converged Newtonian light time correction and stellar aberration correction.
33
+ * @param mission Config subset as it relates to the mission
34
+ * @param ckQualities vector of strings describing the quality of cks to try and obtain
35
+ * @param spkQualities string of strings describing the quality of spks to try and obtain
36
+ * @param searchKernels bool Whether to search the kernels for the user
37
+ *
38
+ * @see SpiceQL::getTargetState
39
+ * @see Kernel::Quality
40
+ *
41
+ * @return A vector of vectors with a Nx7 state vector of positions and velocities in x,y,z,vx,vy,vz format followed by the light time adjustment.
42
+ **/
43
+ std::pair<std::vector<std::vector<double >>, nlohmann::json> getTargetStates (std::vector<double > ets, std::string target, std::string observer, std::string frame, std::string abcorr, std::string mission, std::vector<std::string> ckQualities={" smithed" , " reconstructed" }, std::vector<std::string> spkQualities={" smithed" , " reconstructed" }, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
44
+
45
+ /* *
46
+ * @brief Gives quaternion and angular velocity for a given frame at a set of ephemeris times
47
+ *
48
+ * Gets orientations for an input frame in some reference frame.
49
+ * The orientations returned from this function can be used to transform a position
50
+ * in the source frame to the ref frame.
51
+ *
52
+ * @param ets ephemeris times at which you want to optain the target pointing
53
+ * @param toframe the source frame's NAIF code.
54
+ * @param refframe the reference frame's NAIF code, orientations are relative to this reference frame
55
+ * @param mission Config subset as it relates to the mission
56
+ * @param ckQualities vector of string describing the quality of cks to try and obtain
57
+ * @param searchKernels bool Whether to search the kernels for the user
58
+ *
59
+ * @see SpiceQL::getTargetOrientation
60
+ *
61
+ * @returns Vector of SPICE-style quaternions (w,x,y,z) and optional angular velocity (4 element without angular velocity, 7 element with)
62
+ **/
63
+ std::pair<std::vector<std::vector<double >>, nlohmann::json> getTargetOrientations (std::vector<double > ets, int toFrame, int refFrame, std::string mission, std::vector<std::string> ckQualities={" smithed" , " reconstructed" }, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
64
+
65
+ /* *
66
+ * @brief Converts a given string spacecraft clock time to an ephemeris time
67
+ *
68
+ * Given a known frame code strSclkToEt converts a given spacecraft clock time as a string
69
+ * to an ephemeris time. Call this function if your clock time looks something like:
70
+ * 1/281199081:48971
71
+ *
72
+ * @param frameCode int Frame id to use
73
+ * @param sclk string Spacecraft Clock formatted as a string
74
+ * @param mission string Mission name as it relates to the config files
75
+ * @param searchKernels bool Whether to search the kernels for the user
76
+ * @return double
77
+ */
78
+ std::pair<double , nlohmann::json> strSclkToEt (int frameCode, std::string sclk, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
79
+
80
+ /* *
81
+ * @brief Converts a given double spacecraft clock time to an ephemeris time
82
+ *
83
+ * Given a known frame code doubleSclkToEt converts a given spacecraft clock time as a double
84
+ * to an ephemeris time. Call this function if your clock time looks something like:
85
+ * 922997380.174174
86
+ *
87
+ * @param frameCode int Frame id to use
88
+ * @param sclk int Spacecraft Clock formatted as an int
89
+ * @param mission string Mission name as it relates to the config files
90
+ * @param searchKernels bool Whether to search the kernels for the user
91
+ * @return double
92
+ */
93
+ std::pair<double , nlohmann::json> doubleSclkToEt (int frameCode, double sclk, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
94
+
95
+ /* *
96
+ * @brief convert a UTC string to an ephemeris time
97
+ *
98
+ * Basically a wrapper around NAIF's cspice str2et function except it also temporarily loads the required kernels.
99
+ * See Also: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/str2et_c.html
100
+ *
101
+ * @param et UTC string, e.g. "1988 June 13, 12:29:48 TDB"
102
+ * @param searchKernels bool Whether to search the kernels for the user
103
+ * @returns double precision ephemeris time
104
+ **/
105
+ std::pair<double , nlohmann::json> utcToEt (std::string utc, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
106
+
107
+ /* *
108
+ * @brief convert et string to a UTC string
109
+ *
110
+ * Basically a wrapper around NAIF's cspice et2utc_c function except it also temporarily loads the required kernels.
111
+ * See Also: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/et2utc_c.html
112
+ *
113
+ * @param et ephemeris time
114
+ * @param precision number of decimal
115
+ * @param searchKernels bool Whether to search the kernels for the user
116
+ * @returns double precision ephemeris time
117
+ **/
118
+ std::pair<std::string, nlohmann::json> etToUtc (double et, std::string format, double precision, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
119
+
120
+ /* *
121
+ * @brief Switch between NAIF frame string name to integer frame code
122
+ *
123
+ * See <a href="https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/naif_ids.html">NAIF's Docs on frame codes</a> for more information
124
+ *
125
+ * @param frame String frame name to translate to a NAIF code
126
+ * @param mission Mission name as it relates to the config files
127
+ * @param searchKernels bool Whether to search the kernels for the user
128
+ * @return integer Naif frame code
129
+ **/
130
+ std::pair<int , nlohmann::json> translateNameToCode (std::string frame, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
131
+
132
+ /* *
133
+ * @brief Switch between NAIF frame integer code to string frame name
134
+ *
135
+ * See <a href="https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/naif_ids.html">NAIF's Docs on frame codes</a> for more information
136
+ *
137
+ * @param frame int NAIF frame code to translate
138
+ * @param searchKernels bool Whether to search the kernels for the user
139
+ * @param mission Mission name as it relates to the config files
140
+ * @return string Naif frame name
141
+ **/
142
+ std::pair<std::string, nlohmann::json> translateCodeToName (int frame, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
143
+
144
+ /* *
145
+ * @brief Get the center, class id, and class of a given frame
146
+ *
147
+ * See <a href="https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/naif_ids.html">NAIF's Docs on frame codes</a> for more information
148
+ *
149
+ * @param frame String frame name to translate to a NAIF code
150
+ * @param mission Mission name as it relates to the config files
151
+ * @param searchKernels bool Whether to search the kernels for the user
152
+ * @return 3 element vector of the given frames center, class id, and class
153
+ **/
154
+ std::pair<std::vector<int >, nlohmann::json> getFrameInfo (int frame, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
155
+
156
+ /* *
157
+ * @brief returns frame name and frame code associated to the target ID.
158
+ *
159
+ * Takes in a target id and returns the frame name and frame code in json format
160
+ *
161
+ * @param targetId target ID
162
+ * @param mission mission name as it relates to the config files
163
+ * @param searchKernels bool Whether to search the kernels for the user
164
+ * @returns json of frame name and frame code
165
+ **/
166
+ std::pair<nlohmann::json, nlohmann::json> getTargetFrameInfo (int targetId, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
167
+
168
+ /* *
169
+ * @brief returns kernel values for a specific mission in the form of a json
170
+ *
171
+ * Takes in a kernel key and returns the value associated with the inputted mission as a json
172
+ *
173
+ * @param key key - Kernel to get values from
174
+ * @param mission mission name
175
+ * @param searchKernels bool Whether to search the kernels for the user
176
+ * @returns json of values
177
+ **/
178
+ std::pair<nlohmann::json, nlohmann::json> findMissionKeywords (std::string key, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
179
+
180
+ /* *
181
+ * @brief returns Target values in the form of a vector
182
+ *
183
+ * Takes in a target and key and returns the value associated in the form of vector.
184
+ * Note: This function is mainly for obtaining target keywords. For obtaining other values, use findMissionKeywords.
185
+ *
186
+ * @param key keyword for desired values
187
+ * @param mission mission name as it relates to the config files
188
+ * @param searchKernels bool Whether to search the kernels for the user
189
+ * @returns vector of values
190
+ **/
191
+ std::pair<nlohmann::json, nlohmann::json> findTargetKeywords (std::string key, std::string mission, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
192
+
193
+ /* *
194
+ * @brief Given an ephemeris time and a starting frame, find the path from that starting frame to J2000 (1)
195
+ *
196
+ * This function uses NAIF routines and builds a path from the initalframe to J2000 making
197
+ * note of all the in between frames
198
+ *
199
+ * @param et ephemeris times at which you want to optain the frame trace
200
+ * @param initialFrame the initial frame's NAIF code.
201
+ * @param mission Config subset as it relates to the mission
202
+ * @param ckQualities vector of strings describing the quality of cks to try and obtain
203
+ * @param searchKernels bool Whether to search the kernels for the user
204
+ *
205
+ * @returns A two element vector of vectors ints, where the first element is the sequence of time dependent frames
206
+ * and the second is the sequence of constant frames
207
+ **/
208
+ std::pair<std::vector<std::vector<int >>, nlohmann::json> frameTrace (double et, int initialFrame, std::string mission, std::vector<std::string> ckQualities={" smithed" , " reconstructed" }, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
209
+
210
+ /* *
211
+ * @brief Extracts all segment times between observStart and observeEnd
212
+ *
213
+ * Givven an observation start and observation end, extract all times assocaited
214
+ * with segments in a CK file. The times returned are all times assocaited with
215
+ * concrete CK segment times with no interpolation.
216
+ *
217
+ * @param observStart Ephemeris time to start searching at
218
+ * @param observEnd Ephemeris time to stop searching at
219
+ * @param targetFrame Target reference frame to get ephemeris data in
220
+ * @param ckQualities vector of string describing the quality of cks to try and obtain
221
+ * @returns A list of times
222
+ **/
223
+ std::pair<std::vector<double >, nlohmann::json> extractExactCkTimes (double observStart, double observEnd, int targetFrame, std::string mission, std::vector<std::string> ckQualities={" smithed" , " reconstructed" }, bool useWeb=false , bool searchKernels=true , std::vector<std::string> kernel_list={});
224
+ }
0 commit comments