open-space-toolkit-astrodynamics 13.0.2__py39-none-manylinux2014_x86_64.whl → 14.0.0__py39-none-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {open_space_toolkit_astrodynamics-13.0.2.dist-info → open_space_toolkit_astrodynamics-14.0.0.dist-info}/METADATA +6 -6
- {open_space_toolkit_astrodynamics-13.0.2.dist-info → open_space_toolkit_astrodynamics-14.0.0.dist-info}/RECORD +54 -22
- {open_space_toolkit_astrodynamics-13.0.2.dist-info → open_space_toolkit_astrodynamics-14.0.0.dist-info}/WHEEL +1 -1
- ostk/astrodynamics/OpenSpaceToolkitAstrodynamicsPy.cpython-39-x86_64-linux-gnu.so +0 -0
- ostk/astrodynamics/__init__.pyi +785 -0
- ostk/astrodynamics/access.pyi +588 -0
- ostk/astrodynamics/conjunction/__init__.pyi +3 -0
- ostk/astrodynamics/conjunction/message/__init__.pyi +3 -0
- ostk/astrodynamics/conjunction/message/ccsds.pyi +723 -0
- ostk/astrodynamics/converters.pyi +58 -0
- ostk/astrodynamics/data/__init__.pyi +3 -0
- ostk/astrodynamics/data/provider.pyi +22 -0
- ostk/astrodynamics/dynamics.pyi +329 -0
- ostk/astrodynamics/event_condition.pyi +580 -0
- ostk/astrodynamics/flight/__init__.pyi +547 -0
- ostk/astrodynamics/flight/profile/__init__.pyi +102 -0
- ostk/astrodynamics/flight/profile/model.pyi +176 -0
- ostk/astrodynamics/flight/system.pyi +277 -0
- ostk/astrodynamics/guidance_law.pyi +282 -0
- ostk/astrodynamics/{libopen-space-toolkit-astrodynamics.so.13 → libopen-space-toolkit-astrodynamics.so.14} +0 -0
- ostk/astrodynamics/py.typed +0 -0
- ostk/astrodynamics/pytrajectory/__init__.pyi +3 -0
- ostk/astrodynamics/pytrajectory/pystate.py +2 -4
- ostk/astrodynamics/pytrajectory/pystate.pyi +65 -0
- ostk/astrodynamics/solver.pyi +232 -0
- ostk/astrodynamics/test/access/test_generator.py +130 -59
- ostk/astrodynamics/test/access/test_visibility_criterion.py +198 -0
- ostk/astrodynamics/test/data/provider/test_off_nadir.py +58 -0
- ostk/astrodynamics/test/flight/test_maneuver.py +49 -64
- ostk/astrodynamics/test/flight/test_profile.py +4 -2
- ostk/astrodynamics/test/solvers/test_finite_difference_solver.py +24 -11
- ostk/astrodynamics/test/solvers/test_temporal_condition_solver.py +9 -1
- ostk/astrodynamics/test/test_display.py +11 -5
- ostk/astrodynamics/test/test_viewer.py +70 -1
- ostk/astrodynamics/test/trajectory/orbit/models/kepler/test_coe.py +21 -0
- ostk/astrodynamics/test/trajectory/state/coordinate_subset/test_cartesian_acceleration.py +136 -0
- ostk/astrodynamics/test/trajectory/state/test_coordinate_subset.py +9 -0
- ostk/astrodynamics/test/trajectory/test_local_orbital_frame_factory.py +21 -13
- ostk/astrodynamics/test/trajectory/test_orbit.py +9 -0
- ostk/astrodynamics/test/trajectory/test_propagator.py +21 -27
- ostk/astrodynamics/test/trajectory/test_segment.py +0 -1
- ostk/astrodynamics/trajectory/__init__.pyi +1796 -0
- ostk/astrodynamics/trajectory/orbit/__init__.pyi +361 -0
- ostk/astrodynamics/trajectory/orbit/message/__init__.pyi +3 -0
- ostk/astrodynamics/trajectory/orbit/message/spacex.pyi +273 -0
- ostk/astrodynamics/trajectory/orbit/model/__init__.pyi +517 -0
- ostk/astrodynamics/trajectory/orbit/model/brouwerLyddaneMean.pyi +127 -0
- ostk/astrodynamics/trajectory/orbit/model/kepler.pyi +581 -0
- ostk/astrodynamics/trajectory/orbit/model/sgp4.pyi +333 -0
- ostk/astrodynamics/trajectory/state/__init__.pyi +406 -0
- ostk/astrodynamics/trajectory/state/coordinate_subset.pyi +223 -0
- ostk/astrodynamics/viewer.py +32 -0
- {open_space_toolkit_astrodynamics-13.0.2.dist-info → open_space_toolkit_astrodynamics-14.0.0.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_astrodynamics-13.0.2.dist-info → open_space_toolkit_astrodynamics-14.0.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,282 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
import numpy
|
3
|
+
import ostk.astrodynamics
|
4
|
+
import ostk.astrodynamics.trajectory
|
5
|
+
import ostk.astrodynamics.trajectory.orbit.model.kepler
|
6
|
+
import ostk.core.type
|
7
|
+
import ostk.physics.coordinate
|
8
|
+
import ostk.physics.time
|
9
|
+
import ostk.physics.unit
|
10
|
+
import typing
|
11
|
+
__all__ = ['ConstantThrust', 'QLaw']
|
12
|
+
class ConstantThrust(ostk.astrodynamics.GuidanceLaw):
|
13
|
+
"""
|
14
|
+
|
15
|
+
Constant Thrust, Constant Direction dynamics.
|
16
|
+
|
17
|
+
|
18
|
+
"""
|
19
|
+
@staticmethod
|
20
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
21
|
+
...
|
22
|
+
@staticmethod
|
23
|
+
def intrack(velocity_direction: bool = True) -> ConstantThrust:
|
24
|
+
"""
|
25
|
+
Create a constant thrust in the in-track direction.
|
26
|
+
|
27
|
+
Args:
|
28
|
+
satellite_system (SatelliteSystem): The satellite system.
|
29
|
+
velocity_direction (bool, optional): If True, the thrust is applied in the velocity direction. Otherwise, it is applied in the opposite direction.
|
30
|
+
frame (Frame, optional): The reference frame.
|
31
|
+
|
32
|
+
Returns:
|
33
|
+
ConstantThrust: The constant thrust.
|
34
|
+
"""
|
35
|
+
def __init__(self, thrust_direction: ostk.astrodynamics.trajectory.LocalOrbitalFrameDirection) -> None:
|
36
|
+
"""
|
37
|
+
Constructor.
|
38
|
+
|
39
|
+
Args:
|
40
|
+
thrust_direction (LocalOrbitalFrameDirection): The thrust direction.
|
41
|
+
"""
|
42
|
+
def __repr__(self) -> str:
|
43
|
+
...
|
44
|
+
def __str__(self) -> str:
|
45
|
+
...
|
46
|
+
def calculate_thrust_acceleration_at(self, instant: ostk.physics.time.Instant, position_coordinates: numpy.ndarray[numpy.float64[3, 1]], velocity_coordinates: numpy.ndarray[numpy.float64[3, 1]], thrust_acceleration: ostk.core.type.Real, output_frame: ostk.physics.coordinate.Frame) -> numpy.ndarray[numpy.float64[3, 1]]:
|
47
|
+
"""
|
48
|
+
Compute the acceleration due to constant thrust.
|
49
|
+
|
50
|
+
Args:
|
51
|
+
instant (Instant): The instant of the state vector.
|
52
|
+
position_coordinates (numpy.ndarray): The position coordinates.
|
53
|
+
velocity_coordinates (numpy.ndarray): The velocity coordinates.
|
54
|
+
thrust_acceleration (float): The thrust acceleration magnitude.
|
55
|
+
output_frame (Frame): The frame the acceleration will be expressed in.
|
56
|
+
|
57
|
+
Returns:
|
58
|
+
numpy.ndarray: The contribution of the constant thrust to the state vector.
|
59
|
+
"""
|
60
|
+
def get_local_thrust_direction(self) -> ostk.astrodynamics.trajectory.LocalOrbitalFrameDirection:
|
61
|
+
"""
|
62
|
+
Get the local thrust direction.
|
63
|
+
|
64
|
+
Returns:
|
65
|
+
LocalOrbitalFrameDirection: The local thrust direction.
|
66
|
+
"""
|
67
|
+
class QLaw(ostk.astrodynamics.GuidanceLaw):
|
68
|
+
"""
|
69
|
+
|
70
|
+
This class implements the Q-law guidance law.
|
71
|
+
|
72
|
+
- Ref: https://dataverse.jpl.nasa.gov/api/access/datafile/10307?gbrecs=true
|
73
|
+
- Ref: https://www.researchgate.net/publication/370849580_Analytic_Calculation_and_Application_of_the_Q-Law_Guidance_Algorithm_Partial_Derivatives
|
74
|
+
- Ref for derivations: https://dataverse.jpl.nasa.gov/api/access/datafile/13727?gbrecs=true
|
75
|
+
|
76
|
+
The Q-law is a Lyapunov feedback control law developed by Petropoulos,
|
77
|
+
based on analytic expressions for maximum rates of change of the orbit elements and
|
78
|
+
the desired changes in the elements. Q, the proximity quotient, serves as a candidate Lyapunov
|
79
|
+
function. As the spacecraft approaches the target orbit, Q decreases monotonically (becoming zero at the target orbit).
|
80
|
+
|
81
|
+
|
82
|
+
"""
|
83
|
+
class GradientStrategy:
|
84
|
+
"""
|
85
|
+
|
86
|
+
Gradient strategy.
|
87
|
+
|
88
|
+
|
89
|
+
Members:
|
90
|
+
|
91
|
+
Analytical : Analytical
|
92
|
+
|
93
|
+
FiniteDifference : Finite Differenced
|
94
|
+
"""
|
95
|
+
Analytical: typing.ClassVar[QLaw.GradientStrategy] # value = <GradientStrategy.Analytical: 0>
|
96
|
+
FiniteDifference: typing.ClassVar[QLaw.GradientStrategy] # value = <GradientStrategy.FiniteDifference: 1>
|
97
|
+
__members__: typing.ClassVar[dict[str, QLaw.GradientStrategy]] # value = {'Analytical': <GradientStrategy.Analytical: 0>, 'FiniteDifference': <GradientStrategy.FiniteDifference: 1>}
|
98
|
+
@staticmethod
|
99
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
100
|
+
...
|
101
|
+
def __eq__(self, other: typing.Any) -> bool:
|
102
|
+
...
|
103
|
+
def __getstate__(self) -> int:
|
104
|
+
...
|
105
|
+
def __hash__(self) -> int:
|
106
|
+
...
|
107
|
+
def __index__(self) -> int:
|
108
|
+
...
|
109
|
+
def __init__(self, value: int) -> None:
|
110
|
+
...
|
111
|
+
def __int__(self) -> int:
|
112
|
+
...
|
113
|
+
def __ne__(self, other: typing.Any) -> bool:
|
114
|
+
...
|
115
|
+
def __repr__(self) -> str:
|
116
|
+
...
|
117
|
+
def __setstate__(self, state: int) -> None:
|
118
|
+
...
|
119
|
+
def __str__(self) -> str:
|
120
|
+
...
|
121
|
+
@property
|
122
|
+
def name(self) -> str:
|
123
|
+
...
|
124
|
+
@property
|
125
|
+
def value(self) -> int:
|
126
|
+
...
|
127
|
+
class Parameters:
|
128
|
+
"""
|
129
|
+
|
130
|
+
Q-law parameters.
|
131
|
+
|
132
|
+
|
133
|
+
"""
|
134
|
+
@staticmethod
|
135
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
136
|
+
...
|
137
|
+
def __init__(self, element_weights: dict[ostk.astrodynamics.trajectory.orbit.model.kepler.COE.Element, tuple[float, float]], m: int = 3, n: int = 4, r: int = 2, b: float = 0.01, k: int = 100, periapsis_weight: float = 0.0, minimum_periapsis_radius: ostk.physics.unit.Length = ..., absolute_effectivity_threshold: ostk.core.type.Real = ..., relative_effectivity_threshold: ostk.core.type.Real = ...) -> None:
|
138
|
+
"""
|
139
|
+
Constructor.
|
140
|
+
|
141
|
+
Args:
|
142
|
+
element_weights (dict): Key-value pair of COE elements and the (weights, tolerances) for the targeter.
|
143
|
+
m (int): Scaling parameter for Semi-Major Axis delta. Default to 3.
|
144
|
+
n (int): Scaling parameter for Semi-Major Axis delta. Default to 4.
|
145
|
+
r (int): Scaling parameter for Semi-Major Axis delta. Default to 2.
|
146
|
+
b (float): Scaling parameter for Argument of Periapsis maximal change. Default to 0.01.
|
147
|
+
k (int): Penalty parameter for periapsis. Default to 100.
|
148
|
+
periapsis_weight (float): Periapsis weight. Default to 0.0.
|
149
|
+
minimum_periapsis_radius (Length): Minimum periapsis radius. Default to 6578.0 km.
|
150
|
+
absolute_effectivity_threshold (Real): Absolute effectivity threshold. Default to undefined (not used).
|
151
|
+
relative_effectivity_threshold (Real): Relative effectivity threshold. Default to undefined (not used).
|
152
|
+
"""
|
153
|
+
def get_control_weights(self) -> numpy.ndarray[numpy.float64[5, 1]]:
|
154
|
+
"""
|
155
|
+
Get the control weights.
|
156
|
+
|
157
|
+
Returns:
|
158
|
+
np.array: The control weights.
|
159
|
+
"""
|
160
|
+
def get_minimum_periapsis_radius(self) -> ostk.physics.unit.Length:
|
161
|
+
"""
|
162
|
+
Get the minimum periapsis radius.
|
163
|
+
|
164
|
+
Returns:
|
165
|
+
Length: The minimum periapsis radius.
|
166
|
+
"""
|
167
|
+
@property
|
168
|
+
def absolute_effectivity_threshold(self) -> ostk.core.type.Real:
|
169
|
+
"""
|
170
|
+
Absolute effectivity threshold.
|
171
|
+
|
172
|
+
Type:
|
173
|
+
Real
|
174
|
+
"""
|
175
|
+
@property
|
176
|
+
def b(self) -> float:
|
177
|
+
"""
|
178
|
+
Scaling parameter for Argument of Periapsis.
|
179
|
+
|
180
|
+
Type:
|
181
|
+
float
|
182
|
+
"""
|
183
|
+
@property
|
184
|
+
def k(self) -> float:
|
185
|
+
"""
|
186
|
+
Penalty parameter for periapsis.
|
187
|
+
|
188
|
+
Type:
|
189
|
+
int
|
190
|
+
"""
|
191
|
+
@property
|
192
|
+
def m(self) -> float:
|
193
|
+
"""
|
194
|
+
Scaling parameter for Semi-Major Axis delta.
|
195
|
+
|
196
|
+
Type:
|
197
|
+
int
|
198
|
+
"""
|
199
|
+
@property
|
200
|
+
def n(self) -> float:
|
201
|
+
"""
|
202
|
+
Scaling parameter for Semi-Major Axis delta.
|
203
|
+
|
204
|
+
Type:
|
205
|
+
int
|
206
|
+
"""
|
207
|
+
@property
|
208
|
+
def periapsis_weight(self) -> float:
|
209
|
+
"""
|
210
|
+
Periapsis weight.
|
211
|
+
|
212
|
+
Type:
|
213
|
+
float
|
214
|
+
"""
|
215
|
+
@property
|
216
|
+
def r(self) -> float:
|
217
|
+
"""
|
218
|
+
Scaling parameter for Semi-Major Axis delta.
|
219
|
+
|
220
|
+
Type:
|
221
|
+
int
|
222
|
+
"""
|
223
|
+
@property
|
224
|
+
def relative_effectivity_threshold(self) -> ostk.core.type.Real:
|
225
|
+
"""
|
226
|
+
Relative effectivity threshold.
|
227
|
+
|
228
|
+
Type:
|
229
|
+
Real
|
230
|
+
"""
|
231
|
+
@staticmethod
|
232
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
233
|
+
...
|
234
|
+
def __init__(self, target_coe: ostk.astrodynamics.trajectory.orbit.model.kepler.COE, gravitational_parameter: ostk.physics.unit.Derived, parameters: QLaw.Parameters, gradient_strategy: QLaw.GradientStrategy = ...) -> None:
|
235
|
+
"""
|
236
|
+
Constructor.
|
237
|
+
|
238
|
+
Args:
|
239
|
+
coe (COE): The target orbit described by Classical Orbital Elements.
|
240
|
+
gravitational_parameter (float): The gravitational parameter of the central body.
|
241
|
+
parameters (QLaw.Parameters): A set of parameters for the QLaw.
|
242
|
+
gradient_strategy (QLaw.GradientStrategy): The strategy used to compute the gradient dQ_dOE. Defaults to FiniteDifference.
|
243
|
+
"""
|
244
|
+
def __repr__(self) -> str:
|
245
|
+
...
|
246
|
+
def __str__(self) -> str:
|
247
|
+
...
|
248
|
+
def calculate_thrust_acceleration_at(self, instant: ostk.physics.time.Instant, position_coordinates: numpy.ndarray[numpy.float64[3, 1]], velocity_coordinates: numpy.ndarray[numpy.float64[3, 1]], thrust_acceleration: ostk.core.type.Real, output_frame: ostk.physics.coordinate.Frame) -> numpy.ndarray[numpy.float64[3, 1]]:
|
249
|
+
"""
|
250
|
+
Calculate the thrust acceleration at the provided coordinates and instant.
|
251
|
+
|
252
|
+
Args:
|
253
|
+
instant (Instant): Instant of computation.
|
254
|
+
position_coordinates (np.array): Position coordinates.
|
255
|
+
velocity_coordinates (np.array): Velocity coordinates.
|
256
|
+
thrust_acceleration (float): Thrust acceleration magnitude.
|
257
|
+
output_frame (Frame): The frame the acceleration is expressed in.
|
258
|
+
|
259
|
+
Returns:
|
260
|
+
np.array: The acceleration.
|
261
|
+
"""
|
262
|
+
def get_gradient_strategy(self) -> QLaw.GradientStrategy:
|
263
|
+
"""
|
264
|
+
Get the gradient strategy.
|
265
|
+
|
266
|
+
Returns:
|
267
|
+
QLaw.GradientStrategy: The gradient strategy.
|
268
|
+
"""
|
269
|
+
def get_parameters(self) -> QLaw.Parameters:
|
270
|
+
"""
|
271
|
+
Get the parameters.
|
272
|
+
|
273
|
+
Returns:
|
274
|
+
QLaw.Parameters: The parameters.
|
275
|
+
"""
|
276
|
+
def get_target_coe(self) -> ostk.astrodynamics.trajectory.orbit.model.kepler.COE:
|
277
|
+
"""
|
278
|
+
Get the target COE.
|
279
|
+
|
280
|
+
Returns:
|
281
|
+
COE: The target COE.
|
282
|
+
"""
|
Binary file
|
File without changes
|
@@ -21,7 +21,6 @@ from ostk.astrodynamics.trajectory.state.coordinate_subset import (
|
|
21
21
|
CANONICAL_FORMAT: str = r"(r|v)_(.*?)_(x|y|z)"
|
22
22
|
|
23
23
|
|
24
|
-
@staticmethod
|
25
24
|
def custom_class_generator(frame: Frame, coordinate_subsets: list) -> type:
|
26
25
|
"""
|
27
26
|
Emit a custom class type for States. This is meta-programming syntactic sugar on top of the StateBuilder class.
|
@@ -44,7 +43,6 @@ def custom_class_generator(frame: Frame, coordinate_subsets: list) -> type:
|
|
44
43
|
return StateTemplateType
|
45
44
|
|
46
45
|
|
47
|
-
@staticmethod
|
48
46
|
def from_dict(data: dict) -> State:
|
49
47
|
"""
|
50
48
|
Create a State from a dictionary.
|
@@ -247,5 +245,5 @@ def from_dict(data: dict) -> State:
|
|
247
245
|
)
|
248
246
|
|
249
247
|
|
250
|
-
State.from_dict = from_dict
|
251
|
-
State.template = custom_class_generator
|
248
|
+
State.from_dict = staticmethod(from_dict)
|
249
|
+
State.template = staticmethod(custom_class_generator)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
import numpy as np
|
3
|
+
from ostk.astrodynamics.converters import coerce_to_instant
|
4
|
+
import ostk.astrodynamics.trajectory
|
5
|
+
from ostk.astrodynamics.trajectory import State
|
6
|
+
from ostk.astrodynamics.trajectory import StateBuilder
|
7
|
+
from ostk.astrodynamics.trajectory.state import CoordinateSubset
|
8
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import AngularVelocity
|
9
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import AttitudeQuaternion
|
10
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import CartesianPosition
|
11
|
+
from ostk.astrodynamics.trajectory.state.coordinate_subset import CartesianVelocity
|
12
|
+
import ostk.physics.coordinate
|
13
|
+
from ostk.physics.coordinate import Frame
|
14
|
+
from ostk.physics.time import Instant
|
15
|
+
import re as re
|
16
|
+
__all__ = ['AngularVelocity', 'AttitudeQuaternion', 'CANONICAL_FORMAT', 'CartesianPosition', 'CartesianVelocity', 'CoordinateSubset', 'Frame', 'Instant', 'State', 'StateBuilder', 'coerce_to_instant', 'custom_class_generator', 'from_dict', 'np', 're']
|
17
|
+
def custom_class_generator(frame: ostk.physics.coordinate.Frame, coordinate_subsets: list) -> type:
|
18
|
+
"""
|
19
|
+
|
20
|
+
Emit a custom class type for States. This is meta-programming syntactic sugar on top of the StateBuilder class.
|
21
|
+
|
22
|
+
StateType = State.template(frame, coordinate_subsets)
|
23
|
+
state = StateType(instant, coordinates)
|
24
|
+
|
25
|
+
is equivalent to
|
26
|
+
|
27
|
+
state_builder = StateBuilder(frame, coordinate_subsets)
|
28
|
+
state = state_builder.build(instant, coordinates)
|
29
|
+
|
30
|
+
"""
|
31
|
+
def from_dict(data: dict) -> ostk.astrodynamics.trajectory.State:
|
32
|
+
"""
|
33
|
+
|
34
|
+
Create a State from a dictionary.
|
35
|
+
|
36
|
+
Note: Implicit assumption that ECEF = ITRF, and ECI = GCRF.
|
37
|
+
|
38
|
+
The dictionary must contain the following:
|
39
|
+
- 'timestamp': The timestamp of the state.
|
40
|
+
- 'r_ITRF_x'/'rx'/'rx_eci'/'rx_ecef': The x-coordinate of the position.
|
41
|
+
- 'r_ITRF_y'/'ry'/'ry_eci'/'ry_ecef': The y-coordinate of the position.
|
42
|
+
- 'r_ITRF_z'/'rz'/'rz_eci'/'rz_ecef': The z-coordinate of the position.
|
43
|
+
- 'v_ITRF_x'/'vx'/'vx_eci'/'vx_ecef': The x-coordinate of the velocity.
|
44
|
+
- 'v_ITRF_y'/'vy'/'vy_eci'/'vy_ecef': The y-coordinate of the velocity.
|
45
|
+
- 'v_ITRF_z'/'vz'/'vz_eci'/'vz_ecef': The z-coordinate of the velocity.
|
46
|
+
- 'frame': The frame of the state. Required if 'rx', 'ry', 'rz', 'vx', 'vy', 'vz' are provided.
|
47
|
+
- 'q_B_ECI_x': The x-coordinate of the quaternion. Optional.
|
48
|
+
- 'q_B_ECI_y': The y-coordinate of the quaternion. Optional.
|
49
|
+
- 'q_B_ECI_z': The z-coordinate of the quaternion. Optional.
|
50
|
+
- 'q_B_ECI_s': The s-coordinate of the quaternion. Optional.
|
51
|
+
- 'w_B_ECI_in_B_x': The x-coordinate of the angular velocity. Optional.
|
52
|
+
- 'w_B_ECI_in_B_y': The y-coordinate of the angular velocity. Optional.
|
53
|
+
- 'w_B_ECI_in_B_z': The z-coordinate of the angular velocity. Optional.
|
54
|
+
- 'drag_coefficient'/'cd': The drag coefficient. Optional.
|
55
|
+
- 'cross_sectional_area'/'surface_area': The cross-sectional area. Optional.
|
56
|
+
- 'mass': The mass. Optional.
|
57
|
+
|
58
|
+
Args:
|
59
|
+
data (dict): The dictionary.
|
60
|
+
|
61
|
+
Returns:
|
62
|
+
State: The State.
|
63
|
+
|
64
|
+
"""
|
65
|
+
CANONICAL_FORMAT: str = '(r|v)_(.*?)_(x|y|z)'
|
@@ -0,0 +1,232 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
import numpy
|
3
|
+
import ostk.core.type
|
4
|
+
import ostk.physics.time
|
5
|
+
import typing
|
6
|
+
__all__ = ['FiniteDifferenceSolver', 'TemporalConditionSolver']
|
7
|
+
class FiniteDifferenceSolver:
|
8
|
+
"""
|
9
|
+
|
10
|
+
A Finite Difference Solver to compute the gradient, state transition matrix, and jacobian of a function.
|
11
|
+
|
12
|
+
|
13
|
+
"""
|
14
|
+
class Type:
|
15
|
+
"""
|
16
|
+
|
17
|
+
Type of finite difference scheme.
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
Members:
|
22
|
+
|
23
|
+
Forward : Forward difference scheme.
|
24
|
+
|
25
|
+
Backward : Backward difference scheme.
|
26
|
+
|
27
|
+
Central : Central difference scheme.
|
28
|
+
"""
|
29
|
+
Backward: typing.ClassVar[FiniteDifferenceSolver.Type] # value = <Type.Backward: 1>
|
30
|
+
Central: typing.ClassVar[FiniteDifferenceSolver.Type] # value = <Type.Central: 2>
|
31
|
+
Forward: typing.ClassVar[FiniteDifferenceSolver.Type] # value = <Type.Forward: 0>
|
32
|
+
__members__: typing.ClassVar[dict[str, FiniteDifferenceSolver.Type]] # value = {'Forward': <Type.Forward: 0>, 'Backward': <Type.Backward: 1>, 'Central': <Type.Central: 2>}
|
33
|
+
@staticmethod
|
34
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
35
|
+
...
|
36
|
+
def __eq__(self, other: typing.Any) -> bool:
|
37
|
+
...
|
38
|
+
def __getstate__(self) -> int:
|
39
|
+
...
|
40
|
+
def __hash__(self) -> int:
|
41
|
+
...
|
42
|
+
def __index__(self) -> int:
|
43
|
+
...
|
44
|
+
def __init__(self, value: int) -> None:
|
45
|
+
...
|
46
|
+
def __int__(self) -> int:
|
47
|
+
...
|
48
|
+
def __ne__(self, other: typing.Any) -> bool:
|
49
|
+
...
|
50
|
+
def __repr__(self) -> str:
|
51
|
+
...
|
52
|
+
def __setstate__(self, state: int) -> None:
|
53
|
+
...
|
54
|
+
def __str__(self) -> str:
|
55
|
+
...
|
56
|
+
@property
|
57
|
+
def name(self) -> str:
|
58
|
+
...
|
59
|
+
@property
|
60
|
+
def value(self) -> int:
|
61
|
+
...
|
62
|
+
@staticmethod
|
63
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
64
|
+
...
|
65
|
+
@staticmethod
|
66
|
+
def default() -> FiniteDifferenceSolver:
|
67
|
+
"""
|
68
|
+
Get the default Finite Difference Solver.
|
69
|
+
|
70
|
+
Returns:
|
71
|
+
FiniteDifferenceSolver: The default Finite Difference Solver.
|
72
|
+
"""
|
73
|
+
@staticmethod
|
74
|
+
def string_from_type(type: FiniteDifferenceSolver.Type) -> ostk.core.type.String:
|
75
|
+
"""
|
76
|
+
Convert a type to string.
|
77
|
+
|
78
|
+
Args:
|
79
|
+
type (FiniteDifferenceSolver.Type): The type.
|
80
|
+
|
81
|
+
Returns:
|
82
|
+
str: The string name of the type.
|
83
|
+
"""
|
84
|
+
def __init__(self, type: FiniteDifferenceSolver.Type, step_percentage: ostk.core.type.Real, step_duration: ostk.physics.time.Duration) -> None:
|
85
|
+
"""
|
86
|
+
Construct a FiniteDifferenceSolver.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
type (FiniteDifferenceSolver.Type): Type of finite difference scheme.
|
90
|
+
step_percentage (float): The step percentage to use for computing the STM/Jacobian.
|
91
|
+
step_duration (Duration): The step duration to use for computing the gradient.
|
92
|
+
|
93
|
+
Returns:
|
94
|
+
FiniteDifferenceSolver: The FiniteDifferenceSolver.
|
95
|
+
"""
|
96
|
+
def __repr__(self) -> str:
|
97
|
+
...
|
98
|
+
def __str__(self) -> str:
|
99
|
+
...
|
100
|
+
def compute_gradient(self, state: ..., generate_state_coordinates: typing.Callable[[..., ostk.physics.time.Instant], numpy.ndarray[numpy.float64[m, 1]]]) -> numpy.ndarray[numpy.float64[m, 1]]:
|
101
|
+
"""
|
102
|
+
Compute the gradient.
|
103
|
+
|
104
|
+
Args:
|
105
|
+
state (State): The state.
|
106
|
+
generate_state_coordinates (function): The function to generate the state coordinates.
|
107
|
+
|
108
|
+
Returns:
|
109
|
+
np.array: The gradient.
|
110
|
+
"""
|
111
|
+
def compute_jacobian(self, state: ..., generate_state_coordinates: typing.Callable[[..., ostk.physics.time.Instant], numpy.ndarray[numpy.float64[m, 1]]]) -> numpy.ndarray[numpy.float64[m, n]]:
|
112
|
+
"""
|
113
|
+
Compute the jacobian.
|
114
|
+
|
115
|
+
Args:
|
116
|
+
state (State): The state.
|
117
|
+
generate_state_coordinates (function): The function to generate the state coordinates.
|
118
|
+
|
119
|
+
Returns:
|
120
|
+
np.array: The jacobian.
|
121
|
+
"""
|
122
|
+
@typing.overload
|
123
|
+
def compute_state_transition_matrix(self, state: ..., instants: list[ostk.physics.time.Instant], generate_states_coordinates: typing.Callable[[..., list[ostk.physics.time.Instant]], numpy.ndarray[numpy.float64[m, n]]]) -> list[numpy.ndarray[numpy.float64[m, n]]]:
|
124
|
+
"""
|
125
|
+
Compute a list of state transition matrix (STM) at the provided instants.
|
126
|
+
|
127
|
+
Args:
|
128
|
+
state (State): The state.
|
129
|
+
instants (Array(Instant)): The instants at which to calculate the STM.
|
130
|
+
generate_states_coordinates (callable): The function to get the states coordinates as a matrix. Each column is a set of state coordinates.
|
131
|
+
|
132
|
+
Returns:
|
133
|
+
np.array: The list of state transition matrices.
|
134
|
+
"""
|
135
|
+
@typing.overload
|
136
|
+
def compute_state_transition_matrix(self, state: ..., instant: ostk.physics.time.Instant, generate_state_coordinates: typing.Callable[[..., ostk.physics.time.Instant], numpy.ndarray[numpy.float64[m, 1]]]) -> numpy.ndarray[numpy.float64[m, n]]:
|
137
|
+
"""
|
138
|
+
Compute the state transition matrix (STM).
|
139
|
+
|
140
|
+
Args:
|
141
|
+
state (State): The state.
|
142
|
+
instant (Instant): The instant at which to calculate the STM.
|
143
|
+
generate_state_coordinates (callable): The function to get the state coordinates. Must be a column vector.
|
144
|
+
|
145
|
+
Returns:
|
146
|
+
np.array: The state transition matrix.
|
147
|
+
"""
|
148
|
+
def get_step_duration(self) -> ostk.physics.time.Duration:
|
149
|
+
"""
|
150
|
+
Get the step duration used for computing the gradient.
|
151
|
+
|
152
|
+
Returns:
|
153
|
+
Duration: The step duration.
|
154
|
+
"""
|
155
|
+
def get_step_percentage(self) -> ostk.core.type.Real:
|
156
|
+
"""
|
157
|
+
Get the step percentage used for computing the STM.
|
158
|
+
|
159
|
+
Returns:
|
160
|
+
float: The step percentage.
|
161
|
+
"""
|
162
|
+
def get_type(self) -> FiniteDifferenceSolver.Type:
|
163
|
+
"""
|
164
|
+
Get the type.
|
165
|
+
|
166
|
+
Returns:
|
167
|
+
FiniteDifferenceSolver.Type: The type.
|
168
|
+
"""
|
169
|
+
class TemporalConditionSolver:
|
170
|
+
"""
|
171
|
+
|
172
|
+
Given a set of conditions and a time interval, the solver computes all sub-intervals over which conditions are met.
|
173
|
+
|
174
|
+
|
175
|
+
"""
|
176
|
+
@staticmethod
|
177
|
+
def _pybind11_conduit_v1_(*args, **kwargs):
|
178
|
+
...
|
179
|
+
def __init__(self, time_step: ostk.physics.time.Duration, tolerance: ostk.physics.time.Duration, maximum_iteration_count: int = 500) -> None:
|
180
|
+
"""
|
181
|
+
Constructor.
|
182
|
+
|
183
|
+
Args:
|
184
|
+
time_step (Duration): The time step.
|
185
|
+
tolerance (Duration): The tolerance of the solver.
|
186
|
+
maximum_iteration_count (int): The maximum number of iterations allowed.
|
187
|
+
"""
|
188
|
+
def get_maximum_iteration_count(self) -> int:
|
189
|
+
"""
|
190
|
+
Get the maximum number of iterations allowed.
|
191
|
+
|
192
|
+
Returns:
|
193
|
+
int: The maximum number of iterations allowed.
|
194
|
+
"""
|
195
|
+
def get_time_step(self) -> ostk.physics.time.Duration:
|
196
|
+
"""
|
197
|
+
Get the time step.
|
198
|
+
|
199
|
+
Returns:
|
200
|
+
Duration: The time step.
|
201
|
+
"""
|
202
|
+
def get_tolerance(self) -> ostk.physics.time.Duration:
|
203
|
+
"""
|
204
|
+
Get the tolerance.
|
205
|
+
|
206
|
+
Returns:
|
207
|
+
Duration: The tolerance.
|
208
|
+
"""
|
209
|
+
@typing.overload
|
210
|
+
def solve(self, condition: typing.Callable[[ostk.physics.time.Instant], bool], interval: ostk.physics.time.Interval) -> list[ostk.physics.time.Interval]:
|
211
|
+
"""
|
212
|
+
Solve a temporal condition.
|
213
|
+
|
214
|
+
Args:
|
215
|
+
condition (function): The condition to solve.
|
216
|
+
interval (Interval): The interval to solve the condition over.
|
217
|
+
|
218
|
+
Returns:
|
219
|
+
Duration: The time at which the condition is satisfied.
|
220
|
+
"""
|
221
|
+
@typing.overload
|
222
|
+
def solve(self, conditions: list[typing.Callable[[ostk.physics.time.Instant], bool]], interval: ostk.physics.time.Interval) -> list[ostk.physics.time.Interval]:
|
223
|
+
"""
|
224
|
+
Solve an array of temporal conditions.
|
225
|
+
|
226
|
+
Args:
|
227
|
+
conditions (list): The conditions to solve.
|
228
|
+
interval (Interval): The interval to solve the conditions over.
|
229
|
+
|
230
|
+
Returns:
|
231
|
+
list: The times at which the conditions are satisfied.
|
232
|
+
"""
|