Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust translation of dRehmFlight's PID control functions for UAV stabilization, compatible with no_std environments.

License

NotificationsYou must be signed in to change notification settings

AeroRust/free-flight-stabilization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains ano_std, no-alloc Rust translation of the PID(Proportional, Integral, Derivative) control functions from dRehmFlightversion 1.3, an Arduino-based flight controller software. These functionsare used to stabilize unmanned aerial vehicles (UAVs) and are written withminor external dependencies.

Overview

The initial translation preserved the structure of the original Arduinoimplementation to facilitate easy verification and comparison for thosefamiliar with dRehmFlight. The aim was to maintain a detailed commit historyto document the refactoring process.

Tagged version v0.0.0 contains code for both the old direct translation,the new refactor, and tests with matching values for both. See the angle,rate, and angle2 stabilizers. Tests pass and values match. Only the refactoredcode remains in future commits.

Usage Example

// Angle Stabilizer Exampleuse free_flight_stabilization::{AngleStabilizer,FlightStabilizer,FlightStabilizerConfig};letmut config =FlightStabilizerConfig::<f32>::new();// Set the PID gains for roll, pitch, and yaw.config.kp_roll =0.2;config.ki_roll =0.3;config.kd_roll = -0.05;config.kp_pitch = config.kp_roll;config.ki_pitch = config.ki_roll;config.kd_pitch = config.kd_roll;config.kp_yaw =0.3;config.ki_yaw =0.05;config.kd_yaw =0.00015;// Set the upper limit for the integral term to prevent windup.config.i_limit =25.0;// Set the scale to adjust the PID outputs to the actuator range.config.scale =0.01;// Create the angle stabilizer.letmut stabilizer =AngleStabilizer::with_config(config);// Simulated sensor inputs and desired setpoints.let set_point =(10.0,0.0,10.0);// desired roll, pitch, yawlet imu_attitude =(5.0,5.0,0.0);// current roll, pitch, yawlet gyro_rate =(1.0, -1.0, -1.0);// current roll rate, pitch rate, yaw ratelet dt =0.01;// time steplet low_throttle =false;// Perform the control computation.let(roll_pid, pitch_pid, yaw_pid) =    stabilizer.control(set_point, imu_attitude, gyro_rate, dt, low_throttle);

License

dRehmFlight was originally released under the GNU General Public License(GPL) Version 3. Accordingly, this translation as a derivative work isalso released under the GPL Version 3. For more details, see theGPLv3 license, or the LICENSEfile in this repository.

About

Rust translation of dRehmFlight's PID control functions for UAV stabilization, compatible with no_std environments.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp