Hiromasa Oku
/
linearMirrorMotion1017
this version 10/17
Fork of linearMirrorMotion by
Diff: main.cpp
- Revision:
- 13:26263959903b
- Parent:
- 12:d945fb6d4988
- Child:
- 14:314b86828ed2
diff -r d945fb6d4988 -r 26263959903b main.cpp --- a/main.cpp Fri Apr 05 04:28:08 2013 +0000 +++ b/main.cpp Fri Apr 05 07:13:33 2013 +0000 @@ -19,7 +19,7 @@ float sint=0, cost=1; float vx = 0, vy=0; -float theta=0, dt_betwords=50000, st=400; +float theta=0, dt_betWords=50000, st=400; unsigned int dt=500, ticktime=600; bool newPositionReady=false; @@ -35,8 +35,8 @@ point2dl shearing(point2dl dataBefore, float radious, float angularSpeed){ point2dl dataAfter; - dataAfter.x = dataBefore.x - radious*angularSpeed*timer_v.read_us()/st/1000; - dataAfter.y = dataBefore.y - radious*angularSpeed*timer_v.read_us()/st/1000; + dataAfter.x = dataBefore.x - radious*angularSpeed*timer_v.read_us()/st/1000; //st is a parameter for ajustment + dataAfter.y = dataBefore.y; dataAfter.laserSwitch = dataBefore.laserSwitch; return dataAfter; @@ -63,7 +63,7 @@ ////for culculate rotary velocit800000000y -------------------------------------------------------- volatile float angleIncrement = 2.0*PI / 128; // when in Sign/Magnitude mode -float radious = 700, radious_circle = 500; +float radious = 700, attachSecond = 500; // a ticker function to compute the speed periodically: #define PERIODIC_COMPUTE 10000 // in us @@ -118,7 +118,7 @@ // Attach the external interrupt routine: //clockEncoderPin.rise(&encoderClock); //clockEncoderPin.fall(&encoderClock); - superEncoder.attach_us(&encoderClock, radious_circle); + superEncoder.attach_us(&encoderClock, attachSecond); timer.reset(); timer.start(); // Attach the periodic computing function: @@ -169,7 +169,7 @@ } timer_v.reset(); IO.setRedPower(0); //off - wait_us(dt_betwords);//sqrtf(vx*vx+vy*vy)*100000); + wait_us(dt_betWords);//sqrtf(vx*vx+vy*vy)*100000); } //////////////// @@ -246,7 +246,7 @@ //makeBuffer(); } else if (val == 'B') { stringData[indexStringData] = 0; - dt_betwords = atoi(stringData); + dt_betWords = atoi(stringData); indexStringData=0; //makeBuffer(); } else if (val == 'S') { @@ -261,7 +261,7 @@ //makeBuffer(); }else if (val == 'T') { stringData[indexStringData] = 0; - radious_circle = atoi(stringData); + attachSecond = atoi(stringData); indexStringData=0; //makeBuffer(); }