Helvijs Kiselis
/
Micromouse
Algorithmus
Diff: Motion.cpp
- Revision:
- 11:2960fc540616
- Parent:
- 7:22392ed60534
- Child:
- 12:75d0291a9785
--- a/Motion.cpp Sat Apr 28 12:29:20 2018 +0000 +++ b/Motion.cpp Mon Apr 30 18:27:23 2018 +0000 @@ -9,7 +9,7 @@ const float Motion::KP = 2.5; const float Motion::KD = 0.0f; const int Motion::MOVE_DIST = 1605; -const float Motion::MOVE_SPEED = 50.0f; +const float Motion::MOVE_SPEED = 60.0f; Motion::Motion(Controller& controller, EncoderCounter& counterLeft, @@ -33,8 +33,8 @@ countsL = counterLeft.read(); countsR = counterRight.read(); - speedLeft = 50.0f; - speedRight = -50.0f; + speedLeft = MOVE_SPEED; + speedRight = -MOVE_SPEED; controller.setDesiredSpeedLeft(MOVE_SPEED); controller.setDesiredSpeedRight(-MOVE_SPEED); @@ -107,8 +107,8 @@ countsL = counterLeft.read(); countsR = counterRight.read(); - speedLeft = 50.0f; - speedRight = -50.0f; + speedLeft = MOVE_SPEED; + speedRight = -MOVE_SPEED; controller.setDesiredSpeedLeft(MOVE_SPEED); controller.setDesiredSpeedRight(-MOVE_SPEED); @@ -351,3 +351,15 @@ return line; } + +/* + if ( controller.getSpeedLeft() < MOVE_SPEED ) { + + speed = counterLeft.read()/2; + } + + if ( MOVE_DIST - counterLeft.read() < MOVE_SPEED*2 ) { + + speed = -(MOVE_DIST - MOVE_SPEED*2) + MOVE_SPEED; + } +*/