rocketpy 1.2.2__tar.gz → 1.3.0__tar.gz
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.
- {rocketpy-1.2.2 → rocketpy-1.3.0}/PKG-INFO +22 -27
- rocketpy-1.3.0/pyproject.toml +77 -0
- {rocketpy-1.2.2 → rocketpy-1.3.0}/rocketpy.egg-info/PKG-INFO +22 -27
- rocketpy-1.3.0/rocketpy.egg-info/SOURCES.txt +8 -0
- rocketpy-1.3.0/rocketpy.egg-info/requires.txt +25 -0
- {rocketpy-1.2.2 → rocketpy-1.3.0}/rocketpy.egg-info/top_level.txt +0 -1
- rocketpy-1.2.2/rocketpy/__init__.py +0 -40
- rocketpy-1.2.2/rocketpy/control/__init__.py +0 -1
- rocketpy-1.2.2/rocketpy/control/controller.py +0 -132
- rocketpy-1.2.2/rocketpy/environment/__init__.py +0 -2
- rocketpy-1.2.2/rocketpy/environment/environment.py +0 -3709
- rocketpy-1.2.2/rocketpy/environment/environment_analysis.py +0 -2919
- rocketpy-1.2.2/rocketpy/mathutils/__init__.py +0 -7
- rocketpy-1.2.2/rocketpy/mathutils/function.py +0 -3388
- rocketpy-1.2.2/rocketpy/mathutils/vector_matrix.py +0 -995
- rocketpy-1.2.2/rocketpy/motors/__init__.py +0 -13
- rocketpy-1.2.2/rocketpy/motors/fluid.py +0 -63
- rocketpy-1.2.2/rocketpy/motors/hybrid_motor.py +0 -624
- rocketpy-1.2.2/rocketpy/motors/liquid_motor.py +0 -493
- rocketpy-1.2.2/rocketpy/motors/motor.py +0 -1385
- rocketpy-1.2.2/rocketpy/motors/solid_motor.py +0 -720
- rocketpy-1.2.2/rocketpy/motors/tank.py +0 -1475
- rocketpy-1.2.2/rocketpy/motors/tank_geometry.py +0 -439
- rocketpy-1.2.2/rocketpy/plots/__init__.py +0 -1
- rocketpy-1.2.2/rocketpy/plots/aero_surface_plots.py +0 -487
- rocketpy-1.2.2/rocketpy/plots/compare/__init__.py +0 -2
- rocketpy-1.2.2/rocketpy/plots/compare/compare.py +0 -185
- rocketpy-1.2.2/rocketpy/plots/compare/compare_flights.py +0 -1638
- rocketpy-1.2.2/rocketpy/plots/environment_analysis_plots.py +0 -1831
- rocketpy-1.2.2/rocketpy/plots/environment_plots.py +0 -380
- rocketpy-1.2.2/rocketpy/plots/flight_plots.py +0 -887
- rocketpy-1.2.2/rocketpy/plots/fluid_plots.py +0 -37
- rocketpy-1.2.2/rocketpy/plots/hybrid_motor_plots.py +0 -187
- rocketpy-1.2.2/rocketpy/plots/liquid_motor_plots.py +0 -80
- rocketpy-1.2.2/rocketpy/plots/motor_plots.py +0 -552
- rocketpy-1.2.2/rocketpy/plots/rocket_plots.py +0 -583
- rocketpy-1.2.2/rocketpy/plots/solid_motor_plots.py +0 -184
- rocketpy-1.2.2/rocketpy/plots/tank_geometry_plots.py +0 -51
- rocketpy-1.2.2/rocketpy/plots/tank_plots.py +0 -104
- rocketpy-1.2.2/rocketpy/prints/__init__.py +0 -0
- rocketpy-1.2.2/rocketpy/prints/aero_surface_prints.py +0 -306
- rocketpy-1.2.2/rocketpy/prints/compare_prints.py +0 -3
- rocketpy-1.2.2/rocketpy/prints/controller_prints.py +0 -68
- rocketpy-1.2.2/rocketpy/prints/environment_analysis_prints.py +0 -187
- rocketpy-1.2.2/rocketpy/prints/environment_prints.py +0 -224
- rocketpy-1.2.2/rocketpy/prints/flight_prints.py +0 -474
- rocketpy-1.2.2/rocketpy/prints/fluid_prints.py +0 -37
- rocketpy-1.2.2/rocketpy/prints/hybrid_motor_prints.py +0 -138
- rocketpy-1.2.2/rocketpy/prints/liquid_motor_prints.py +0 -89
- rocketpy-1.2.2/rocketpy/prints/motor_prints.py +0 -69
- rocketpy-1.2.2/rocketpy/prints/parachute_prints.py +0 -75
- rocketpy-1.2.2/rocketpy/prints/rocket_prints.py +0 -197
- rocketpy-1.2.2/rocketpy/prints/solid_motor_prints.py +0 -121
- rocketpy-1.2.2/rocketpy/prints/tank_geometry_prints.py +0 -52
- rocketpy-1.2.2/rocketpy/prints/tank_prints.py +0 -36
- rocketpy-1.2.2/rocketpy/rocket/__init__.py +0 -14
- rocketpy-1.2.2/rocketpy/rocket/aero_surface.py +0 -2090
- rocketpy-1.2.2/rocketpy/rocket/components.py +0 -179
- rocketpy-1.2.2/rocketpy/rocket/parachute.py +0 -241
- rocketpy-1.2.2/rocketpy/rocket/rocket.py +0 -1475
- rocketpy-1.2.2/rocketpy/simulation/__init__.py +0 -2
- rocketpy-1.2.2/rocketpy/simulation/flight.py +0 -3639
- rocketpy-1.2.2/rocketpy/simulation/flight_data_importer.py +0 -392
- rocketpy-1.2.2/rocketpy/tools.py +0 -455
- rocketpy-1.2.2/rocketpy/units.py +0 -149
- rocketpy-1.2.2/rocketpy/utilities.py +0 -661
- rocketpy-1.2.2/rocketpy.egg-info/SOURCES.txt +0 -84
- rocketpy-1.2.2/rocketpy.egg-info/requires.txt +0 -28
- rocketpy-1.2.2/setup.py +0 -46
- rocketpy-1.2.2/tests/__init__.py +0 -0
- rocketpy-1.2.2/tests/conftest.py +0 -1315
- rocketpy-1.2.2/tests/test_environment.py +0 -267
- rocketpy-1.2.2/tests/test_environment_analysis.py +0 -217
- rocketpy-1.2.2/tests/test_flight.py +0 -829
- rocketpy-1.2.2/tests/test_flight_data_importer.py +0 -58
- rocketpy-1.2.2/tests/test_function.py +0 -497
- rocketpy-1.2.2/tests/test_genericmotor.py +0 -143
- rocketpy-1.2.2/tests/test_hybridmotor.py +0 -191
- rocketpy-1.2.2/tests/test_liquidmotor.py +0 -285
- rocketpy-1.2.2/tests/test_plots.py +0 -101
- rocketpy-1.2.2/tests/test_rocket.py +0 -282
- rocketpy-1.2.2/tests/test_solidmotor.py +0 -130
- rocketpy-1.2.2/tests/test_tank.py +0 -888
- rocketpy-1.2.2/tests/test_tools_matrix.py +0 -40
- rocketpy-1.2.2/tests/test_tools_vector.py +0 -17
- {rocketpy-1.2.2 → rocketpy-1.3.0}/LICENSE +0 -0
- {rocketpy-1.2.2 → rocketpy-1.3.0}/README.md +0 -0
- {rocketpy-1.2.2 → rocketpy-1.3.0}/rocketpy.egg-info/dependency_links.txt +0 -0
- {rocketpy-1.2.2 → rocketpy-1.3.0}/setup.cfg +0 -0
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rocketpy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Advanced 6-DOF trajectory simulation for High-Power Rocketry.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Giovani Hidalgo Ceotto <ghceotto@gmail.com>
|
|
6
|
+
Project-URL: homepage, https://rocketpy.org/
|
|
7
|
+
Project-URL: documentation, https://docs.rocketpy.org/
|
|
8
|
+
Project-URL: repository, https://github.com/RocketPy-Team/RocketPy
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Requires-Python: >=3.8
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
15
|
+
Provides-Extra: tests
|
|
16
|
+
Requires-Dist: pytest; extra == "tests"
|
|
17
|
+
Requires-Dist: pytest-coverage; extra == "tests"
|
|
18
|
+
Requires-Dist: black[jupyter]; extra == "tests"
|
|
19
|
+
Requires-Dist: flake8-black; extra == "tests"
|
|
20
|
+
Requires-Dist: flake8-pyproject; extra == "tests"
|
|
21
|
+
Requires-Dist: pandas; extra == "tests"
|
|
22
|
+
Requires-Dist: numericalunits==1.25; extra == "tests"
|
|
23
|
+
Requires-Dist: pylint; extra == "tests"
|
|
24
|
+
Requires-Dist: isort; extra == "tests"
|
|
22
25
|
Provides-Extra: env-analysis
|
|
23
|
-
Requires-Dist: timezonefinder; extra == "env-analysis"
|
|
24
26
|
Requires-Dist: windrose>=1.6.8; extra == "env-analysis"
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist: ipywidgets>=7.6.3; extra == "env-analysis"
|
|
27
|
+
Requires-Dist: timezonefinder; extra == "env-analysis"
|
|
27
28
|
Requires-Dist: jsonpickle; extra == "env-analysis"
|
|
29
|
+
Requires-Dist: ipython; extra == "env-analysis"
|
|
30
|
+
Requires-Dist: ipywidgets>=7.6.3; extra == "env-analysis"
|
|
31
|
+
Provides-Extra: monte-carlo
|
|
32
|
+
Requires-Dist: imageio; extra == "monte-carlo"
|
|
28
33
|
Provides-Extra: all
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: matplotlib>=3.0; extra == "all"
|
|
32
|
-
Requires-Dist: netCDF4>=1.6.4; extra == "all"
|
|
33
|
-
Requires-Dist: requests; extra == "all"
|
|
34
|
-
Requires-Dist: pytz; extra == "all"
|
|
35
|
-
Requires-Dist: simplekml; extra == "all"
|
|
36
|
-
Requires-Dist: timezonefinder; extra == "all"
|
|
37
|
-
Requires-Dist: windrose>=1.6.8; extra == "all"
|
|
38
|
-
Requires-Dist: IPython; extra == "all"
|
|
39
|
-
Requires-Dist: ipywidgets>=7.6.3; extra == "all"
|
|
40
|
-
Requires-Dist: jsonpickle; extra == "all"
|
|
34
|
+
Requires-Dist: rocketpy[env-analysis]; extra == "all"
|
|
35
|
+
Requires-Dist: rocketpy[monte-carlo]; extra == "all"
|
|
41
36
|
|
|
42
37
|
<picture>
|
|
43
38
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/static/RocketPy_Logo_white.png">
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "rocketpy"
|
|
3
|
+
version = "1.3.0"
|
|
4
|
+
description="Advanced 6-DOF trajectory simulation for High-Power Rocketry."
|
|
5
|
+
dynamic = ["dependencies"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.8"
|
|
8
|
+
authors = [
|
|
9
|
+
{name = "Giovani Hidalgo Ceotto", email = "ghceotto@gmail.com"}
|
|
10
|
+
]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
homepage = "https://rocketpy.org/"
|
|
19
|
+
documentation = "https://docs.rocketpy.org/"
|
|
20
|
+
repository = "https://github.com/RocketPy-Team/RocketPy"
|
|
21
|
+
|
|
22
|
+
[build-system]
|
|
23
|
+
requires = ["setuptools"]
|
|
24
|
+
build-backend = "setuptools.build_meta"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools]
|
|
27
|
+
py-modules = ['rocketpy']
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.dynamic]
|
|
30
|
+
dependencies = { file = ["requirements.txt"] }
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
tests = [
|
|
34
|
+
"pytest",
|
|
35
|
+
"pytest-coverage",
|
|
36
|
+
"black[jupyter]",
|
|
37
|
+
"flake8-black",
|
|
38
|
+
"flake8-pyproject",
|
|
39
|
+
"pandas",
|
|
40
|
+
"numericalunits==1.25",
|
|
41
|
+
"pylint",
|
|
42
|
+
"isort"
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
env-analysis = [
|
|
46
|
+
"windrose>=1.6.8",
|
|
47
|
+
"timezonefinder",
|
|
48
|
+
"jsonpickle",
|
|
49
|
+
"ipython",
|
|
50
|
+
"ipywidgets>=7.6.3"
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
monte-carlo = [
|
|
54
|
+
"imageio",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
all = ["rocketpy[env-analysis]", "rocketpy[monte-carlo]"]
|
|
58
|
+
|
|
59
|
+
[tool.black]
|
|
60
|
+
line-length = 88
|
|
61
|
+
include = '\.py$|\.ipynb$'
|
|
62
|
+
skip-string-normalization = true
|
|
63
|
+
|
|
64
|
+
[tool.coverage.report]
|
|
65
|
+
# Regexes for lines to exclude from consideration
|
|
66
|
+
exclude_also = [
|
|
67
|
+
#Don't complain about exceptions or warnings not being covered by tests
|
|
68
|
+
"warnings.warn*"
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.flake8]
|
|
72
|
+
max-line-length = 88
|
|
73
|
+
max-module-lines = 3000
|
|
74
|
+
ignore = ['E203', 'W503']
|
|
75
|
+
exclude = [
|
|
76
|
+
'.git,__pycache__',
|
|
77
|
+
]
|
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rocketpy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Advanced 6-DOF trajectory simulation for High-Power Rocketry.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Giovani Hidalgo Ceotto <ghceotto@gmail.com>
|
|
6
|
+
Project-URL: homepage, https://rocketpy.org/
|
|
7
|
+
Project-URL: documentation, https://docs.rocketpy.org/
|
|
8
|
+
Project-URL: repository, https://github.com/RocketPy-Team/RocketPy
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Requires-Python: >=3.8
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
15
|
+
Provides-Extra: tests
|
|
16
|
+
Requires-Dist: pytest; extra == "tests"
|
|
17
|
+
Requires-Dist: pytest-coverage; extra == "tests"
|
|
18
|
+
Requires-Dist: black[jupyter]; extra == "tests"
|
|
19
|
+
Requires-Dist: flake8-black; extra == "tests"
|
|
20
|
+
Requires-Dist: flake8-pyproject; extra == "tests"
|
|
21
|
+
Requires-Dist: pandas; extra == "tests"
|
|
22
|
+
Requires-Dist: numericalunits==1.25; extra == "tests"
|
|
23
|
+
Requires-Dist: pylint; extra == "tests"
|
|
24
|
+
Requires-Dist: isort; extra == "tests"
|
|
22
25
|
Provides-Extra: env-analysis
|
|
23
|
-
Requires-Dist: timezonefinder; extra == "env-analysis"
|
|
24
26
|
Requires-Dist: windrose>=1.6.8; extra == "env-analysis"
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist: ipywidgets>=7.6.3; extra == "env-analysis"
|
|
27
|
+
Requires-Dist: timezonefinder; extra == "env-analysis"
|
|
27
28
|
Requires-Dist: jsonpickle; extra == "env-analysis"
|
|
29
|
+
Requires-Dist: ipython; extra == "env-analysis"
|
|
30
|
+
Requires-Dist: ipywidgets>=7.6.3; extra == "env-analysis"
|
|
31
|
+
Provides-Extra: monte-carlo
|
|
32
|
+
Requires-Dist: imageio; extra == "monte-carlo"
|
|
28
33
|
Provides-Extra: all
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: matplotlib>=3.0; extra == "all"
|
|
32
|
-
Requires-Dist: netCDF4>=1.6.4; extra == "all"
|
|
33
|
-
Requires-Dist: requests; extra == "all"
|
|
34
|
-
Requires-Dist: pytz; extra == "all"
|
|
35
|
-
Requires-Dist: simplekml; extra == "all"
|
|
36
|
-
Requires-Dist: timezonefinder; extra == "all"
|
|
37
|
-
Requires-Dist: windrose>=1.6.8; extra == "all"
|
|
38
|
-
Requires-Dist: IPython; extra == "all"
|
|
39
|
-
Requires-Dist: ipywidgets>=7.6.3; extra == "all"
|
|
40
|
-
Requires-Dist: jsonpickle; extra == "all"
|
|
34
|
+
Requires-Dist: rocketpy[env-analysis]; extra == "all"
|
|
35
|
+
Requires-Dist: rocketpy[monte-carlo]; extra == "all"
|
|
41
36
|
|
|
42
37
|
<picture>
|
|
43
38
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RocketPy-Team/RocketPy/master/docs/static/RocketPy_Logo_white.png">
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
[all]
|
|
3
|
+
rocketpy[env-analysis]
|
|
4
|
+
rocketpy[monte-carlo]
|
|
5
|
+
|
|
6
|
+
[env-analysis]
|
|
7
|
+
windrose>=1.6.8
|
|
8
|
+
timezonefinder
|
|
9
|
+
jsonpickle
|
|
10
|
+
ipython
|
|
11
|
+
ipywidgets>=7.6.3
|
|
12
|
+
|
|
13
|
+
[monte-carlo]
|
|
14
|
+
imageio
|
|
15
|
+
|
|
16
|
+
[tests]
|
|
17
|
+
pytest
|
|
18
|
+
pytest-coverage
|
|
19
|
+
black[jupyter]
|
|
20
|
+
flake8-black
|
|
21
|
+
flake8-pyproject
|
|
22
|
+
pandas
|
|
23
|
+
numericalunits==1.25
|
|
24
|
+
pylint
|
|
25
|
+
isort
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from .control import _Controller
|
|
2
|
-
from .environment import Environment, EnvironmentAnalysis
|
|
3
|
-
from .mathutils import (
|
|
4
|
-
Function,
|
|
5
|
-
PiecewiseFunction,
|
|
6
|
-
funcify_method,
|
|
7
|
-
reset_funcified_methods,
|
|
8
|
-
)
|
|
9
|
-
from .motors import (
|
|
10
|
-
CylindricalTank,
|
|
11
|
-
EmptyMotor,
|
|
12
|
-
Fluid,
|
|
13
|
-
GenericMotor,
|
|
14
|
-
HybridMotor,
|
|
15
|
-
LevelBasedTank,
|
|
16
|
-
LiquidMotor,
|
|
17
|
-
MassBasedTank,
|
|
18
|
-
MassFlowRateBasedTank,
|
|
19
|
-
Motor,
|
|
20
|
-
SolidMotor,
|
|
21
|
-
SphericalTank,
|
|
22
|
-
Tank,
|
|
23
|
-
TankGeometry,
|
|
24
|
-
UllageBasedTank,
|
|
25
|
-
)
|
|
26
|
-
from .plots.compare import Compare, CompareFlights
|
|
27
|
-
from .rocket import (
|
|
28
|
-
AeroSurface,
|
|
29
|
-
AirBrakes,
|
|
30
|
-
Components,
|
|
31
|
-
EllipticalFins,
|
|
32
|
-
Fins,
|
|
33
|
-
NoseCone,
|
|
34
|
-
Parachute,
|
|
35
|
-
RailButtons,
|
|
36
|
-
Rocket,
|
|
37
|
-
Tail,
|
|
38
|
-
TrapezoidalFins,
|
|
39
|
-
)
|
|
40
|
-
from .simulation import Flight
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .controller import _Controller
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
from ..prints.controller_prints import _ControllerPrints
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class _Controller:
|
|
5
|
-
"""A class for storing and running controllers on a rocket. Controllers
|
|
6
|
-
have a controller function that is called at a specified sampling rate
|
|
7
|
-
during the simulation. The controller function can access and modify
|
|
8
|
-
the objects that are passed to it. The controller function also stores the
|
|
9
|
-
variables of interest in the objects that are passed to it."""
|
|
10
|
-
|
|
11
|
-
def __init__(
|
|
12
|
-
self,
|
|
13
|
-
interactive_objects,
|
|
14
|
-
controller_function,
|
|
15
|
-
sampling_rate,
|
|
16
|
-
initial_observed_variables=None,
|
|
17
|
-
name="Controller",
|
|
18
|
-
):
|
|
19
|
-
"""Initialize the class with the controller function and the objects to
|
|
20
|
-
be observed.
|
|
21
|
-
|
|
22
|
-
Parameters
|
|
23
|
-
----------
|
|
24
|
-
interactive_objects : list or object
|
|
25
|
-
A collection of objects that the controller function can access and
|
|
26
|
-
potentially modify. This can be either a list of objects or a single
|
|
27
|
-
object. The objects listed here are provided to the controller function
|
|
28
|
-
as the last argument, maintaining the order specified in this list if
|
|
29
|
-
it's a list. The controller function gains the ability to interact with
|
|
30
|
-
and make adjustments to these objects during its execution.
|
|
31
|
-
controller_function : function, callable
|
|
32
|
-
An user-defined function responsible for controlling the simulation.
|
|
33
|
-
This function is expected to take the following arguments, in order:
|
|
34
|
-
|
|
35
|
-
1. `time` (float): The current simulation time in seconds.
|
|
36
|
-
2. `sampling_rate` (float): The rate at which the controller
|
|
37
|
-
function is called, measured in Hertz (Hz).
|
|
38
|
-
3. `state` (list): The state vector of the simulation, structured as
|
|
39
|
-
`[x, y, z, vx, vy, vz, e0, e1, e2, e3, wx, wy, wz]`.
|
|
40
|
-
4. `state_history` (list): A record of the rocket's state at each
|
|
41
|
-
step throughout the simulation. The state_history is organized as
|
|
42
|
-
a list of lists, with each sublist containing a state vector. The
|
|
43
|
-
last item in the list always corresponds to the previous state
|
|
44
|
-
vector, providing a chronological sequence of the rocket's
|
|
45
|
-
evolving states.
|
|
46
|
-
5. `observed_variables` (list): A list containing the variables that
|
|
47
|
-
the controller function returns. The return of each controller
|
|
48
|
-
function call is appended to the observed_variables list. The
|
|
49
|
-
initial value in the first step of the simulation of this list is
|
|
50
|
-
provided by the `initial_observed_variables` argument.
|
|
51
|
-
6. `interactive_objects` (list): A list containing the objects that
|
|
52
|
-
the controller function can interact with. The objects are
|
|
53
|
-
listed in the same order as they are provided in the
|
|
54
|
-
`interactive_objects`.
|
|
55
|
-
|
|
56
|
-
This function will be called during the simulation at the specified
|
|
57
|
-
sampling rate. The function should evaluate and change the interactive
|
|
58
|
-
objects as needed. The function return statement can be used to save
|
|
59
|
-
relevant information in the `observed_variables` list.
|
|
60
|
-
|
|
61
|
-
.. note:: The function will be called according to the sampling rate
|
|
62
|
-
specified.
|
|
63
|
-
sampling_rate : float
|
|
64
|
-
The sampling rate of the controller function in Hertz (Hz). This
|
|
65
|
-
means that the controller function will be called every
|
|
66
|
-
`1/sampling_rate` seconds.
|
|
67
|
-
initial_observed_variables : list, optional
|
|
68
|
-
A list of the initial values of the variables that the controller
|
|
69
|
-
function returns. This list is used to initialize the
|
|
70
|
-
`observed_variables` argument of the controller function. The
|
|
71
|
-
default value is None, which initializes the list as an empty list.
|
|
72
|
-
name : str
|
|
73
|
-
The name of the controller. This will be used for printing and
|
|
74
|
-
plotting.
|
|
75
|
-
|
|
76
|
-
Returns
|
|
77
|
-
-------
|
|
78
|
-
None
|
|
79
|
-
"""
|
|
80
|
-
self.interactive_objects = interactive_objects
|
|
81
|
-
self.controller_function = controller_function
|
|
82
|
-
self.sampling_rate = sampling_rate
|
|
83
|
-
self.name = name
|
|
84
|
-
self.prints = _ControllerPrints(self)
|
|
85
|
-
|
|
86
|
-
if initial_observed_variables is not None:
|
|
87
|
-
self.observed_variables = [initial_observed_variables]
|
|
88
|
-
else:
|
|
89
|
-
self.observed_variables = []
|
|
90
|
-
|
|
91
|
-
def __call__(self, time, state_vector, state_history):
|
|
92
|
-
"""Call the controller function. This is used by the simulation class.
|
|
93
|
-
|
|
94
|
-
Parameters
|
|
95
|
-
----------
|
|
96
|
-
time : float
|
|
97
|
-
The time of the simulation in seconds.
|
|
98
|
-
state_vector : list
|
|
99
|
-
The state vector of the simulation, which is defined as:
|
|
100
|
-
|
|
101
|
-
`[x, y, z, vx, vy, vz, e0, e1, e2, e3, wx, wy, wz]`.
|
|
102
|
-
state_history : list
|
|
103
|
-
A list containing the state history of the simulation. The state
|
|
104
|
-
history is a list of every state vector of every step of the
|
|
105
|
-
simulation. The state history is a list of lists, where each
|
|
106
|
-
sublist is a state vector and is ordered from oldest to newest.
|
|
107
|
-
|
|
108
|
-
Returns
|
|
109
|
-
-------
|
|
110
|
-
None
|
|
111
|
-
"""
|
|
112
|
-
observed_variables = self.controller_function(
|
|
113
|
-
time,
|
|
114
|
-
self.sampling_rate,
|
|
115
|
-
state_vector,
|
|
116
|
-
state_history,
|
|
117
|
-
self.observed_variables,
|
|
118
|
-
self.interactive_objects,
|
|
119
|
-
)
|
|
120
|
-
if observed_variables is not None:
|
|
121
|
-
self.observed_variables.append(observed_variables)
|
|
122
|
-
|
|
123
|
-
def __str__(self):
|
|
124
|
-
return f"Controller '{self.name}' with sampling rate {self.sampling_rate} Hz."
|
|
125
|
-
|
|
126
|
-
def info(self):
|
|
127
|
-
"""Prints out summarized information about the controller."""
|
|
128
|
-
self.prints.all()
|
|
129
|
-
|
|
130
|
-
def all_info(self):
|
|
131
|
-
"""Prints out all information about the controller."""
|
|
132
|
-
self.info()
|