-
-
Notifications
You must be signed in to change notification settings - Fork 215
ENH: Implementing 3-dof-simulation #745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Gui-FernandesBR
merged 66 commits into
RocketPy-Team:develop
from
aZira371:enh/3-dof-simulation
Nov 27, 2025
Merged
Changes from 11 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
e557e17
DRAFT: for ENH/3-dof-simulation (See #655)
aZira371 a768648
ENH/3-dof-simulation (See RocketPy-Team#655)
aZira371 9b00c57
MNT: cleaned up new functions and
aZira371 87e9180
Rebase: Merge branch 'develop' of https://github.com/aZira371/RocketP…
aZira371 4524219
ENH: Addition of point mass classes to rocketpy.rocket and rocketpy.m…
aZira371 57b4732
ENH: PointMassMotor and PointMassRocket working as intended after som…
aZira371 81ce869
MNT: Removing unnecessary files added by mistake.
aZira371 0673076
Merge branch 'RocketPy-Team:master' into enh/3-dof-simulation
aZira371 47c9f2f
MNT: Cleaned up PointMassMotor and PointMassRocket class
aZira371 f6ad658
Merge branch 'enh/3-dof-simulation' of https://github.com/aZira371/Ro…
aZira371 33cb63a
MNT: Cleaning up flight class and PointMassMotor class
aZira371 1d2d4dc
Merge branch 'enh/3-dof-simulation' into develop
aZira371 fe21271
Merge pull request #1 from aZira371/develop
aZira371 b18b241
MNT: point mass motor cleanup
aZira371 8aa1016
ENH: restructuring rocket class
aZira371 87e7dce
MNT: fixing certain calculations on point mass motor
aZira371 0e4d8a4
Rename PointMassMotor.py to pointmassmotor.py
aZira371 41e94f1
Merge branch 'develop' into enh/3-dof-simulation
aZira371 e299a30
MNT: updates to 3dof example
aZira371 d4dc989
MNT: lint cleanup and adding 3dof to init
aZira371 c8096c5
MNT: Point mass motor and rocket fixes
aZira371 724f9dd
MNT: flight class fix on simulation mode detection
aZira371 f1e0fb0
MNT: make format changes
aZira371 4b9b952
MNT: point mass motor cleanup
aZira371 45380fd
ENH: restructuring rocket class
aZira371 5cd1535
MNT: fixing certain calculations on point mass motor
aZira371 1e590c2
Rename PointMassMotor.py to pointmassmotor.py
aZira371 981dda5
ENH: _MotorPrints inheritance - issue #460 (#828)
Gui-FernandesBR 5c75298
MNT: fix deprecations and warnings (#829)
Gui-FernandesBR 70f24ee
DEV: streamline caching of Python dependencies in GitHub Actions
Gui-FernandesBR 0cb0994
ENH: Add the Coriolis Force to the Flight class (#799)
kevin-alcaniz 58f8b0d
MNT: deprecated decorator (#830)
Gui-FernandesBR 191744f
MNT: updates to 3dof example
aZira371 265dd93
MNT: lint cleanup and adding 3dof to init
aZira371 5aa2027
MNT: Point mass motor and rocket fixes
aZira371 464212d
MNT: flight class fix on simulation mode detection
aZira371 a1b1d1f
MNT: make format changes
aZira371 d9cbde5
Merge branch 'enh/3-dof-simulation' of https://github.com/aZira371/Ro…
aZira371 0aa32b5
Merge branch 'develop' into enh/3-dof-simulation
aZira371 c5152fa
MNT: rocket.py removed pointmassrocket inertia
aZira371 a097ea0
MNT: flight.py review updates
aZira371 d612fa3
MNT: flight.py sanitization
aZira371 5b6d7e5
Merge branch 'develop' into enh/3-dof-simulation
aZira371 5a47616
MNT: make format and renaming 3 dof example
aZira371 14c81f0
MNT: Update flight.py to remove duplicate line
aZira371 809ed84
MNT: correcting indentation in flight.py
aZira371 8c4f4c2
Merge branch 'enh/3-dof-simulation' of https://github.com/aZira371/Ro…
aZira371 497e6a2
MNT: docstring for pointmassrocket in rocket.py
aZira371 535104b
MNT: removing property from rocket.py poitmassrocket
aZira371 c214850
Merge branch 'develop' into enh/3-dof-simulation
Gui-FernandesBR f047a45
Merge branch 'develop' into enh/3-dof-simulation
aZira371 b624ccc
ENH: first version of tests for 3dof rocketpy
aZira371 9540a68
adds docs
Gui-FernandesBR 699236e
Refactor PointMassRocket class into its own module for improved organ…
Gui-FernandesBR ae7d4b0
refactored tests
Gui-FernandesBR 22797a3
Merge branch 'develop' into enh/3-dof-simulation
Gui-FernandesBR 9516f43
fix test
Gui-FernandesBR 9619aab
remove example notebook
Gui-FernandesBR fdb6f7c
type hint fix
Gui-FernandesBR f4886e2
Configure matplotlib to use non-interactive backend for tests
Gui-FernandesBR 015579a
fix tests
Gui-FernandesBR 5ec0c8d
solve comments by copilot
Gui-FernandesBR bcf51fe
small fix
Gui-FernandesBR ba73174
Merge branch 'develop' into enh/3-dof-simulation
Gui-FernandesBR 2e454c4
DOC: Update test docstrings to follow RocketPy NumPy style guidelines
Copilot 567b9e0
Merge branch 'develop' into enh/3-dof-simulation
aZira371 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,8 @@ | |
| Parachute, | ||
| RailButtons, | ||
| Rocket, | ||
| BaseRocket, | ||
| PointMassRocket, | ||
| Tail, | ||
| TrapezoidalFins, | ||
| ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| from functools import cached_property | ||
| import numpy as np | ||
| from ..mathutils.function import Function, funcify_method | ||
| from .motor import Motor | ||
|
|
||
| class PointMassMotor(Motor): | ||
| """Class representing a motor modeled as a point mass. | ||
| Inherits from the Motor class and simplifies the model to a thrust-producing | ||
| object without detailed structural components.""" | ||
|
|
||
| def __init__( | ||
| self, | ||
| thrust_source, | ||
| dry_mass, | ||
| thrust_curve=None, | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| propellant_initial_mass=None, | ||
| propellant_final_mass=None, | ||
| burn_time=None, | ||
| center_of_dry_mass_position=0, | ||
| reshape_thrust_curve=False, | ||
| interpolation_method="linear", | ||
| coordinate_system_orientation="nozzle_to_combustion_chamber", | ||
| ): | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """Initialize the PointMassMotor class. | ||
| Parameters | ||
| ---------- | ||
| thrust_source : int, float, callable, string, array, Function | ||
| Thrust source similar to the Motor class. | ||
| dry_mass : float | ||
| Total dry mass of the motor in kg. | ||
| thrust_curve : Function, np.array, or str (csv file), optional | ||
| Required if thrust_source is a csv file, Function, or np.array. | ||
| propellant_initial_mass : float, optional | ||
| Required if thrust_source is a csv file, Function, or np.array. | ||
| propellant_final_mass : float, optional | ||
| Required if thrust_source is callable. | ||
| burn_time : float or tuple of float, optional | ||
| Required if thrust_source is callable or if a thrust value is given. | ||
| center_of_dry_mass_position : float, optional | ||
| Initial position of the motor, default is 0. | ||
| interpolation_method : string, optional | ||
| Interpolation method for thrust curve, default is 'linear'. | ||
| """ | ||
| if isinstance(thrust_source, (Function, np.ndarray, str)): | ||
| if thrust_curve is None or propellant_initial_mass is None: | ||
| raise ValueError("thrust_curve and propellant_initial_mass are required for csv, Function, or np.array inputs.") | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| elif callable(thrust_source): | ||
| if any(param is None for param in [thrust_curve, propellant_initial_mass, burn_time, propellant_final_mass]): | ||
| raise ValueError("thrust_curve, propellant_initial_mass, burn_time, and propellant_final_mass are required for callable inputs.") | ||
| elif isinstance(thrust_source, (int, float)): | ||
| if any(param is None for param in [thrust_curve, propellant_initial_mass, burn_time]): | ||
| raise ValueError("thrust_curve, propellant_initial_mass, and burn_time are required when a thrust value is given.") | ||
|
|
||
| self._propellant_initial_mass = propellant_initial_mass | ||
| super().__init__( | ||
| thrust_source=thrust_source, | ||
| dry_inertia=(0, 0, 0), | ||
| nozzle_radius=0, | ||
| center_of_dry_mass_position=center_of_dry_mass_position, | ||
| dry_mass=dry_mass, | ||
| nozzle_position=0, | ||
| burn_time=burn_time, | ||
| reshape_thrust_curve=reshape_thrust_curve, | ||
| interpolation_method=interpolation_method, | ||
| coordinate_system_orientation=coordinate_system_orientation, | ||
| ) | ||
| @funcify_method("Time (s)", "Thrust (N)") | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| def thrust(self): | ||
| """Returns the thrust of the motor as a function of time.""" | ||
| return self.thrust_source | ||
|
|
||
| @funcify_method("Time (s)", "Acceleration (m/s^2)") | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| def total_mass(self): | ||
| """Returns the constant total mass of the point mass motor.""" | ||
| return self.dry_mass | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @funcify_method("Time (s)", "Acceleration (m/s^2)") | ||
| def acceleration(self): | ||
| """Computes the acceleration of the motor as thrust divided by mass.""" | ||
| return self.thrust() / self.total_mass | ||
|
|
||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| @funcify_method("Time (s)", "Propellant Mass (kg)") | ||
| def center_of_propellant_mass(self): | ||
| return 0 | ||
|
|
||
| @funcify_method("Time (s)", "Exhaust Velocity (m/s)") | ||
| def exhaust_velocity(self): | ||
| return 2000 # m/s, estimated value | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @funcify_method("Time (s)", "Propellant Mass (kg)") | ||
| def propellant_initial_mass(self): | ||
| return self._propellant_initial_mass | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @property | ||
| def is_point_mass(self): | ||
aZira371 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return True | ||
|
|
||
| @funcify_method("Time (s)", "Inertia (kg·m²)") | ||
| def propellant_I_11(self): | ||
| return 0 | ||
|
|
||
| @funcify_method("Time (s)", "Inertia (kg·m²)") | ||
| def propellant_I_12(self): | ||
| return 0 | ||
|
|
||
| @funcify_method("Time (s)", "Inertia (kg·m²)") | ||
| def propellant_I_13(self): | ||
| return 0 | ||
|
|
||
| @funcify_method("Time (s)", "Inertia (kg·m²)") | ||
| def propellant_I_22(self): | ||
| return 0 | ||
|
|
||
| @funcify_method("Time (s)", "Inertia (kg·m²)") | ||
| def propellant_I_23(self): | ||
| return 0 | ||
|
|
||
| @funcify_method("Time (s)", "Inertia (kg·m²)") | ||
| def propellant_I_33(self): | ||
| return 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gui-FernandesBR marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.