aaa
Fork of Move by
Diff: move.cpp
- Revision:
- 26:0584d68e8f30
- Parent:
- 25:fa9b75c175fd
- Child:
- 27:4242d6187281
--- a/move.cpp Sat Sep 10 17:33:19 2016 +0000 +++ b/move.cpp Sat Sep 10 17:38:58 2016 +0000 @@ -29,26 +29,21 @@ M1ccw.period_us(256); M2cw.period_us(256); M2ccw.period_us(256); - } void move(int left,int right) { - float rightduty,leftduty; - if(right>256) { + if(right>256) right=256; - } - if(left>256) { + else if(right<-256) + right=-256; + + if(left>256) left=256; - } - if(right<-256) { - right=-256; - } - if(left<-256) { + else if(left<-256) left=-256; - } rightduty=right/256.0; leftduty=left/256.0; @@ -247,8 +242,7 @@ daikei = i/5; } else if(absd_length < 300) { daikei = absd_length / 300.0; - } - else + } else daikei = 1; move(daikei * (rightspeed*(1-ratio) + k*(*disorder) - k_theta*dtheta) + rightspeed*ratio, @@ -508,7 +502,6 @@ wait(0.2); red = 0; - } float nearPi(float rad)