From 45c758bbde9993f5bf233f33bc9acfccef99fafe Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sat, 19 Oct 2024 16:35:35 -0300 Subject: [PATCH 1/2] DOC: adds new apogee comparison plot --- docs/examples/index.rst | 67 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/docs/examples/index.rst b/docs/examples/index.rst index 5d976a377..64c672a95 100644 --- a/docs/examples/index.rst +++ b/docs/examples/index.rst @@ -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 From 13e66f6f6c74529332bcc2d9b396f418f98cab8d Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sat, 19 Oct 2024 16:36:24 -0300 Subject: [PATCH 2/2] DOC: fix minor documentation issues --- docs/conf.py | 6 ------ docs/examples/cavour_flight_sim.ipynb | 4 ++-- docs/examples/halcyon_flight_sim.ipynb | 4 ++-- docs/reference/classes/sensors/abstract/sensor.rst | 2 +- docs/reference/classes/sensors/accelerometer.rst | 2 +- docs/reference/index.rst | 1 + docs/user/rocket/generic_surface.rst | 2 +- rocketpy/rocket/rocket.py | 6 +++--- rocketpy/sensors/accelerometer.py | 5 ++++- rocketpy/sensors/barometer.py | 1 + rocketpy/sensors/gnss_receiver.py | 1 + rocketpy/sensors/gyroscope.py | 3 +++ rocketpy/sensors/sensor.py | 7 ++++--- 13 files changed, 24 insertions(+), 20 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c5fbf4fad..fbe3f9d69 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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/", diff --git a/docs/examples/cavour_flight_sim.ipynb b/docs/examples/cavour_flight_sim.ipynb index bf19b4c00..e3940224f 100644 --- a/docs/examples/cavour_flight_sim.ipynb +++ b/docs/examples/cavour_flight_sim.ipynb @@ -320,7 +320,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Flight Simulation DATA" + "## Flight Simulation DATA" ] }, { @@ -375,7 +375,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Data analysis" + "## Data analysis" ] }, { diff --git a/docs/examples/halcyon_flight_sim.ipynb b/docs/examples/halcyon_flight_sim.ipynb index d7b627602..b7d814f7b 100644 --- a/docs/examples/halcyon_flight_sim.ipynb +++ b/docs/examples/halcyon_flight_sim.ipynb @@ -448,7 +448,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Flight Simulation Data" + "## Flight Simulation Data" ] }, { @@ -503,7 +503,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Data analysis" + "## Data analysis" ] }, { diff --git a/docs/reference/classes/sensors/abstract/sensor.rst b/docs/reference/classes/sensors/abstract/sensor.rst index 188744f98..867d979c8 100644 --- a/docs/reference/classes/sensors/abstract/sensor.rst +++ b/docs/reference/classes/sensors/abstract/sensor.rst @@ -1,5 +1,5 @@ Sensor Class ------------ -.. autoclass:: rocketpy.sensors.Barometer +.. autoclass:: rocketpy.sensors.Sensor :members: diff --git a/docs/reference/classes/sensors/accelerometer.rst b/docs/reference/classes/sensors/accelerometer.rst index 0eac1e4c0..03d9012b4 100644 --- a/docs/reference/classes/sensors/accelerometer.rst +++ b/docs/reference/classes/sensors/accelerometer.rst @@ -1,5 +1,5 @@ Accelerometer Class ---------------- +------------------- .. autoclass:: rocketpy.sensors.Accelerometer :members: diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 22187252f..c0868c0c5 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -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/EnvironmentAnalysis diff --git a/docs/user/rocket/generic_surface.rst b/docs/user/rocket/generic_surface.rst index f6568758e..f2e166148 100644 --- a/docs/user/rocket/generic_surface.rst +++ b/docs/user/rocket/generic_surface.rst @@ -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 diff --git a/rocketpy/rocket/rocket.py b/rocketpy/rocket/rocket.py index 61de81f27..758447fde 100644 --- a/rocketpy/rocket/rocket.py +++ b/rocketpy/rocket/rocket.py @@ -1739,7 +1739,7 @@ def add_cm_eccentricity(self, x, y): See Also -------- - :ref:`rocketaxes` + :ref:`rocket_axes` Notes ----- @@ -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 @@ -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 diff --git a/rocketpy/sensors/accelerometer.py b/rocketpy/sensors/accelerometer.py index 607b1632e..935f4e3cf 100644 --- a/rocketpy/sensors/accelerometer.py +++ b/rocketpy/sensors/accelerometer.py @@ -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 @@ -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 @@ -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 diff --git a/rocketpy/sensors/barometer.py b/rocketpy/sensors/barometer.py index 9e6fceb16..bf5b538e2 100644 --- a/rocketpy/sensors/barometer.py +++ b/rocketpy/sensors/barometer.py @@ -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 diff --git a/rocketpy/sensors/gnss_receiver.py b/rocketpy/sensors/gnss_receiver.py index 9502bd918..686cd29e5 100644 --- a/rocketpy/sensors/gnss_receiver.py +++ b/rocketpy/sensors/gnss_receiver.py @@ -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 diff --git a/rocketpy/sensors/gyroscope.py b/rocketpy/sensors/gyroscope.py index eb1337a73..cafac1cdc 100644 --- a/rocketpy/sensors/gyroscope.py +++ b/rocketpy/sensors/gyroscope.py @@ -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 @@ -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), @@ -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 diff --git a/rocketpy/sensors/sensor.py b/rocketpy/sensors/sensor.py index 3db574016..4890540dc 100644 --- a/rocketpy/sensors/sensor.py +++ b/rocketpy/sensors/sensor.py @@ -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