src/main/cpp/subsystems/DriveTrainSubsystemBase.cpp
void DriveTrainSubsystemBase::TurnInDegreesGyro(double relativeAngle, double speed)
 {
     //troubleshooting values, use these for testing what makes the robot go to the relative angle
     frc::SmartDashboard::PutNumber("Current Angle", relativeAngle);
     frc::SmartDashboard::PutBoolean("In Place", true);
     double startAngle = IMUGetAngle();
     double currentAngle = IMUGetAngle();
     //logic used to turn the robot left or right and keeping it turned
     if (relativeAngle > 0)
     {
         TurnRight(speed);
         while (currentAngle - startAngle < relativeAngle)
         {
            currentAngle = IMUGetAngle();
         }
     }
     if (relativeAngle < 0)
     {
         TurnLeft(speed);
         while (currentAngle - startAngle > relativeAngle)
         {
            currentAngle = IMUGetAngle();
         }
     }
     Stop();
 }
//Used to turn the robot a certain amount of degrees(RelativeAngle is user's wanted angle)
Used to turn the robot a certain amount of degrees(RelativeAngle is user's wanted angle)
Used to turn the robot a certain amount of degrees ( RelativeAngle is user ' s wanted angle )
void DriveTrainSubsystemBase::TurnInDegreesGyro(double relativeAngle, double speed)
 {
     frc::SmartDashboard::PutNumber("Current Angle", relativeAngle);
     frc::SmartDashboard::PutBoolean("In Place", true);
     double startAngle = IMUGetAngle();
     double currentAngle = IMUGetAngle();
     if (relativeAngle > 0)
     {
         TurnRight(speed);
         while (currentAngle - startAngle < relativeAngle)
         {
            currentAngle = IMUGetAngle();
         }
     }
     if (relativeAngle < 0)
     {
         TurnLeft(speed);
         while (currentAngle - startAngle > relativeAngle)
         {
            currentAngle = IMUGetAngle();
         }
     }
     Stop();
 }
void DriveTrainSubsystemBase :: TurnInDegreesGyro ( double relativeAngle , double speed ) { frc :: SmartDashboard :: PutNumber ( " " , relativeAngle ) ; frc :: SmartDashboard :: PutBoolean ( " " , true ) ; double startAngle = IMUGetAngle ( ) ; double currentAngle = IMUGetAngle ( ) ; if ( relativeAngle > 0 ) { TurnRight ( speed ) ; while ( currentAngle - startAngle < relativeAngle ) { currentAngle = IMUGetAngle ( ) ; } } if ( relativeAngle < 0 ) { TurnLeft ( speed ) ; while ( currentAngle - startAngle > relativeAngle ) { currentAngle = IMUGetAngle ( ) ; } } Stop ( ) ; }
Used to turn the robot a certain amount of degrees(RelativeAngle is user's wanted angle)
Used to turn the robot a certain amount of degrees ( RelativeAngle is user ' s wanted angle )
//troubleshooting values, use these for testing what makes the robot go to the relative angle //logic used to turn the robot left or right and keeping it turned