From f624cbf684a41a3605a264f479c722ebf59d3575 Mon Sep 17 00:00:00 2001 From: davidskeck Date: Thu, 24 Apr 2014 12:43:16 -0500 Subject: [PATCH] Edited constants and required turn method to accept input for turn durations. v1.0.1 --- libraries/CurioDuinoNav/CurioDuinoNav.cpp | 8 ++++---- libraries/CurioDuinoNav/CurioDuinoNav.h | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libraries/CurioDuinoNav/CurioDuinoNav.cpp b/libraries/CurioDuinoNav/CurioDuinoNav.cpp index 99b9452..36e930f 100644 --- a/libraries/CurioDuinoNav/CurioDuinoNav.cpp +++ b/libraries/CurioDuinoNav/CurioDuinoNav.cpp @@ -18,16 +18,16 @@ void CurioDuinoNav::begin() forwardSpeed = 0; } -void CurioDuinoNav::turnLeft() +void CurioDuinoNav::turnLeft(int turnDuration) { motors.setSpeeds(-TURN_SPEED, TURN_SPEED); - delay(TURN_DURATION); + delay(turnDuration); } -void CurioDuinoNav::turnRight() +void CurioDuinoNav::turnRight(int turnDuration) { motors.setSpeeds(TURN_SPEED, -TURN_SPEED); - delay(TURN_DURATION); + delay(turnDuration); } void CurioDuinoNav::goForward() diff --git a/libraries/CurioDuinoNav/CurioDuinoNav.h b/libraries/CurioDuinoNav/CurioDuinoNav.h index 20c6c31..828a35a 100644 --- a/libraries/CurioDuinoNav/CurioDuinoNav.h +++ b/libraries/CurioDuinoNav/CurioDuinoNav.h @@ -23,7 +23,8 @@ class ZumoMotors; // Duration of movements #define REVERSE_DURATION 750 // ms -#define TURN_DURATION 400 +#define EDGE_TURN_DURATION 440 +#define OBSTACLE_TURN_DURATION 340 class CurioDuinoNav { @@ -36,8 +37,8 @@ class CurioDuinoNav // because Arduino constructors // are not advised. void begin(); - void turnRight(); - void turnLeft(); + void turnRight(int turnDuration); + void turnLeft(int turnDuration); void goForward(); void goReverse(); void stopMoving();