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

Generated Data Simulator (WIP) #76

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
d16ace0
initial framework
wlsanderson Nov 5, 2024
bb4037f
simulating thrust curves
wlsanderson Nov 6, 2024
c2d7235
ruff
wlsanderson Nov 6, 2024
9f9c2ca
added drag force and coast phase
wlsanderson Nov 6, 2024
4976099
reformatting
wlsanderson Nov 7, 2024
35c7f08
starting rotation
wlsanderson Nov 7, 2024
de29610
progress
wlsanderson Nov 7, 2024
e2b7a17
Clean up
JacksonElia Nov 8, 2024
d18e4a8
Clean up
JacksonElia Nov 8, 2024
ab35553
Added simulation stuff to readme
JacksonElia Nov 8, 2024
47c3ada
rotation wip
wlsanderson Nov 8, 2024
0f53f37
rotations almost done, some bugs
wlsanderson Nov 9, 2024
b45df1c
bug fixes wip
wlsanderson Nov 9, 2024
728420a
rotation fixes wip
wlsanderson Nov 9, 2024
af2a007
Made sim config a class
JacksonElia Nov 10, 2024
7cf10cf
Made it so you could pass in the sim config
JacksonElia Nov 10, 2024
d10ab9a
Moved SimIMU variables into the process
JacksonElia Nov 10, 2024
7014bfa
Finished switching config to a class
JacksonElia Nov 10, 2024
c475013
Fixed arg parser
JacksonElia Nov 10, 2024
790c9b3
Cleaned up typing for SimulationConfig
JacksonElia Nov 10, 2024
2c234d3
Fixed everything
JacksonElia Nov 10, 2024
648a35d
rotation almost fixed
wlsanderson Nov 10, 2024
4db8f69
working
wlsanderson Nov 10, 2024
11addf7
added variable mass
wlsanderson Nov 10, 2024
d15a119
atmospheric properties and variable drag
wlsanderson Nov 11, 2024
46453f3
might undo later
wlsanderson Nov 11, 2024
04a286f
Excluded simulation code from coverage report
JacksonElia Nov 11, 2024
ad963f8
subscale values
wlsanderson Nov 12, 2024
018ba3d
initial framework
wlsanderson Nov 5, 2024
c914a68
simulating thrust curves
wlsanderson Nov 6, 2024
1aebae7
ruff
wlsanderson Nov 6, 2024
6a99579
added drag force and coast phase
wlsanderson Nov 6, 2024
91e89b3
reformatting
wlsanderson Nov 7, 2024
bb4d558
starting rotation
wlsanderson Nov 7, 2024
4b7923a
progress
wlsanderson Nov 7, 2024
cbabad7
Clean up
JacksonElia Nov 8, 2024
6e08a5e
Clean up
JacksonElia Nov 8, 2024
d6a427e
rotation wip
wlsanderson Nov 8, 2024
651c46a
rotations almost done, some bugs
wlsanderson Nov 9, 2024
7096498
bug fixes wip
wlsanderson Nov 9, 2024
e6283d0
rotation fixes wip
wlsanderson Nov 9, 2024
084e8ce
Made sim config a class
JacksonElia Nov 10, 2024
75e5d9f
Made it so you could pass in the sim config
JacksonElia Nov 10, 2024
3fd399f
Moved SimIMU variables into the process
JacksonElia Nov 10, 2024
5a0bab1
Finished switching config to a class
JacksonElia Nov 10, 2024
afa2eb8
Fixed arg parser
JacksonElia Nov 10, 2024
1bca6db
Cleaned up typing for SimulationConfig
JacksonElia Nov 10, 2024
db0e6ed
Fixed everything
JacksonElia Nov 10, 2024
dc98b7a
rotation almost fixed
wlsanderson Nov 10, 2024
a97643a
working
wlsanderson Nov 10, 2024
b7e2789
added variable mass
wlsanderson Nov 10, 2024
b5596d0
atmospheric properties and variable drag
wlsanderson Nov 11, 2024
d0560f7
might undo later
wlsanderson Nov 11, 2024
145b306
Excluded simulation code from coverage report
JacksonElia Nov 11, 2024
d6cbabf
subscale values
wlsanderson Nov 12, 2024
edfb964
Merge remote-tracking branch 'refs/remotes/origin/data-sim' into data…
wlsanderson Nov 14, 2024
24bc98d
drag changes
wlsanderson Nov 14, 2024
075e9ea
Merge remote-tracking branch 'origin/main' into data-sim
wlsanderson Nov 14, 2024
79c6f6d
my changes before merge
JacksonElia Nov 14, 2024
734a444
Merge remote-tracking branch 'origin/sam-changes' into data-sim
JacksonElia Nov 14, 2024
a150dcd
logger fix
wlsanderson Nov 14, 2024
37d716f
Merge remote-tracking branch 'origin/data-sim' into data-sim
JacksonElia Nov 14, 2024
6a35c42
Added differing cds to the sim
JacksonElia Nov 14, 2024
e2704a4
Ruff
JacksonElia Nov 14, 2024
9ec3abd
airbrakes ref area
wlsanderson Nov 14, 2024
0c28f2c
updated readme, standardized variable names
wlsanderson Nov 15, 2024
c943343
Merge main and fix conflicts
harshil21 Nov 16, 2024
486e944
Merge pull request #77 from NCSU-High-Powered-Rocketry-Club/readme-im…
JacksonElia Dec 3, 2024
b09a6b3
Merge branch 'main' into data-sim
wlsanderson Dec 4, 2024
382f2eb
wip, fixing apogee convergence time
wlsanderson Dec 5, 2024
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
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ We have put great effort into keeping the file structure of this project organiz
```
AirbrakesV2/
├── airbrakes/
| ├── data_handling/
│ │ ├── [files related to the processing of data ...]
| ├── hardware/
│ │ ├── [files related to the connection of the pi with hardware ...]
| ├── mock/
│ │ ├── [files related to the connection of mock (or simulated) hardware ...]
| ├── data_handling/
│ │ ├── [files related to the processing of data ...]
| ├── simulation/
│ │ ├── [files related to our custom air brakes sim ...]
│ ├── [files which control the airbrakes at a high level ...]
├── tests/ [used for testing all the code]
│ ├── ...
Expand Down Expand Up @@ -179,6 +181,10 @@ If you want to run a mock launch, but with the real servo running, run:
```bash
python3 main.py -m -r
```
To run a mock launch with our custom simulation:
```bash
python3 main.py -m -s
```
There are some additional options you can use when running a mock launch. To view them all, run:
```bash
python3 main.py --help
Expand Down
1 change: 0 additions & 1 deletion airbrakes/data_handling/apogee_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def _curve_fit(self) -> CurveCoefficients:
uncertainties = np.sqrt(np.diag(pcov))
if np.all(uncertainties < UNCERTAINTY_THRESHOLD):
self._has_apogee_converged = True

