Skip to content

Commit

Permalink
Merge pull request #714 from RocketPy-Team/doc/new-comparison-plot
Browse files Browse the repository at this point in the history
DOC: new comparison plot
  • Loading branch information
Gui-FernandesBR authored Oct 30, 2024
2 parents 2b63cd9 + 13e66f6 commit 3958d28
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 25 deletions.
6 changes: 0 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@
"github_url": "https://github.com/RocketPy-Team/RocketPy",
"navbar_end": ["theme-switcher", "navbar-icon-links.html"],
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/RocketPy-Team/RocketPy/",
"icon": "fa-brands fa-square-github",
"type": "fontawesome",
},
{
"name": "LinkedIn",
"url": "https://www.linkedin.com/company/rocketpy/",
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/cavour_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Flight Simulation DATA"
"## Flight Simulation DATA"
]
},
{
Expand Down Expand Up @@ -375,7 +375,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Data analysis"
"## Data analysis"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/halcyon_flight_sim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Flight Simulation Data"
"## Flight Simulation Data"
]
},
{
Expand Down Expand Up @@ -503,7 +503,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Data analysis"
"## Data analysis"
]
},
{
Expand Down
67 changes: 62 additions & 5 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,71 @@
Flights simulated with RocketPy
===============================

Apart from the classical Calisto rocket, which is many times used as a
reference in the getting started tutorial, RocketPy also includes some very
interesting examples of real rockets.
RocketPy has been used to simulate many flights, from small amateur rockets to
large professional ones.
This section contains some of the most interesting
results obtained with RocketPy.
The following plot shows the comparison between the simulated and measured
apogee of some rockets.

If you want to see your rocket here, please contact the maintainers!
.. jupyter-execute::
:hide-code:

import matplotlib.pyplot as plt

results = {
# "Name (Year)": (simulated, measured) m
# - use 2 decimal places
# - sort by year and then by name
"Valetudo (2019)": (825.39, 860),
"Bella Lui (2020)": (460.50, 458.97),
"NDRT (2020)": (1296.77, 1316.75),
"Prometheus (2022)": (4190.05, 3898.37),
"Cavour (2023)": (2818.90, 2789),
"Juno III (2023)": (3026.05, 3213),
"Halcyon (2023)": (3212.775, 3450),
}

max_apogee = 4500

# Extract data
simulated = [sim for sim, meas in results.values()]
measured = [meas for sim, meas in results.values()]
labels = list(results.keys())

# Create the plot
fig, ax = plt.subplots(figsize=(9, 9))
ax.scatter(simulated, measured)
ax.grid(True, alpha=0.3)

# Add the x = y line
ax.plot([0, max_apogee], [0, max_apogee], linestyle='--', color='black', alpha=0.6)

# Add text labels
for i, label in enumerate(labels):
ax.text(simulated[i], measured[i], label, ha='center', va='bottom', fontsize=8)

# Set titles and labels
ax.set_title("Simulated x Measured Apogee")
ax.set_xlabel("Simulated Apogee (m)")
ax.set_ylabel("Measured Apogee (m)")

# Set aspect ratio to 1:1
ax.set_aspect('equal', adjustable='box')
ax.set_xlim(0, max_apogee)
ax.set_ylim(0, max_apogee)

plt.show()

In the next sections you will find the simulations of the rockets listed above.

.. note::

If you want to see your rocket here, please contact the maintainers! \
We would love to include your rocket in the examples.

.. toctree::
:maxdepth: 2
:maxdepth: 1
:caption: Contents:

bella_lui_flight_sim.ipynb
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/classes/sensors/abstract/sensor.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Sensor Class
------------

.. autoclass:: rocketpy.sensors.Barometer
.. autoclass:: rocketpy.sensors.Sensor
:members:
2 changes: 1 addition & 1 deletion docs/reference/classes/sensors/accelerometer.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Accelerometer Class
---------------
-------------------

.. autoclass:: rocketpy.sensors.Accelerometer
:members:
1 change: 1 addition & 0 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This reference manual details functions, modules, methods and attributes include
classes/Components
classes/Rocket
classes/Parachute
classes/sensors/index.rst
classes/Flight
Utilities <classes/utils/index>
classes/EnvironmentAnalysis
Expand Down
2 changes: 1 addition & 1 deletion docs/user/rocket/generic_surface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ rocket's configuration:
rocket.add_surfaces(generic_surface, position=(0,0,0))
The position of the generic surface is defined in the User Defined coordinate
System, see :ref:`rocketaxes` for more information.
System, see :ref:`rocket_axes` for more information.

.. tip::
If defining the coefficients of the entire rocket is desired, only a single
Expand Down
6 changes: 3 additions & 3 deletions rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ def add_cm_eccentricity(self, x, y):
See Also
--------
:ref:`rocketaxes`
:ref:`rocket_axes`
Notes
-----
Expand Down Expand Up @@ -1777,7 +1777,7 @@ def add_cp_eccentricity(self, x, y):
See Also
--------
:ref:`rocketaxes`
:ref:`rocket_axes`
"""
self.cp_eccentricity_x = x
self.cp_eccentricity_y = y
Expand Down Expand Up @@ -1807,7 +1807,7 @@ def add_thrust_eccentricity(self, x, y):
See Also
--------
:ref:`rocketaxes`
:ref:`rocket_axes`
"""
self.thrust_eccentricity_y = x
self.thrust_eccentricity_x = y
Expand Down
5 changes: 4 additions & 1 deletion rocketpy/sensors/accelerometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def __init__(
Sample rate of the sensor in Hz.
orientation : tuple, list, optional
Orientation of the sensor in the rocket. The orientation can be
given as:
given as either:
- A list of length 3, where the elements are the Euler angles for
the rotation yaw (ψ), pitch (θ) and roll (φ) in radians. The
standard rotation sequence is z-y-x (3-2-1) is used, meaning the
Expand All @@ -99,6 +100,7 @@ def __init__(
of reference is defined as to have z axis along the sensor's normal
vector pointing upwards, x and y axes perpendicular to the z axis
and each other.
The rocket frame of reference is defined as to have z axis
along the rocket's axis of symmetry pointing upwards, x and y axes
perpendicular to the z axis and each other. A rotation around the x
Expand Down Expand Up @@ -204,6 +206,7 @@ def measure(self, time, **kwargs):
Current time in seconds.
kwargs : dict
Keyword arguments dictionary containing the following keys:
- u : np.array
State vector of the rocket.
- u_dot : np.array
Expand Down
1 change: 1 addition & 0 deletions rocketpy/sensors/barometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def measure(self, time, **kwargs):
Current time in seconds.
kwargs : dict
Keyword arguments dictionary containing the following keys:
- u : np.array
State vector of the rocket.
- u_dot : np.array
Expand Down
1 change: 1 addition & 0 deletions rocketpy/sensors/gnss_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def measure(self, time, **kwargs):
Current time in seconds.
kwargs : dict
Keyword arguments dictionary containing the following keys:
- u : np.array
State vector of the rocket.
- u_dot : np.array
Expand Down
3 changes: 3 additions & 0 deletions rocketpy/sensors/gyroscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(
orientation : tuple, list, optional
Orientation of the sensor in the rocket. The orientation can be
given as:
- A list of length 3, where the elements are the Euler angles for
the rotation yaw (ψ), pitch (θ) and roll (φ) in radians. The
standard rotation sequence is z-y-x (3-2-1) is used, meaning the
Expand All @@ -99,6 +100,7 @@ def __init__(
of reference is defined as to have z axis along the sensor's normal
vector pointing upwards, x and y axes perpendicular to the z axis
and each other.
The rocket frame of reference is defined as to have z axis
along the rocket's axis of symmetry pointing upwards, x and y axes
perpendicular to the z axis and each other. Default is (0, 0, 0),
Expand Down Expand Up @@ -206,6 +208,7 @@ def measure(self, time, **kwargs):
Current time in seconds.
kwargs : dict
Keyword arguments dictionary containing the following keys:
- u : np.array
State vector of the rocket.
- u_dot : np.array
Expand Down
7 changes: 4 additions & 3 deletions rocketpy/sensors/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,13 @@ def __init__(
Sample rate of the sensor
orientation : tuple, list, optional
Orientation of the sensor in relation to the rocket frame of
reference (Body Axes Coordinate System). See :ref:'rocket_axes' for
reference (Body Axes Coordinate System). See :ref:`rocket_axes` for
more information.
If orientation is not given, the sensor axes will be aligned with
the rocket axis.
The orientation can be given as:
- A list or tuple of length 3, where the elements are the intrisic
The orientation can be given as either:
- A list or tuple of length 3, where the elements are the intrinsic
rotation angles in radians. The rotation sequence z-x-z (3-1-3) is
used, meaning the sensor is first around the z axis (roll), then
around the new x axis (pitch) and finally around the new z axis
Expand Down

0 comments on commit 3958d28

Please sign in to comment.