8000 ENH: Implementing 3-dof-simulation by aZira371 · Pull Request #745 · RocketPy-Team/RocketPy · GitHub
[go: up one dir, main page]

Skip to content

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

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e557e17
DRAFT: for ENH/3-dof-simulation (See #655)
aZira371 Dec 3, 2024
a768648
ENH/3-dof-simulation (See RocketPy-Team#655)
aZira371 Dec 6, 2024
9b00c57
MNT: cleaned up new functions and
aZira371 Dec 6, 2024
87e9180
Rebase: Merge branch 'develop' of https://github.com/aZira371/RocketP… 8000
aZira371 Feb 25, 2025
4524219
ENH: Addition of point mass classes to rocketpy.rocket and rocketpy.m…
aZira371 Feb 25, 2025
57b4732
ENH: PointMassMotor and PointMassRocket working as intended after som…
aZira371 Apr 11, 2025
81ce869
MNT: Removing unnecessary files added by mistake.
aZira371 Apr 11, 2025
0673076
Merge branch 'RocketPy-Team:master' into enh/3-dof-simulation
aZira371 Apr 24, 2025
47c9f2f
MNT: Cleaned up PointMassMotor and PointMassRocket class
aZira371 May 10, 2025
f6ad658
Merge branch 'enh/3-dof-simulation' of https://github.com/aZira371/Ro…
aZira371 May 10, 2025
33cb63a
MNT: Cleaning up flight class and PointMassMotor class
aZira371 May 10, 2025
1d2d4dc
Merge branch 'enh/3-dof-simulation' into develop
aZira371 Jun 10, 2025
fe21271
Merge pull request #1 from aZira371/develop
aZira371 Jun 10, 2025
b18b241
MNT: point mass motor cleanup
aZira371 Jun 26, 2025
8aa1016
ENH: restructuring rocket class
aZira371 Jun 30, 2025
87e7dce
MNT: fixing certain calculations on point mass motor
aZira371 Jul 11, 2025
0e4d8a4
Rename PointMassMotor.py to pointmassmotor.py
aZira371 Jul 11, 2025
41e94f1
Merge branch 'develop' into enh/3-dof-simulation
aZira371 Jul 11, 2025
e299a30
MNT: updates to 3dof example
aZira371 Jul 11, 2025
d4dc989
MNT: lint cleanup and adding 3dof to init
aZira371 Jul 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rebase: Merge branch 'develop' of https://github.com/aZira371/RocketPy
…into enh/3-dof-simulation
  • Loading branch information
aZira371 committed Feb 25, 2025
commit 87e918003af304cf6d981cacaca43cf3d72212c5
31 changes: 14 additions & 17 deletions rocketpy/simulation/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@
name="Flight",
equations_of_motion="standard",
simulation_mode="6 DOF",
ode_solver="LSODA",
):
"""Run a trajectory simulation.

Expand Down Expand Up @@ -593,19 +594,16 @@
more restricted set of equations of motion that only works for
solid propulsion rockets. Such equations were used in RocketPy v0
and are kept here for backwards compatibility.
simulation_mode : str, optional
Type of equations of motion to use. Can be "3 DOF" or
"6 DOF". Default is "6 DOF". 3 DOF is a restricted set of equations
of motion that only solves the 3 translational degree of freedom.
The system is assumed to be a point-mass system located at the
center of mass. Currently, the aerodynamic forces are solved at
the specified location but translated to the center of mass without
adding the transferring moments. Additionally, neither
the angular components such as omegas aren't evaluated as well
nor like moment of inertias are not taken into account. The
structure of functions for 3 DOF is kept very similar to
the original 6 DOF model for identifying missing components
and easy read.
ode_solver : str, ``scipy.integrate.OdeSolver``, optional
Integration method to use to solve the equations of motion ODE.
Available options are: 'RK23', 'RK45', 'DOP853', 'Radau', 'BDF',
'LSODA' from ``scipy.integrate.solve_ivp``.
Default is 'LSODA', which is recommended for most flights.
A custom ``scipy.integrate.OdeSolver`` can be passed as well.
For more information on the integration methods, see the scipy
documentation [1]_.


Returns
-------
None
Expand Down Expand Up @@ -634,6 +632,7 @@
self.name = name
self.equations_of_motion = equations_of_motion
self.simulation_mode = simulation_mode
self.ode_solver = ode_solver

# Controller initialization
self.__init_controllers()
Expand Down Expand Up @@ -1431,10 +1430,8 @@
"""
# Hey! We will finish this function later, now we just can use u_dot
return self.u_dot_generalized(t, u, post_processing=post_processing)

def u_dot_3dof(
self, t, u, post_processing=False
): # pylint: disable=too-many-locals,too-many-statements

def u_dot(self, t, u, post_processing=False): # pylint: disable=too-many-locals,too-many-statements
"""Calculates derivative of u state vector with respect to time
when rocket is flying in 6 DOF motion during ascent out of rail
and descent without parachute.
Expand All @@ -1461,7 +1458,7 @@
_, _, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3 = u
# Determine lift force and moment
omega1, omega2, omega3 = 0, 0, 0
R1, R2, M1, M2, M3 = 0, 0, 0, 0, 0

Check failure on line 1461 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F841)

rocketpy/simulation/flight.py:1461:17: F841 Local variable `M1` is assigned to but never used

Check failure on line 1461 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F841)

rocketpy/simulation/flight.py:1461:21: F841 Local variable `M2` is assigned to but never used

Check failure on line 1461 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F841)

rocketpy/simulation/flight.py:1461:25: F841 Local variable `M3` is assigned to but never used
# Determine current behavior
if t < self.rocket.motor.burn_out_time:
# Motor burning
Expand All @@ -1481,7 +1478,7 @@
# Mass
rocket_dry_mass = self.rocket.dry_mass # already with motor's dry mass
total_mass_at_t = propellant_mass_at_t + rocket_dry_mass
mu = (propellant_mass_at_t * rocket_dry_mass) / (

Check failure on line 1481 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F841)

rocketpy/simulation/flight.py:1481:9: F841 Local variable `mu` is assigned to but never used
propellant_mass_at_t + rocket_dry_mass
)
# Prepare transformation matrix
Expand Down Expand Up @@ -1616,7 +1613,7 @@
)
return u_dot

def u_dot(self, t, u, post_processing=False): # pylint: disable=too-many-locals,too-many-statements

Check failure on line 1616 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F811)

rocketpy/simulation/flight.py:1616:9: F811 Redefinition of unused `u_dot` from line 1434
"""Calculates derivative of u state vector with respect to time
when rocket is flying in 6 DOF motion during ascent out of rail
and descent without parachute.
Expand Down Expand Up @@ -1950,7 +1947,7 @@
Kt = K.transpose

# Compute aerodynamic forces and moments
R1, R2, R3, M1, M2, M3 = 0, 0, 0, 0, 0, 0

Check failure on line 1950 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F841)

rocketpy/simulation/flight.py:1950:21: F841 Local variable `M1` is assigned to but never used

Check failure on line 1950 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F841)

rocketpy/simulation/flight.py:1950:25: F841 Local variable `M2` is assigned to but never used

Check failure on line 1950 in rocketpy/simulation/flight.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (F841)

rocketpy/simulation/flight.py:1950:29: F841 Local variable `M3` is assigned to but never used

## Drag force
rho = self.env.density.get_value_opt(z)
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0