Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-phelps committed Nov 19, 2021
1 parent 5d576b5 commit a495cc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public RobotContainer() {
* edu.wpi.first.wpilibj2.command.button.JoystickButton}.
*/
private void configureButtonBindings() {
SmartDashboard.putData(new DriveDistance(drivetrain, 10.0));

}

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
import com.ctre.phoenix.sensors.PigeonIMU;
//import com.kauailabs.navx.frc.AHRS;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.kinematics.DifferentialDriveOdometry;
Expand Down Expand Up @@ -45,9 +44,6 @@ public class Drivetrain extends SubsystemBase {
/** Creates a new DriveTrain. */
public Drivetrain() {

// Trying this to avoid errors
//m_drive.setSafetyEnabled(false);

// Reset to default
driveLeftFollower.configFactoryDefault();
driveLeftLeader.configFactoryDefault();
Expand Down Expand Up @@ -75,7 +71,7 @@ public Drivetrain() {
resetEncoders();
zeroHeading();

m_odometry = new DifferentialDriveOdometry(getRotation2d()); //testing setting stuff up with the pigeon
m_odometry = new DifferentialDriveOdometry(getRotation2d());
}

@Override
Expand Down Expand Up @@ -146,23 +142,17 @@ public Rotation2d getRotation2d() {
/**
* Returns the heading of the robot.
*
* @return the robot's heading in degrees, from -180 to 180
* @return the robot's heading in degrees
*/
public double getHeading() {
pigeon.getYawPitchRoll(yawPitchRoll);
return yawPitchRoll[0]; //-180 is an attempt to fix wraparound issues
return yawPitchRoll[0];
}

public void zeroHeading() {
//pigeon.setCompassAngle(180); //compassheading is being set to 180, but reading compass heading gives us 0 on smartdashboard
pigeon.setYaw(0);
//pigeon.setFusedHeading(180);
}

//public double getTurnRate() {
// return -pigeon.;
//}

public void resetOdometry(Pose2d pose) {
resetEncoders();
m_odometry.resetPosition(pose, getRotation2d());
Expand Down

0 comments on commit a495cc2

Please sign in to comment.