Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Quadrocopter by
Revision 30:dc68b509f930, committed 2017-10-05
- Comitter:
- chriselsholz
- Date:
- Thu Oct 05 18:02:40 2017 +0000
- Parent:
- 29:3efe34986347
- Commit message:
- test;
Changed in this revision
filter/Kalman.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/filter/Kalman.cpp Mon Sep 25 11:04:53 2017 +0000 +++ b/filter/Kalman.cpp Thu Oct 05 18:02:40 2017 +0000 @@ -8,11 +8,12 @@ void Kalman_pitch(void) { /* We will set the varibles like so, these can also be tuned by the user */ - Q_angle_pitch = 0.001; + Q_angle_pitch = 0.1; Q_bias_pitch = 0.003; - R_measure_pitch = 0.03; + R_measure_pitch = 0.1; - bias_pitch = 0; // Reset bias + angle_pitch = 1.2; + bias_pitch = -0.4; // Reset bias // Since we assume tha the bias is 0 and we know the starting angle (use setAngle), // the error covariance matrix is set like so - see: http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical P_pitch[0][0] = 0; @@ -128,10 +129,11 @@ { /* We will set the varibles like so, these can also be tuned by the user */ Q_angle_roll = 0.001; - Q_bias_roll = 0.003; - R_measure_roll = 0.03; + Q_bias_roll = 0.1; + R_measure_roll = 0.1; - bias_roll = 0; // Reset bias + angle_roll = 1.2; + bias_roll = 1.2; // Reset bias // Since we assume tha the bias is 0 and we know the starting angle (use setAngle), // the error covariance matrix is set like so - see: http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical P_roll[0][0] = 0;
--- a/main.cpp Mon Sep 25 11:04:53 2017 +0000 +++ b/main.cpp Thu Oct 05 18:02:40 2017 +0000 @@ -100,7 +100,7 @@ if (taster2) { pc.printf("\n\rOffset und Driftberechnung wird durchgefuehrt, halte die Drohne still"); - printf("\n\rpitch, yaw, roll, newAngle_pitch, newAngle_´roll, newRate_pitch, newRate_yaw, newRate_roll, n2\n\r"); + printf("\n\rpitch, yaw, roll, newAngle_pitch, newAngle_roll, gyro_pitch, gyro_yaw, gyro_roll, n2\n\r"); while(1) { @@ -144,7 +144,7 @@ if (i == 500) { - printf(" %f3.2 \t\t %f3.2 \t\t %f3.2 \t\t %f3.2 \t\t %f3.2 \t\t %f3.2 \t\t %f3.2 \t\t %f3.2 \t\t %d\n\r", pitch, yaw, roll, newAngle_pitch, newAngle_´roll, newRate_pitch, newRate_yaw, newRate_roll, n2); + printf(" %3.2f \t %3.2f \t %3.2f \t %3.2f \t\t %3.2f \t\t %3.2f \t\t %3.2f \t\t %3.2f \t\t %d\n\r", pitch, yaw, roll, newAngle_pitch, newAngle_roll, gyro_pitch, gyro_yaw, gyro_roll, n2); i = 0; } if (timer2.read_ms() >= 5000) @@ -160,7 +160,7 @@ timer2.reset(); } Motorsteurung(&Motor1, &Motor2, &Motor3, &Motor4, &taster2, &taster3, &taster4, &n1, &n2, &n3, &n4); - if (n1>1400) + if (n1>1501) { n1=n2=n3=n4=700; Motor1.pulsewidth_us(n1); @@ -173,4 +173,4 @@ } } } -} +} \ No newline at end of file