a, b = popt
return CurveCoefficients(A=a, B=b)

Expand Down
6 changes: 3 additions & 3 deletions airbrakes/data_handling/data_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ def _calculate_rotated_accelerations(self) -> npt.NDArray[np.float64]:
Calculates the rotated acceleration vector. Converts gyroscope data into a delta
quaternion, and adds onto the last quaternion. Will most likely be replaced by IMU
quaternion data in the future, this is a work-around due to bad datasets.

:return: numpy list of rotated acceleration vector [x,y,z]
"""

Expand All @@ -229,7 +228,8 @@ def _calculate_rotated_accelerations(self) -> npt.NDArray[np.float64]:
if any(val is None for val in [x_accel, y_accel, z_accel, gyro_x, gyro_y, gyro_z]):
return rotated_accelerations

# scipy docs for more info: https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html
# scipy docs for more info:
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.html
# Calculate the delta quaternion from the angular rates
delta_rotation = R.from_rotvec([gyro_x * dt, gyro_y * dt, gyro_z * dt])

Expand Down Expand Up @@ -285,7 +285,7 @@ def _calculate_time_differences(self) -> npt.NDArray[np.float64]:
This cannot be called on the first update as _last_data_packet is None. Units are in
seconds.
:return: A numpy array of the time difference between each data packet and the previous
data packet.
data packet.
"""
# calculate the time differences between each data packet
# We are converting from ns to s, since we don't want to have a velocity in m/ns^2
Expand Down
2 changes: 0 additions & 2 deletions airbrakes/mock/mock_imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class MockIMU(IMU):
and returns data read from a previous log file.
"""

__slots__ = ("_log_file_path",)

def __init__(
self,
real_time_simulation: bool,
Expand Down
30 changes: 30 additions & 0 deletions airbrakes/simulation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Rotation Guide for sim IMU

### Axes and Direction Definitions:
#### Vehicle Frame:
- The coordinate system with respect to the IMU inside of the rocket.
#### Earth Frame:
- The coordinate system with respect to Earth frame of reference.
#### WGS Vertical:
- The upwards orientation of the rocket, direction opposite of gravitational force
#### Rocket Body Axis:
- The direction that the rocket is facing; roll axis, longitudinal axis of the rocket
#### Flight Path:
- Velocity vector direction of the rocket; which way the rocket is travelling
#### Azimuth:
- $\phi$, phi, the horizontal cardinal direction of the flight path, relative to Earth's surface
- An azimuth of zero degrees is facing North.

### Angle Vector Definitions:
#### Pitch Angle:
- $\theta$, theta, angle from WGS vertical to the rocket body axis
#### Flight Path Angle:
- $\gamma$, gamma, angle from WGS vertical to the flight path
#### Angle of Attack:
- $\alpha$, alpha, angle from the flight path to the rocket body axis


WGS vertical of the IMU is described in vector form.
- Example: If the -x axis of the IMU is facing the sky, the WGS vertical is [-1, 0, 0]

Important to note that the IMU does not change orientation inside of the rocket when changing launch pad angle.
Empty file.
Loading
Loading