{"id":19601402,"url":"https://github.com/aerorust/free-flight-stabilization","last_synced_at":"2025-05-12T21:47:13.186Z","repository":{"id":240825605,"uuid":"792235578","full_name":"AeroRust/free-flight-stabilization","owner":"AeroRust","description":"Rust translation of dRehmFlight's PID control functions for UAV stabilization, compatible with no_std environments.","archived":false,"fork":false,"pushed_at":"2024-12-25T08:46:29.000Z","size":109,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T03:51:20.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AeroRust.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-26T08:50:27.000Z","updated_at":"2025-03-06T06:56:45.000Z","dependencies_parsed_at":"2025-02-26T15:35:07.421Z","dependency_job_id":"025c5452-7339-4a4a-9812-765967378225","html_url":"https://github.com/AeroRust/free-flight-stabilization","commit_stats":null,"previous_names":["aerorust/free-flight-stabilization"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AeroRust%2Ffree-flight-stabilization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AeroRust%2Ffree-flight-stabilization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AeroRust%2Ffree-flight-stabilization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AeroRust%2Ffree-flight-stabilization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AeroRust","download_url":"https://codeload.github.com/AeroRust/free-flight-stabilization/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253829901,"owners_count":21970988,"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":[],"created_at":"2024-11-11T09:18:18.068Z","updated_at":"2025-05-12T21:47:13.160Z","avatar_url":"https://github.com/AeroRust.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- README.md --\u003e\n\n# Free Flight Stabilization Controller\n\nThis repository contains a `no_std`, no-alloc Rust translation of the PID\n(Proportional, Integral, Derivative) control functions from dRehmFlight\nversion 1.3, an Arduino-based flight controller software. These functions\nare used to stabilize unmanned aerial vehicles (UAVs) and are written with\nminor external dependencies.\n\n## Overview\n\nThe initial translation preserved the structure of the original Arduino\nimplementation to facilitate easy verification and comparison for those\nfamiliar with dRehmFlight. The aim was to maintain a detailed commit history\nto document the refactoring process.\n\nTagged version v0.0.0 contains code for both the old direct translation,\nthe new refactor, and tests with matching values for both. See the angle,\nrate, and angle2 stabilizers. Tests pass and values match. Only the refactored\ncode remains in future commits.\n\n## Usage Example\n\n```rust\n// Angle Stabilizer Example\nuse free_flight_stabilization::{AngleStabilizer, FlightStabilizer, FlightStabilizerConfig};\nlet mut config = FlightStabilizerConfig::\u003cf32\u003e::new();\n\n// Set the PID gains for roll, pitch, and yaw.\nconfig.kp_roll = 0.2;\nconfig.ki_roll = 0.3;\nconfig.kd_roll = -0.05;\nconfig.kp_pitch = config.kp_roll;\nconfig.ki_pitch = config.ki_roll;\nconfig.kd_pitch = config.kd_roll;\nconfig.kp_yaw = 0.3;\nconfig.ki_yaw = 0.05;\nconfig.kd_yaw = 0.00015;\n\n// Set the upper limit for the integral term to prevent windup.\nconfig.i_limit = 25.0;\n\n// Set the scale to adjust the PID outputs to the actuator range.\nconfig.scale = 0.01;\n\n// Create the angle stabilizer.\nlet mut stabilizer = AngleStabilizer::with_config(config);\n\n// Simulated sensor inputs and desired setpoints.\nlet set_point = (10.0, 0.0, 10.0); // desired roll, pitch, yaw\nlet imu_attitude = (5.0, 5.0, 0.0); // current roll, pitch, yaw\nlet gyro_rate = (1.0, -1.0, -1.0); // current roll rate, pitch rate, yaw rate\nlet dt = 0.01; // time step\nlet low_throttle = false;\n\n// Perform the control computation.\nlet (roll_pid, pitch_pid, yaw_pid) =\n    stabilizer.control(set_point, imu_attitude, gyro_rate, dt, low_throttle);\n```\n\n## License\n\ndRehmFlight was originally released under the GNU General Public License\n(GPL) Version 3. Accordingly, this translation as a derivative work is\nalso released under the GPL Version 3. For more details, see the\n[GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.html), or the LICENSE\nfile in this repository.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerorust%2Ffree-flight-stabilization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faerorust%2Ffree-flight-stabilization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerorust%2Ffree-flight-stabilization/lists"}