Quasics2021Code/MaeTester/src/main/cpp/commands/DriveAtPowerForMeters.cpp
// Returns true when the command should end.
Returns true when the command should end.
Returns true when the command should end .
bool DriveAtPowerForMeters::IsFinished() {
  auto currentReading = (drivebase->GetLeftEncoderDistance() +
                         drivebase->GetRightEncoderDistance()) /
                        2;
  std::cout << "desiredMeters = " << desiredMeters
            << ", startingMeters = " << startingMeters
            << ", destination = " << destination
            << ", currentReading = " << currentReading << std::endl;
  if (desiredMeters.to<double>() < 0) {
    if (currentReading.to<double>() <= destination.to<double>()) {
      return true;
    }
    return false;
  } else {
    if (currentReading.to<double>() >= destination.to<double>()) {
      return true;
    }
    return false;
  }
}
bool DriveAtPowerForMeters :: IsFinished ( ) { auto currentReading = ( drivebase -> GetLeftEncoderDistance ( ) + drivebase -> GetRightEncoderDistance ( ) ) / 2 ; std :: cout << " " << desiredMeters << " " << startingMeters << " " << destination << " " << currentReading << std :: endl ; if ( desiredMeters . to < double > ( ) < 0 ) { if ( currentReading . to < double > ( ) <= destination . to < double > ( ) ) { return true ; } return false ; } else { if ( currentReading . to < double > ( ) >= destination . to < double > ( ) ) { return true ; } return false ; } }
Returns true when the command should end.
Returns true when the command should end .
// if desires < 0