Skip to content
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

SG1.4 flight-like simulation #58

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
14 changes: 14 additions & 0 deletions Simulation/6DOF_RK4/LookUp/j280.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Time (s),Thrust (N),Theta,Phi
0.10,259.43,0,0
0.30,278.91,0,0
0.60,293.07,0,0
0.90,306.85,0,0
1.20,319.19,0,0
1.50,321.10,0,0
1.80,310.85,0,0
2.11,279.89,0,0
2.35,286.70,0,0
2.40,269.17,0,0
2.44,178.24,0,0
2.49,42.80,0,0
2.54,0.00,0,0
26 changes: 26 additions & 0 deletions Simulation/6DOF_RK4/LookUp/j430.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Time (s),Thrust (N),Theta,Phi
0.017,400.0,0,0
0.025,501.107,0,0
0.034,538.745,0,0
0.069,432.472,0,0
0.111,440.59,0,0
0.192,458.303,0,0
0.328,469.373,0,0
0.508,473.801,0,0
0.697,473.801,0,0
0.899,468.635,0,0
0.996,461.255,0,0
1.2,446.494,0,0
1.401,429.52,0,0
1.593,415.498,0,0
1.696,410.332,0,0
1.739,414.76,0,0
1.785,354.244,0,0
1.807,277.491,0,0
1.83,180.074,0,0
1.839,145.387,0,0
1.853,107.749,0,0
1.885,49.446,0,0
1.914,19.188,0,0
1.943,2.952,0,0
1.963,0.0,0,0
4,173 changes: 4,173 additions & 0 deletions Simulation/6DOF_RK4/LookUp/sg1.4_ras.CSV

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Simulation/6DOF_RK4/dynamics/forces.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ def get_force(self, x_state, flap_ext, time_stamp, ejection_force, theta, phi, d
wind_vector = self.atm.get_wind_vector(time_stamp)
alpha = self.get_alpha(x_state, wind_vector)
drag = self.aerodynamic_force(x_state, density, wind_vector, alpha, self.rasaero, thrust.dot(thrust) > 0, flap_ext)



# This is super hacky but i think there is some floating point bs going on
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls dont merge with this :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

70 comes from maximum drag experienced by sg1.4 (@mihirshevade )

drag_magnitude = np.linalg.norm(drag)
max_drag = 70
if(drag_magnitude > max_drag):
drag = (drag/drag_magnitude) * max_drag

grav = self.gravitational_force(alt, time_stamp)
force = vct.body_to_world(*x_state[2],thrust + drag) + grav
moment = vct.body_to_world(*x_state[2], np.cross(-self.cm, thrust) + self.aerodynamic_moment(drag))
Expand Down
66 changes: 66 additions & 0 deletions Simulation/6DOF_RK4/properties/configs/stargazer14_flightlike.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<<: *pysim_simulation
rocket:
<<: *simulated_rocket
stages:
- booster:
<<: *simulated_stage
rocket_body:
<<: *simulated_rocket_body
rasaero_lookup_file: "../lookup/RASAero.csv"
C_d: 0.8
C_d_s: 1.2
length: 2.338
dry_mass: 7.189
radius: 0.0381
structure_cm: !numpy/array [1.111, 0., 0.]
combined_cm: !numpy/array [1.006, 0., 0.]
combined_cp: !numpy/array [0.792, 0., 0.]
motor:
<<: *motor_J430
sensors:
high_g:
RMS: 1.9 # milli g
gyro:
RMS: 75 # mdps (millidegrees per second)
barometer:
RMS: .012 # Pascal Conversion
bno:
error: !eval 2.5/3
flaps:
<<: *simulated_flaps
max_ext_length: 0.001
max_ext_spd: 0.001
- sustainer:
<<: *simulated_stage
rocket_body:
<<: *simulated_rocket_body
rasaero_lookup_file: "../lookup/RASAero.csv"
C_d: 0.5
C_d_s: 1.2
length: 1.341
dry_mass: 3.570
radius: 0.0381
structure_cm: !numpy/array [0.65, 0., 0.]
combined_cm: !numpy/array [0.526, 0., 0.]
combined_cp: !numpy/array [0.378, 0., 0.]
motor:
<<: *motor_J280
sensors:
high_g:
RMS: 1.9 # milli g
gyro:
RMS: 75 # mdps (millidegrees per second)
barometer:
RMS: .012 # Pascal Conversion
bno:
error: !eval 2.5/3
flaps:
<<: *simulated_flaps
max_ext_length: 0.001
max_ext_spd: 0.001
desired_apogee: 1824
meta:
output_file: '../output/simulated_6dof.csv'
monte_carlo_output_folder: '../output/monte_carlo'


2 changes: 1 addition & 1 deletion Simulation/6DOF_RK4/properties/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np

# Config file
sim_config = "../properties/configs/staging_rocket.yaml"
sim_config = "../properties/configs/stargazer14_flightlike.yaml"

### Calculated constants
# Gravitational const
Expand Down
16 changes: 16 additions & 0 deletions Simulation/6DOF_RK4/properties/templates/motors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,20 @@ define: &motor_J244
motor_mass: 0.911
delay: 60
motor_lookup_file: "../lookup/j244.csv"
cm: !numpy/array [0.3755, 0., 0.]

define: &motor_J280
<<: *simulated_motor
impulse: 716.5
motor_mass: 0.954
delay: 60
motor_lookup_file: "../lookup/j280.csv"
cm: !numpy/array [0.3755, 0., 0.]

define: &motor_J430
<<: *simulated_motor
impulse: 821.1
motor_mass: 0.8
delay: 60
motor_lookup_file: "../lookup/j430.csv"
cm: !numpy/array [0.3755, 0., 0.]