RBE2002FinalProject/DualDCMotor.cpp
// Returns Vel in degress/second
Returns Vel in degress/second
Returns Vel in degress / second
double DualDCMotor::calcLeftVel() {
  double curPos = leftEncTicks;
  curTime = millis();
  timeInterval = curTime - prevTime;
  movement = curPos - prevPos;
  movement = movement * ticksToDeg;
  Vel = movement * 1000 / timeInterval;
  prevPos = curPos;
  prevTime = curTime;
  return Vel;
}
double DualDCMotor :: calcLeftVel ( ) { double curPos = leftEncTicks ; curTime = millis ( ) ; timeInterval = curTime - prevTime ; movement = curPos - prevPos ; movement = movement * ticksToDeg ; Vel = movement * 1000 / timeInterval ; prevPos = curPos ; prevTime = curTime ; return Vel ; }
Returns Vel in degress/second
Returns Vel in degress / second
//current positions //current time //time change in ms from last call //encoder ticks since last call //encoder ticks to degrees //Velocity in degrees per milliseconds //sets curent vals to previous