{"id":21314852,"url":"https://github.com/bocchio01/skyward_recruitment_assignment","last_synced_at":"2025-03-15T21:23:34.383Z","repository":{"id":197269586,"uuid":"696926933","full_name":"Bocchio01/SkyWard_Recruitment_Assignment","owner":"Bocchio01","description":"Assignment to join the PoliMi SkyWard software team","archived":false,"fork":false,"pushed_at":"2023-12-24T16:35:28.000Z","size":1855,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T10:24:11.493Z","etag":null,"topics":["data-analysis","kalman-filter","model-rocket"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bocchio01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-09-26T17:42:01.000Z","updated_at":"2023-11-27T15:42:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"281a562e-6cbd-4fdb-a69a-83c91e649440","html_url":"https://github.com/Bocchio01/SkyWard_Recruitment_Assignment","commit_stats":null,"previous_names":["bocchio01/skyward_recruitment_assigment","bocchio01/skyward_recruitment_assignment"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bocchio01%2FSkyWard_Recruitment_Assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bocchio01%2FSkyWard_Recruitment_Assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bocchio01%2FSkyWard_Recruitment_Assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bocchio01%2FSkyWard_Recruitment_Assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bocchio01","download_url":"https://codeload.github.com/Bocchio01/SkyWard_Recruitment_Assignment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243791136,"owners_count":20348423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","kalman-filter","model-rocket"],"created_at":"2024-11-21T18:15:38.968Z","updated_at":"2025-03-15T21:23:34.345Z","avatar_url":"https://github.com/Bocchio01.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SkyWard Recruitment Assignment\n\nThis repository contains my solution to the SkyWard Recruitment Assignment, focused on detecting crucial events during a rocket launch, flight, and landing based on sensor data, including pressure and acceleration. The implementation is written in C and is based on a Kalman filter to smooth the data and detect the events.\n\n## Logical Solution\n\nSince the given set of data is composed by a series of raw measurements of the pressure and the acceleration of the rocket, the first step is to filter the data to remove the noise.\n\n**To reduce noise in the sensor data I've opted for a Kalman filter**, which is an iterative algorithm that predicts and updates the true state of the system, making it ideal for smoothing sensor data and predicting future states of the rocket.\n\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./img/FilteredDatasZoom.png\" alt=\"Kalman_filter_application\" width=\"90%\" style=\"border-radius: 1em\" /\u003e\n    \u003cbr\u003e\n    \u003cfigcaption\u003eApplication of the Kalman filter to the altitude datas\u003c/figcaption\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n**Having a filtered set of data, the next step is to detect the events.** There where a lot of possible criteria to detect a certain event, but based also on papers founded on the internet and a some simulations with `MATLAB`, I've decided to use the following criterias:\n\n- *Liftoff*: when the rocket's acceleration exceeds a threshold relative to gravitational acceleration (g). Based only on accelerometer data\n- *Apogee*: when altitude begins to decrease. Based only on barometer data\n- *Landing*: when a peak of acceleration is detected, signaling the rocket's impact with the ground. Based only on accelerometer data\n\n### Resources\n\nFor a deeper dive into the Kalman filter and its mathematical foundation, consult the papers in the [Papers folder](Papers/).\n\n## Code implementation\n\nThe code is implemented in C, and it is composed by two main files:\n\n- `grader.c`: the entry file, which contains the main function and the functions to read the data from the file. It's also responsible for calling the event detection functions\n- `state_updater.c`: contains an `init` function to initialize the Kalman filter (matrices) and the `update` function, which is responsible for apply the filter to the current data and perform the event detection based on the criteria stated in [the logical solution](#logical-solution)\n\nAlong with these two files, there is also a `matrices.c` file, which contains all the linear algebra functions needed to perform the Kalman filter, such as matrix multiplication, matrix inversion, and matrix addition...\n\n### Data structures\n\nMost of the code uses a custom data structure called `Matrix`, which is a simple struct composed by a pointer to a 2D array of doubles and the dimensions of the matrix. This data structure is used to represent the matrices used in both the Kalman filter and the measured data.\n\n```c\ntypedef struct\n{\n    int rows;\n    int cols;\n    double **data;\n} Matrix;\n```\n\n\n### How to run\n\nTo run the code, simply run the following commands from the root directory:\n\n```bash\ngcc src/grader.c src/matrices.c src/state_updater.c -o OnBoard_Software.exe\n```\n\n```bash\n./OnBoard_Software.exe\n```\n\n## Results\n\nBy comparing the results of the code with the expected results from a simple visualization of the data, it is possible to see that the code is able to detect the events with a good accuracy.\n\nHowever, it's possible that in some situation the algorithm fails to detect the events, especially the landing, due to the fact that the algorithm is based on a peak detection, which is not always reliable. A possible solution to this problem could be to have a dual criteria for the landing event, based on both the peak detection and the altitude or the velocity.\n\nHave a nice coding day,\n\nTommaso :panda_face:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbocchio01%2Fskyward_recruitment_assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbocchio01%2Fskyward_recruitment_assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbocchio01%2Fskyward_recruitment_assignment/lists"}