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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 19:14b4b90bdf46
- Parent:
- 16:be88d07a24fe
diff -r be88d07a24fe -r 14b4b90bdf46 main.cpp
--- a/main.cpp Thu Mar 19 16:59:37 2015 +0000
+++ b/main.cpp Mon Mar 23 16:06:15 2015 +0000
@@ -47,12 +47,9 @@
//all these values have to be global; this function gets called each time there's a new direction/desired speed
a_ratio = hall_ldt/hall_rdt; //actual_ratio
desired_ratio = desired_duty_l/desired_duty_r; //desired_duty comes from set_direction()
- perc_r = (1-((desired_duty_r-0.1)/desired_duty_r));//absolute vlaue of +-0.1 duty means a differnt percentage error for each duty value
- perc_l = (1-((desired_duty_l-0.1)/desired_duty_l));
- perc_tot = perc_r + perc_l;
- threshold = desired_ratio*perc_tot; //dynamic threshold that will change according to duties
- limit = 0.2*((desired_duty_l + desired_duty_r)/2); //twenty percent of the average duty
- inc_value = 0.05*((desired_duty_l + desired_duty_r)/2); //probably need to change 5% from testing
+ threshold = desired_ratio*0.1*((1/desired_duty_r) + (1/desired_duty_l)); //dynamic threshold that will change according to duties
+ limit = 0.05*((desired_duty_r/desired_duty_l) + (desired_duty_l/desired_duty_r) + 1); //5% of (ratio of duties and inverse ratio of duties + offset(1) )
+ inc_value = 0.25*limit;
}
void set_direction( int direction, float duty_l, float duty_r)
{
@@ -214,7 +211,7 @@
motor_lf=0;
motor_lb=0;
wait(1);
- set_direction(0x11, 0.5,0.5);
+ set_direction(0x11, 0.2,0.2);
while(1) {
}
}