Working, Clean
Fork of Movement by
Diff: Movement.cpp
- Revision:
- 6:e21a1de9bb8c
- Parent:
- 5:d13de19a1eea
--- a/Movement.cpp Thu Nov 02 10:17:17 2017 +0000 +++ b/Movement.cpp Thu Nov 02 15:08:14 2017 +0000 @@ -8,6 +8,7 @@ } +//------------------------------------------------------------------------------ int Movement::getdirectionLeft(int mode){ int directionL; if(mode==1 || mode==2){ @@ -22,6 +23,7 @@ return directionL; } +//------------------------------------------------------------------------------ int Movement::getdirectionRight(int mode){ int directionR; if(mode==1 || mode==5){ @@ -36,7 +38,7 @@ return directionR; } - +//------------------------------------------------------------------------------ //Get the left position float Movement::getpositionLeft(int SignalNumber, int mode, float max_range){ static float positionLeft; //Define a position array @@ -44,7 +46,7 @@ float position_math_left; switch(SignalNumber){ case 1: //Move slowest - movement_left = directionLeft*0.5; + movement_left = directionLeft*0.25; position_math_left = positionLeft + movement_left; if (position_math_left >= max_range || position_math_left <=0){ positionLeft = positionLeft; @@ -54,7 +56,7 @@ } break; case 2: //Move slow - movement_left = directionLeft *1.5; + movement_left = directionLeft *1; position_math_left = positionLeft + movement_left; if (position_math_left >= max_range || position_math_left <=0){ positionLeft = positionLeft; @@ -70,6 +72,7 @@ return positionLeft; } +//------------------------------------------------------------------------------ // Get the right position float Movement::getpositionRight(int SignalNumber, int mode, float max_range){ static float positionRight; //Define a position array @@ -101,4 +104,4 @@ break; } return positionRight; -} +} \ No newline at end of file