open-space-toolkit-physics 11.3.0__py312-none-manylinux2014_x86_64.whl
Sign up to get free protection for your applications and to get access to all the features.
- open_space_toolkit_physics-11.3.0.dist-info/METADATA +29 -0
- open_space_toolkit_physics-11.3.0.dist-info/RECORD +104 -0
- open_space_toolkit_physics-11.3.0.dist-info/WHEEL +5 -0
- open_space_toolkit_physics-11.3.0.dist-info/top_level.txt +1 -0
- open_space_toolkit_physics-11.3.0.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/physics/OpenSpaceToolkitPhysicsPy.cpython-312-x86_64-linux-gnu.so +0 -0
- ostk/physics/__init__.py +6 -0
- ostk/physics/__init__.pyi +488 -0
- ostk/physics/coordinate/__init__.pyi +1002 -0
- ostk/physics/coordinate/frame/__init__.pyi +30 -0
- ostk/physics/coordinate/frame/provider/__init__.pyi +77 -0
- ostk/physics/coordinate/frame/provider/iau.pyi +64 -0
- ostk/physics/coordinate/frame/provider/iers.pyi +584 -0
- ostk/physics/coordinate/spherical.pyi +421 -0
- ostk/physics/data/__init__.pyi +459 -0
- ostk/physics/data/provider.pyi +21 -0
- ostk/physics/environment/__init__.pyi +108 -0
- ostk/physics/environment/atmospheric/__init__.pyi +181 -0
- ostk/physics/environment/atmospheric/earth.pyi +552 -0
- ostk/physics/environment/gravitational/__init__.pyi +559 -0
- ostk/physics/environment/gravitational/earth.pyi +56 -0
- ostk/physics/environment/magnetic/__init__.pyi +171 -0
- ostk/physics/environment/magnetic/earth.pyi +56 -0
- ostk/physics/environment/object/__init__.pyi +430 -0
- ostk/physics/environment/object/celestial/__init__.pyi +248 -0
- ostk/physics/environment/object/celestial/moon.pyi +2 -0
- ostk/physics/environment/object/celestial/sun.pyi +2 -0
- ostk/physics/libopen-space-toolkit-physics.so.11 +0 -0
- ostk/physics/py.typed +0 -0
- ostk/physics/test/__init__.py +1 -0
- ostk/physics/test/coordinate/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/provider/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/provider/iers/__init__.py +1 -0
- ostk/physics/test/coordinate/frame/provider/iers/conftest.py +38 -0
- ostk/physics/test/coordinate/frame/provider/iers/data/finals2000A.data +10953 -0
- ostk/physics/test/coordinate/frame/provider/iers/data/ser7.dat +524 -0
- ostk/physics/test/coordinate/frame/provider/iers/test_bulletin_a.py +108 -0
- ostk/physics/test/coordinate/frame/provider/iers/test_finals_2000a.py +93 -0
- ostk/physics/test/coordinate/frame/provider/iers/test_manager.py +205 -0
- ostk/physics/test/coordinate/spherical/__init__.py +1 -0
- ostk/physics/test/coordinate/spherical/test_aer.py +143 -0
- ostk/physics/test/coordinate/spherical/test_lla.py +514 -0
- ostk/physics/test/coordinate/test_axes.py +116 -0
- ostk/physics/test/coordinate/test_frame.py +107 -0
- ostk/physics/test/coordinate/test_position.py +201 -0
- ostk/physics/test/coordinate/test_transform.py +294 -0
- ostk/physics/test/coordinate/test_velocity.py +180 -0
- ostk/physics/test/data/conftest.py +34 -0
- ostk/physics/test/data/data/manifest.json +22 -0
- ostk/physics/test/data/provider/test_provider.py +34 -0
- ostk/physics/test/data/test_direction.py +40 -0
- ostk/physics/test/data/test_manifest.py +43 -0
- ostk/physics/test/data/test_manifest_manager.py +62 -0
- ostk/physics/test/data/test_scalar.py +54 -0
- ostk/physics/test/data/test_vector.py +70 -0
- ostk/physics/test/environment/__init__.py +1 -0
- ostk/physics/test/environment/atmospheric/__init__.py +1 -0
- ostk/physics/test/environment/atmospheric/earth/__init__.py +1 -0
- ostk/physics/test/environment/atmospheric/earth/conftest.py +67 -0
- ostk/physics/test/environment/atmospheric/earth/data/SW-Last5Years.test.csv +22 -0
- ostk/physics/test/environment/atmospheric/earth/data/SpaceWeather-All-v1.2.test.txt +811 -0
- ostk/physics/test/environment/atmospheric/earth/test_cssi_space_weather.py +126 -0
- ostk/physics/test/environment/atmospheric/earth/test_exponential.py +34 -0
- ostk/physics/test/environment/atmospheric/earth/test_manager.py +173 -0
- ostk/physics/test/environment/atmospheric/earth/test_nrlmsise00.py +34 -0
- ostk/physics/test/environment/atmospheric/test_earth.py +141 -0
- ostk/physics/test/environment/gravitational/__init__.py +1 -0
- ostk/physics/test/environment/gravitational/earth/__init__.py +1 -0
- ostk/physics/test/environment/gravitational/earth/test_manager.py +76 -0
- ostk/physics/test/environment/gravitational/test_earth.py +103 -0
- ostk/physics/test/environment/gravitational/test_moon.py +55 -0
- ostk/physics/test/environment/gravitational/test_spherical.py +36 -0
- ostk/physics/test/environment/gravitational/test_sun.py +53 -0
- ostk/physics/test/environment/magnetic/__init__.py +1 -0
- ostk/physics/test/environment/magnetic/earth/test_manager.py +64 -0
- ostk/physics/test/environment/magnetic/test_earth.py +38 -0
- ostk/physics/test/environment/object/__init__.py +1 -0
- ostk/physics/test/environment/object/celestial/__init__ .py +1 -0
- ostk/physics/test/environment/object/celestial/test_earth.py +174 -0
- ostk/physics/test/environment/object/celestial/test_moon.py +17 -0
- ostk/physics/test/environment/object/celestial/test_sun.py +17 -0
- ostk/physics/test/environment/object/test_celestial.py +12 -0
- ostk/physics/test/test_environment.py +97 -0
- ostk/physics/test/test_import.py +25 -0
- ostk/physics/test/time/__init__.py +1 -0
- ostk/physics/test/time/test_date.py +136 -0
- ostk/physics/test/time/test_date_time.py +230 -0
- ostk/physics/test/time/test_duration.py +215 -0
- ostk/physics/test/time/test_instant.py +103 -0
- ostk/physics/test/time/test_interval.py +432 -0
- ostk/physics/test/time/test_scale.py +11 -0
- ostk/physics/test/time/test_time.py +114 -0
- ostk/physics/test/unit/__init__.py +1 -0
- ostk/physics/test/unit/derived/__init__.py +1 -0
- ostk/physics/test/unit/derived/test_angle.py +368 -0
- ostk/physics/test/unit/test_derived.py +152 -0
- ostk/physics/test/unit/test_electric_current.py +5 -0
- ostk/physics/test/unit/test_length.py +297 -0
- ostk/physics/test/unit/test_mass.py +141 -0
- ostk/physics/test/unit/test_time.py +101 -0
- ostk/physics/time.pyi +1744 -0
- ostk/physics/unit.pyi +1590 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
|
5
|
+
import numpy as np
|
6
|
+
|
7
|
+
from ostk.physics.time import Instant
|
8
|
+
from ostk.physics.time import DateTime
|
9
|
+
from ostk.physics.time import Scale
|
10
|
+
from ostk.physics.coordinate import Frame
|
11
|
+
from ostk.physics.coordinate.frame.provider import iau
|
12
|
+
from ostk.physics.coordinate.frame.provider import Dynamic
|
13
|
+
|
14
|
+
|
15
|
+
@pytest.fixture
|
16
|
+
def epoch() -> Instant:
|
17
|
+
return Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
18
|
+
|
19
|
+
|
20
|
+
@pytest.fixture
|
21
|
+
def frame() -> Frame:
|
22
|
+
return Frame.ITRF()
|
23
|
+
|
24
|
+
|
25
|
+
class TestFrame:
|
26
|
+
def test_is_defined(self, frame: Frame):
|
27
|
+
assert frame.is_defined() is True
|
28
|
+
|
29
|
+
def test_is_quasi_inertial(self, frame: Frame):
|
30
|
+
assert frame.is_quasi_inertial() is False
|
31
|
+
|
32
|
+
def test_has_parent(self, frame: Frame):
|
33
|
+
assert frame.has_parent() is True
|
34
|
+
|
35
|
+
def test_access_parent(self, frame: Frame):
|
36
|
+
assert frame.access_parent() is not None
|
37
|
+
|
38
|
+
def test_access_ancestor(self, frame: Frame):
|
39
|
+
assert frame.access_ancestor(ancestor_degree=1) is not None
|
40
|
+
|
41
|
+
def test_access_provider(self, frame: Frame):
|
42
|
+
assert frame.access_provider()
|
43
|
+
|
44
|
+
def test_get_name(self, frame: Frame):
|
45
|
+
assert frame.get_name() == "ITRF"
|
46
|
+
|
47
|
+
def test_get_origin_in(self, epoch: Instant, frame: Frame):
|
48
|
+
assert frame.get_origin_in(frame=frame, instant=epoch) is not None
|
49
|
+
|
50
|
+
def test_get_velocity_in(self, epoch: Instant, frame: Frame):
|
51
|
+
assert frame.get_velocity_in(frame=frame, instant=epoch) is not None
|
52
|
+
|
53
|
+
def test_get_axes_in(self, epoch: Instant, frame: Frame):
|
54
|
+
assert frame.get_axes_in(frame=frame, instant=epoch) is not None
|
55
|
+
|
56
|
+
def test_get_transform_to(self, epoch: Instant, frame: Frame):
|
57
|
+
assert frame.get_transform_to(frame=frame, instant=epoch) is not None
|
58
|
+
|
59
|
+
def test_undefined(self):
|
60
|
+
assert Frame.undefined() is not None
|
61
|
+
|
62
|
+
def test_GCRF(self):
|
63
|
+
assert Frame.GCRF() is not None
|
64
|
+
|
65
|
+
def test_J2000(self):
|
66
|
+
assert Frame.J2000(theory=iau.Theory.IAU_2006) is not None
|
67
|
+
|
68
|
+
def test_MOD(self, epoch: Instant):
|
69
|
+
assert Frame.MOD(epoch=epoch) is not None
|
70
|
+
|
71
|
+
def test_TOD(self, epoch: Instant):
|
72
|
+
assert Frame.TOD(epoch=epoch, theory=iau.Theory.IAU_2006) is not None
|
73
|
+
|
74
|
+
def test_TEME(self):
|
75
|
+
assert Frame.TEME() is not None
|
76
|
+
|
77
|
+
def test_TEME_of_epoch(self, epoch: Instant):
|
78
|
+
assert Frame.TEME_of_epoch(epoch=epoch) is not None
|
79
|
+
|
80
|
+
def test_CIRF(self):
|
81
|
+
assert Frame.CIRF() is not None
|
82
|
+
|
83
|
+
def test_TIRF(self):
|
84
|
+
assert Frame.TIRF() is not None
|
85
|
+
|
86
|
+
def test_ITRF(self):
|
87
|
+
assert Frame.ITRF() is not None
|
88
|
+
|
89
|
+
def test_with_name(self, frame: Frame):
|
90
|
+
assert Frame.with_name(name=frame.get_name()) is not None
|
91
|
+
|
92
|
+
def test_exists(self, frame: Frame):
|
93
|
+
assert Frame.exists(name=frame.get_name()) is True
|
94
|
+
|
95
|
+
def test_construct_destruct(self, frame: Frame):
|
96
|
+
custom_frame = Frame.construct(
|
97
|
+
name="Custom Frame",
|
98
|
+
is_quasi_inertial=True,
|
99
|
+
parent_frame=frame,
|
100
|
+
provider=Dynamic(lambda _: None),
|
101
|
+
)
|
102
|
+
|
103
|
+
assert custom_frame is not None
|
104
|
+
|
105
|
+
Frame.destruct(custom_frame.get_name())
|
106
|
+
|
107
|
+
assert Frame.exists(name="Custom Frame") is False
|
@@ -0,0 +1,201 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
import numpy as np
|
5
|
+
|
6
|
+
from ostk.core.type import String
|
7
|
+
|
8
|
+
from ostk.physics import Environment
|
9
|
+
from ostk.physics.coordinate import Frame
|
10
|
+
from ostk.physics.coordinate import Position
|
11
|
+
from ostk.physics.coordinate.spherical import LLA
|
12
|
+
from ostk.physics.time import Instant
|
13
|
+
from ostk.physics.time import Scale
|
14
|
+
from ostk.physics.time import DateTime
|
15
|
+
from ostk.physics.unit import Length
|
16
|
+
|
17
|
+
|
18
|
+
@pytest.fixture
|
19
|
+
def unit() -> Length.Unit:
|
20
|
+
return Length.Unit.Meter
|
21
|
+
|
22
|
+
|
23
|
+
@pytest.fixture
|
24
|
+
def frame() -> Frame:
|
25
|
+
return Frame.GCRF()
|
26
|
+
|
27
|
+
|
28
|
+
@pytest.fixture
|
29
|
+
def earth():
|
30
|
+
return Environment.default().access_celestial_object_with_name("Earth")
|
31
|
+
|
32
|
+
|
33
|
+
@pytest.fixture
|
34
|
+
def lla() -> LLA:
|
35
|
+
return LLA.vector([0.0, 0.0, 0.0])
|
36
|
+
|
37
|
+
|
38
|
+
class TestPosition:
|
39
|
+
|
40
|
+
def test_constructors(self, unit: Length.Unit, frame: Frame):
|
41
|
+
# Construction with python lists
|
42
|
+
vector = [1000.0, 0.0, 0.0]
|
43
|
+
|
44
|
+
position: Position = Position(vector, unit, frame)
|
45
|
+
|
46
|
+
assert position is not None
|
47
|
+
assert isinstance(position, Position)
|
48
|
+
assert position.is_defined()
|
49
|
+
|
50
|
+
# Construction with python tuples
|
51
|
+
vector = (1000.0, 0.0, 0.0)
|
52
|
+
|
53
|
+
position: Position = Position(vector, unit, frame)
|
54
|
+
|
55
|
+
assert position is not None
|
56
|
+
assert isinstance(position, Position)
|
57
|
+
assert position.is_defined()
|
58
|
+
|
59
|
+
# Construction with python numpy arrays
|
60
|
+
vector = np.array((1000.0, 0.0, 0.0))
|
61
|
+
|
62
|
+
position: Position = Position(vector, unit, frame)
|
63
|
+
|
64
|
+
assert position is not None
|
65
|
+
assert isinstance(position, Position)
|
66
|
+
assert position.is_defined()
|
67
|
+
|
68
|
+
# Construction with meters static constructor
|
69
|
+
position: Position = Position.meters(vector, frame)
|
70
|
+
|
71
|
+
assert position is not None
|
72
|
+
assert isinstance(position, Position)
|
73
|
+
assert position.is_defined()
|
74
|
+
|
75
|
+
# Construction with undefined static constructor
|
76
|
+
position: Position = Position.undefined()
|
77
|
+
|
78
|
+
assert position is not None
|
79
|
+
assert isinstance(position, Position)
|
80
|
+
assert position.is_defined() is False
|
81
|
+
|
82
|
+
def test_comparators(self, unit: Length.Unit, frame: Frame):
|
83
|
+
vector_1 = [1000.0, 0.0, 0.0]
|
84
|
+
vector_2 = [-450.3, 234.9, -23.0]
|
85
|
+
|
86
|
+
position_1: Position = Position(vector_1, unit, frame)
|
87
|
+
position_2: Position = Position(vector_2, unit, frame)
|
88
|
+
|
89
|
+
assert position_1 == position_1
|
90
|
+
assert position_2 == position_2
|
91
|
+
assert position_1 != position_2
|
92
|
+
|
93
|
+
def test_is_defined(self, unit: Length.Unit, frame: Frame):
|
94
|
+
vector = [1000.0, 0.0, 0.0]
|
95
|
+
position: Position = Position(vector, unit, frame)
|
96
|
+
|
97
|
+
assert position.is_defined()
|
98
|
+
assert Position.undefined().is_defined() is False
|
99
|
+
|
100
|
+
@pytest.mark.skip
|
101
|
+
def test_is_near(self, unit: Length.Unit, frame: Frame):
|
102
|
+
|
103
|
+
vector_1 = [1000.0, 0.0, 0.0]
|
104
|
+
vector_2 = [1000.00001, 0.0001, 0.0]
|
105
|
+
|
106
|
+
position_1: Position = Position(vector_1, unit, frame)
|
107
|
+
position_2: Position = Position(vector_2, unit, frame)
|
108
|
+
|
109
|
+
assert position_1.is_near(position_2, Length.Unit.Meter)
|
110
|
+
assert position_2.is_near(position_1, Length.Unit.Meter)
|
111
|
+
|
112
|
+
def test_access_frame(self, unit: Length.Unit, frame: Frame):
|
113
|
+
vector = [1000.0, 0.0, 0.0]
|
114
|
+
|
115
|
+
position: Position = Position(vector, unit, frame)
|
116
|
+
|
117
|
+
ans_frame = position.access_frame()
|
118
|
+
|
119
|
+
assert ans_frame is not None
|
120
|
+
assert isinstance(ans_frame, Frame)
|
121
|
+
assert ans_frame == frame
|
122
|
+
|
123
|
+
def test_get_coordinates(self, unit: Length.Unit, frame: Frame):
|
124
|
+
vector = [1000.0, 0.0, 0.0]
|
125
|
+
|
126
|
+
position: Position = Position(vector, unit, frame)
|
127
|
+
|
128
|
+
coordinates = position.get_coordinates()
|
129
|
+
|
130
|
+
assert coordinates is not None
|
131
|
+
assert isinstance(coordinates, np.ndarray)
|
132
|
+
assert np.array_equal(coordinates, vector)
|
133
|
+
|
134
|
+
def test_get_unit(self, unit: Length.Unit, frame: Frame):
|
135
|
+
vector = [1000.0, 0.0, 0.0]
|
136
|
+
|
137
|
+
position: Position = Position(vector, unit, frame)
|
138
|
+
|
139
|
+
ans_unit = position.get_unit()
|
140
|
+
|
141
|
+
assert ans_unit is not None
|
142
|
+
assert isinstance(ans_unit, Length.Unit)
|
143
|
+
assert ans_unit == unit
|
144
|
+
|
145
|
+
def test_in_unit(self, unit: Length.Unit, frame: Frame):
|
146
|
+
vector = [1000.0, 0.0, 0.0]
|
147
|
+
|
148
|
+
position: Position = Position(vector, unit, frame)
|
149
|
+
|
150
|
+
new_position: Position = position.in_unit(Length.Unit.Meter)
|
151
|
+
|
152
|
+
assert new_position is not None
|
153
|
+
assert isinstance(new_position, Position)
|
154
|
+
assert new_position == position
|
155
|
+
|
156
|
+
new_position: Position = position.in_unit(Length.Unit.TerrestrialMile)
|
157
|
+
|
158
|
+
assert new_position is not None
|
159
|
+
assert isinstance(new_position, Position)
|
160
|
+
# assert new_position == position
|
161
|
+
|
162
|
+
def test_in_meters(self, unit: Length.Unit, frame: Frame):
|
163
|
+
vector = [1000.0, 0.0, 0.0]
|
164
|
+
|
165
|
+
position: Position = Position(vector, unit, frame)
|
166
|
+
|
167
|
+
new_position: Position = position.in_meters()
|
168
|
+
|
169
|
+
assert new_position is not None
|
170
|
+
assert isinstance(new_position, Position)
|
171
|
+
assert new_position == position
|
172
|
+
|
173
|
+
def test_in_frame(self, unit: Length.Unit, frame: Frame):
|
174
|
+
vector = [1000.0, 0.0, 0.0]
|
175
|
+
|
176
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
177
|
+
|
178
|
+
position: Position = Position(vector, unit, frame)
|
179
|
+
|
180
|
+
new_position: Position = position.in_frame(frame, instant)
|
181
|
+
|
182
|
+
assert new_position is not None
|
183
|
+
assert isinstance(new_position, Position)
|
184
|
+
assert new_position == position
|
185
|
+
|
186
|
+
def test_to_string(self, unit: Length.Unit, frame: Frame):
|
187
|
+
vector = [1000.0, 0.0, 0.0]
|
188
|
+
|
189
|
+
position: Position = Position(vector, unit, frame)
|
190
|
+
|
191
|
+
string: String = position.to_string()
|
192
|
+
|
193
|
+
assert string is not None
|
194
|
+
assert isinstance(string, String)
|
195
|
+
assert string == "[1000.0, 0.0, 0.0] [m] @ GCRF"
|
196
|
+
|
197
|
+
def test_from_lla(self, lla: LLA, earth):
|
198
|
+
assert Position.from_lla(lla, earth) is not None
|
199
|
+
|
200
|
+
Environment.default(True)
|
201
|
+
assert Position.from_lla(lla) is not None
|
@@ -0,0 +1,294 @@
|
|
1
|
+
# Apache License 2.0
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
import numpy as np
|
5
|
+
|
6
|
+
from ostk.core.type import String
|
7
|
+
import ostk.physics as physics
|
8
|
+
|
9
|
+
import ostk.mathematics as mathematics
|
10
|
+
|
11
|
+
Scale = physics.time.Scale
|
12
|
+
DateTime = physics.time.DateTime
|
13
|
+
Instant = physics.time.Instant
|
14
|
+
Quaternion = mathematics.geometry.d3.transformation.rotation.Quaternion
|
15
|
+
Transform = physics.coordinate.Transform
|
16
|
+
Type = Transform.Type
|
17
|
+
|
18
|
+
|
19
|
+
def test_coordinate_transform_type():
|
20
|
+
enum_members = Type.__members__
|
21
|
+
|
22
|
+
list_keys = ["Undefined", "Active", "Passive"]
|
23
|
+
list_values = [Type.Undefined, Type.Active, Type.Passive]
|
24
|
+
|
25
|
+
assert list(enum_members.keys()) == list_keys
|
26
|
+
assert list(enum_members.values()) == list_values
|
27
|
+
|
28
|
+
|
29
|
+
def test_coordinate_transform_constructors():
|
30
|
+
# Construct arbitrary Instant
|
31
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
32
|
+
|
33
|
+
# Construct arbitrary Orientation
|
34
|
+
quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
|
35
|
+
|
36
|
+
# Construct Transform Type
|
37
|
+
transform_type: Type = Type.Passive
|
38
|
+
|
39
|
+
# Construction using python lists
|
40
|
+
translation = [1.0, 0.0, 0.0]
|
41
|
+
velocity = [0.01, 0.0, 0.0]
|
42
|
+
angular_velocity = [0.01, 0.01, 0.01]
|
43
|
+
|
44
|
+
transform: Transform = Transform(
|
45
|
+
instant, translation, velocity, quaternion, angular_velocity, transform_type
|
46
|
+
)
|
47
|
+
|
48
|
+
assert transform is not None
|
49
|
+
assert isinstance(transform, Transform)
|
50
|
+
|
51
|
+
# Construction using python tuples
|
52
|
+
translation = (1.0, 0.0, 0.0)
|
53
|
+
velocity = (0.01, 0.0, 0.0)
|
54
|
+
angular_velocity = (0.01, 0.01, 0.01)
|
55
|
+
|
56
|
+
transform: Transform = Transform(
|
57
|
+
instant, translation, velocity, quaternion, angular_velocity, transform_type
|
58
|
+
)
|
59
|
+
|
60
|
+
assert transform is not None
|
61
|
+
assert isinstance(transform, Transform)
|
62
|
+
|
63
|
+
# Construction using python numpy arrays
|
64
|
+
translation = np.array(translation)
|
65
|
+
velocity = np.array(velocity)
|
66
|
+
angular_velocity = np.array(angular_velocity)
|
67
|
+
|
68
|
+
transform: Transform = Transform(
|
69
|
+
instant, translation, velocity, quaternion, angular_velocity, transform_type
|
70
|
+
)
|
71
|
+
|
72
|
+
assert transform is not None
|
73
|
+
assert isinstance(transform, Transform)
|
74
|
+
|
75
|
+
# Construct using identity static constructor
|
76
|
+
|
77
|
+
transform: Transform = Transform.identity(instant)
|
78
|
+
|
79
|
+
assert transform is not None
|
80
|
+
assert isinstance(transform, Transform)
|
81
|
+
|
82
|
+
# Construct using active static constructor
|
83
|
+
|
84
|
+
transform: Transform = Transform.active(
|
85
|
+
instant, translation, velocity, quaternion, angular_velocity
|
86
|
+
)
|
87
|
+
|
88
|
+
assert transform is not None
|
89
|
+
assert isinstance(transform, Transform)
|
90
|
+
|
91
|
+
# Construct using passive static constructor
|
92
|
+
|
93
|
+
transform: Transform = Transform.passive(
|
94
|
+
instant, translation, velocity, quaternion, angular_velocity
|
95
|
+
)
|
96
|
+
|
97
|
+
assert transform is not None
|
98
|
+
assert isinstance(transform, Transform)
|
99
|
+
|
100
|
+
|
101
|
+
def test_coordinate_transform_comparators():
|
102
|
+
# Construct arbitrary Instant
|
103
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
104
|
+
|
105
|
+
# Construct arbitrary Orientation
|
106
|
+
quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
|
107
|
+
|
108
|
+
# Construct Transform Type
|
109
|
+
transform_type: Type = Type.Passive
|
110
|
+
|
111
|
+
# Construction using python lists
|
112
|
+
translation_1 = [1.0, 0.0, 0.0]
|
113
|
+
translation_2 = [0.0, 0.0, 0.0]
|
114
|
+
velocity = [0.01, 0.0, 0.0]
|
115
|
+
angular_velocity = [0.01, 0.01, 0.01]
|
116
|
+
|
117
|
+
transform_1: Transform = Transform(
|
118
|
+
instant, translation_1, velocity, quaternion, angular_velocity, transform_type
|
119
|
+
)
|
120
|
+
transform_2: Transform = Transform(
|
121
|
+
instant, translation_2, velocity, quaternion, angular_velocity, transform_type
|
122
|
+
)
|
123
|
+
|
124
|
+
assert transform_1 == transform_1
|
125
|
+
assert transform_2 == transform_2
|
126
|
+
assert transform_1 != transform_2
|
127
|
+
|
128
|
+
|
129
|
+
def test_coordinate_transform_operators():
|
130
|
+
# Construct arbitrary Instant
|
131
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
132
|
+
|
133
|
+
# Construct arbitrary Orientation
|
134
|
+
quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
|
135
|
+
|
136
|
+
# Construct Transform Type
|
137
|
+
transform_type: Type = Type.Passive
|
138
|
+
|
139
|
+
# Construction using python lists
|
140
|
+
translation = [1.0, 0.0, 0.0]
|
141
|
+
velocity = [0.01, 0.0, 0.0]
|
142
|
+
angular_velocity = [0.01, 0.01, 0.01]
|
143
|
+
|
144
|
+
transform: Transform = Transform(
|
145
|
+
instant, translation, velocity, quaternion, angular_velocity, transform_type
|
146
|
+
)
|
147
|
+
|
148
|
+
mul_transform = transform * transform
|
149
|
+
|
150
|
+
assert mul_transform is not None
|
151
|
+
assert isinstance(mul_transform, Transform)
|
152
|
+
assert mul_transform.is_defined()
|
153
|
+
|
154
|
+
transform *= transform
|
155
|
+
|
156
|
+
assert transform is not None
|
157
|
+
assert isinstance(transform, Transform)
|
158
|
+
assert transform.is_defined()
|
159
|
+
|
160
|
+
|
161
|
+
def test_coordinate_transform_is_defined():
|
162
|
+
# Construct arbitrary Instant
|
163
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
164
|
+
|
165
|
+
# Construct arbitrary Orientation
|
166
|
+
quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
|
167
|
+
|
168
|
+
# Construct Transform Type
|
169
|
+
transform_type: Type = Type.Passive
|
170
|
+
|
171
|
+
# Construction using python lists
|
172
|
+
translation = [1.0, 0.0, 0.0]
|
173
|
+
velocity = [0.01, 0.0, 0.0]
|
174
|
+
angular_velocity = [0.01, 0.01, 0.01]
|
175
|
+
|
176
|
+
transform: Transform = Transform(
|
177
|
+
instant, translation, velocity, quaternion, angular_velocity, transform_type
|
178
|
+
)
|
179
|
+
|
180
|
+
assert transform.is_defined()
|
181
|
+
assert transform.undefined().is_defined() is False
|
182
|
+
|
183
|
+
|
184
|
+
def test_coordinate_transform_is_identity():
|
185
|
+
# Construct arbitrary Instant
|
186
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
187
|
+
|
188
|
+
# Construct arbitrary Orientation
|
189
|
+
quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
|
190
|
+
|
191
|
+
# Construct Transform Type
|
192
|
+
transform_type: Type = Type.Passive
|
193
|
+
|
194
|
+
# Construction using python lists
|
195
|
+
translation = [0.0, 0.0, 0.0]
|
196
|
+
velocity = [0.00, 0.0, 0.0]
|
197
|
+
angular_velocity = [0.00, 0.00, 0.00]
|
198
|
+
|
199
|
+
transform: Transform = Transform(
|
200
|
+
instant, translation, velocity, quaternion, angular_velocity, transform_type
|
201
|
+
)
|
202
|
+
|
203
|
+
assert transform.is_defined()
|
204
|
+
assert transform.is_identity()
|
205
|
+
assert transform.identity(instant).is_identity()
|
206
|
+
|
207
|
+
|
208
|
+
# def test_coordinate_transform_accesses ():
|
209
|
+
|
210
|
+
# access_instant
|
211
|
+
|
212
|
+
|
213
|
+
# access_translation
|
214
|
+
|
215
|
+
|
216
|
+
# access_velocity
|
217
|
+
|
218
|
+
|
219
|
+
# access_orientation
|
220
|
+
|
221
|
+
|
222
|
+
# access_angular_velocity
|
223
|
+
|
224
|
+
|
225
|
+
def test_coordinate_transform_getters():
|
226
|
+
# Construct arbitrary Instant
|
227
|
+
instant: Instant = Instant.date_time(DateTime(2020, 1, 1, 0, 0, 0), Scale.UTC)
|
228
|
+
|
229
|
+
# Construct arbitrary Orientation
|
230
|
+
quaternion: Quaternion = Quaternion([0.0, 0.0, 0.0], 1.0)
|
231
|
+
|
232
|
+
# Construct Transform Type
|
233
|
+
transform_type: Type = Type.Passive
|
234
|
+
|
235
|
+
# Construction using python lists
|
236
|
+
translation = [1.0, 0.0, 0.0]
|
237
|
+
velocity = [0.01, 0.0, 0.0]
|
238
|
+
angular_velocity = [0.01, 0.01, 0.01]
|
239
|
+
|
240
|
+
transform: Transform = Transform(
|
241
|
+
instant, translation, velocity, quaternion, angular_velocity, transform_type
|
242
|
+
)
|
243
|
+
|
244
|
+
# get_instant
|
245
|
+
ans_instant: Instant = transform.get_instant()
|
246
|
+
|
247
|
+
assert ans_instant is not None
|
248
|
+
assert isinstance(ans_instant, Instant)
|
249
|
+
assert ans_instant == instant
|
250
|
+
|
251
|
+
# get_translation
|
252
|
+
ans_translation = transform.get_translation()
|
253
|
+
|
254
|
+
assert ans_translation is not None
|
255
|
+
assert isinstance(ans_translation, np.ndarray)
|
256
|
+
assert np.array_equal(ans_translation, translation)
|
257
|
+
|
258
|
+
# get_velocity
|
259
|
+
ans_velocity = transform.get_velocity()
|
260
|
+
|
261
|
+
assert ans_velocity is not None
|
262
|
+
assert isinstance(ans_velocity, np.ndarray)
|
263
|
+
assert np.array_equal(ans_velocity, velocity)
|
264
|
+
|
265
|
+
# get_orientation
|
266
|
+
ans_quaternion = transform.get_orientation()
|
267
|
+
|
268
|
+
assert ans_quaternion is not None
|
269
|
+
assert isinstance(ans_quaternion, Quaternion)
|
270
|
+
assert ans_quaternion == quaternion
|
271
|
+
|
272
|
+
# get_angular_velocity
|
273
|
+
ans_angular_velocity = transform.get_angular_velocity()
|
274
|
+
|
275
|
+
assert ans_angular_velocity is not None
|
276
|
+
assert isinstance(ans_angular_velocity, np.ndarray)
|
277
|
+
assert np.array_equal(ans_angular_velocity, angular_velocity)
|
278
|
+
|
279
|
+
# get_inverse
|
280
|
+
inverse: Transform = transform.get_inverse()
|
281
|
+
|
282
|
+
assert inverse is not None
|
283
|
+
assert isinstance(inverse, Transform)
|
284
|
+
|
285
|
+
|
286
|
+
# def test_coordinate_transform_apply_to_position ():
|
287
|
+
|
288
|
+
# ################################################################################################################################################################
|
289
|
+
|
290
|
+
# def test_coordinate_transform_apply_to_velocity ():
|
291
|
+
|
292
|
+
# ################################################################################################################################################################
|
293
|
+
|
294
|
+
# def test_coordinate_transform_apply_to_vector ():
|