Mateusz Grzywacz / Yellow2WheeledRobot_motor_shield
Committer:
amateusz
Date:
Wed Feb 03 16:09:07 2016 +0000
Revision:
0:85e85976c650
Child:
2:6f6e591f1838
created linearization functions.; to do: functions to actually move the motors, like setting PWMs and Direction shift register.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
amateusz 0:85e85976c650 1 #include <math.h>
amateusz 0:85e85976c650 2
amateusz 0:85e85976c650 3 float motorLinearizationL(float desired)
amateusz 0:85e85976c650 4 {
amateusz 0:85e85976c650 5 return (6.6691*(exp(0.0249053*(desired*100))+2.92508))/100.0;
amateusz 0:85e85976c650 6 }
amateusz 0:85e85976c650 7
amateusz 0:85e85976c650 8 float motorLinearizationR(float desired)
amateusz 0:85e85976c650 9 {
amateusz 0:85e85976c650 10 return 4.096509*(exp(0.0286952296*(desired*100))+5.073644964)/100.0; // \/ history of trial and error
amateusz 0:85e85976c650 11 //return 5.9693939*(exp(0.0251906*(desired*100))+3.162519)/100.0; // that wasn't that bad at all! to early start, the rest ok
amateusz 0:85e85976c650 12 //return (3.45183*(exp(0.0292461*(desired*100))+5.51727))/100.0;
amateusz 0:85e85976c650 13 }