Skip to content

Commit

Permalink
feat(matlab): add simulated and actual flights (#12906)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongbo-miao committed Nov 25, 2023
1 parent 9b462db commit 3c98567
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 15 deletions.
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The diagram illustrates the repository's architecture, which is considered overl

(The diagram here may take a moment to load. Please wait patiently.)

![Architecture](https://github.com/hongbo-miao/hongbomiao.com/assets/3375461/6e98ed4a-0170-4ef9-9c59-314a9021e7af)
![Architecture](https://github.com/hongbo-miao/hongbomiao.com/assets/3375461/affbed54-a837-4f89-86e1-356a1dff6f63)

# 📦 Setup

Expand Down Expand Up @@ -276,6 +276,7 @@ make kubernetes-clean
- **Tableau** - Data visualization
- **PyTorch** - Machine learning framework
- **PyTorch Geometric** - PyTorch geometric deep learning extension
- **TorchServe** - PyTorch models serving
- **Lightning** - Deep Learning framework
- **LangChang** - Large language model (LLM) framework
- **NeuralForecast** - Neural forecasting
Expand Down Expand Up @@ -303,15 +304,10 @@ make kubernetes-clean

- **Hasura** - GraphQL Engine
- **hasura-metric-adapter** - Hasura GraphQL Engine metric adapter
- **Ory Hydra** - OAuth 2.0 and OpenID Connect server
- **Terraform** - Infrastructure as code (IaC)
- **TorchServe** - PyTorch models serving
- **Linkerd** - Service mesh
- **Caddy** - Web server, reverse proxy, load balancer
- **Traefik** - Web server, reverse proxy, load balancer
- **nginx** - Web server, reverse proxy, load balancer
- **Open Policy Agent (OPA)** - Policy-based control
- **OPAL** - Open-policy administration layer
- **Elastic APM** - Application performance monitoring
- **OpenTelemetry** - Observability framework
- **Jaeger** - Distributed tracing system
Expand Down Expand Up @@ -380,10 +376,23 @@ make kubernetes-clean
- **Diun** - Container image update notifier
- **Vagrant** - Development environments building and distributing
- **Ansible** - IT automation system
- **Terraform** - Infrastructure as code (IaC)
- **Discord** - ChatOps
- **Opsgenie** - Incident management platform
- **[GitHub Actions](https://github.com/hongbo-miao/hongbomiao.com/actions)** - Continuous integration

## Authentication, Authorization, Security

- **Apache Ranger** - Authorization, auditing
- **Ory Hydra** - OAuth 2.0 and OpenID Connect server
- **Open Policy Agent (OPA)** - Policy-based control
- **OPAL** - Open-policy administration layer
- **CodeQL** - Variant analysis
- **Prowler** - Cloud security assessments
- **Gitleaks** - Git secret scanning
- **GitGuardian** - Git secret scanning
- **xxHash** - Hash algorithm

## Simulation

- **AnyLogic** - Simulation modeling tool
Expand All @@ -392,10 +401,11 @@ make kubernetes-clean
- **npTDMS** - TDMS files reading and writing
- **PyVISA** - Virtual instrument software architecture (VISA) API library
- **MATLAB** - Programming and numeric computing platform
- **Aerospace Toolbox** - Aerospace vehicle motion analysis and visualization
- **Database Toolbox** - Relational and NoSQL databases interacting
- **Satellite Communications Toolbox** - Satellite communications systems simulation
- **Simscape** - Multidomain physical systems simulation
- **Simulink** - Simulation and model-based designing
- **Simscape** - Multidomain physical systems simulation
- **SimScale** - Computational fluid dynamics (CFD), finite element analysis (FEA), thermal simulation

## Embedded, IoT, Hardware
Expand Down Expand Up @@ -463,14 +473,6 @@ make kubernetes-clean
- **[Depfu](https://depfu.com/github/hongbo-miao/hongbomiao.com?project_id=29781)** - Dependency monitoring
- **[FOSSA](https://app.fossa.io/projects/git%2Bgithub.com%2Fhongbo-miao%2Fhongbomiao.com)** - License compliance

## Security

- **CodeQL** - Variant analysis
- **Prowler** - Cloud security assessments
- **Gitleaks** - Git secret scanning
- **GitGuardian** - Git secret scanning
- **xxHash** - Hash algorithm

## Design

- **Fusion 360** - Industrial design
Expand Down Expand Up @@ -611,6 +613,10 @@ The following presents a model of a radar-based air defense system. Bombers are

### MATLAB

#### Aerospace Toolbox - Aerospace Vehicle Motion Analysis and Visualization

![Aerospace Toolbox screenshot](https://github.com/hongbo-miao/hongbomiao.com/assets/3375461/7f84f5d5-4a85-4bcd-97e3-7c5f853f03c0)

#### Satellite Communications Toolbox - Satellite Communications Systems Simulation

![Satellite Communications Toolbox screenshot](https://github.com/hongbo-miao/hongbomiao.com/assets/3375461/693e5605-de66-4dd4-9ab5-47e713f6dbc1)
Expand Down
32 changes: 32 additions & 0 deletions matlab/simulated-and-actual-flights/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
h = Aero.Animation;

% timeStep = (1 / FramesPerSecond) * TimeScaling = 0.5s
h.FramesPerSecond = 10;
h.TimeScaling = 5;

% Simulated and actual flight trajectories
orangeAircraftPath = fullfile(matlabroot, 'toolbox', 'aero', 'astdemos', 'pa24-250_orange.ac');
blueAircraftPath = fullfile(matlabroot, 'toolbox', 'aero', 'astdemos', 'pa24-250_blue.ac');

idx1 = h.createBody(orangeAircraftPath, 'Ac3d');
idx2 = h.createBody(blueAircraftPath, 'Ac3d');

% "simdata" contains logged simulated data in a 6DoF array
simDataPath = fullfile(matlabroot, 'toolbox', 'aero', 'astdemos', 'simdata.mat');
load(simDataPath, 'simdata');
h.Bodies{1}.TimeSeriesSource = simdata;

% "fltdata" contains actual flight test data in a custom format
flightDataPath = fullfile(matlabroot, 'toolbox', 'aero', 'astdemos', 'fltdata.mat');
load(flightDataPath, 'fltdata');
h.Bodies{2}.TimeSeriesSource = fltdata;
h.Bodies{2}.TimeSeriesReadFcn = @readTimeSeriesData;
h.Bodies{2}.TimeSeriesSourceType = 'Custom';

% Camera
h.Camera.PositionFcn = @doFirstOrderChaseCameraDynamics;

h.play();
h.updateCamera(5);
h.wait();
h.delete();
24 changes: 24 additions & 0 deletions matlab/simulated-and-actual-flights/readTimeSeriesData.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function [xyz, ptp] = readTimeSeriesData(varargin)
h = varargin{end};
if size(varargin, 2) == 2
t = varargin{1};
if isfinite(varargin{1})
xyz(1) = interp1(h.TimeSeriesSource.time, h.TimeSeriesSource.X, t);
xyz(2) = interp1(h.TimeSeriesSource.time, h.TimeSeriesSource.Y, t);
xyz(3) = interp1(h.TimeSeriesSource.time, h.TimeSeriesSource.Z, t);

ptp(1) = interp1(h.TimeSeriesSource.time, h.TimeSeriesSource.phi, t);
ptp(2) = interp1(h.TimeSeriesSource.time, h.TimeSeriesSource.theta, t);
ptp(3) = interp1(h.TimeSeriesSource.time, h.TimeSeriesSource.psi, t);
else
xyz = h.TimeSeriesSource.time(1);
ptp = h.TimeSeriesSource.time(end);
end
else
xyz = [h.TimeSeriesSource.X(1), ...
h.TimeSeriesSource.Y(1), ...
h.TimeSeriesSource.Z(1)];
ptp = [h.TimeSeriesSource.phi(1), ...
h.TimeSeriesSource.theta(1), ...
h.TimeSeriesSource.psi(1)];
end
1 change: 1 addition & 0 deletions miss_hit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

suppress_rule: "copyright_notice"
suppress_rule: "line_length"
suppress_rule: "naming_functions"
suppress_rule: "naming_scripts"

0 comments on commit 3c98567

Please sign in to comment.