Hello, This is Nicole from team 1662. I am following this Youtube video “https://www.youtube.com/watch?v=wqJ4tY0u6IQ&feature=youtu.be” and I have run into an error. If you go to 28:54 - 32 in the video that is the part I am having trouble with. My error is happening at “new DifferentialDriveOdometry(kinematics, getHeading());”
The error that it is giving me is “The constructor DifferentialDriveOdometry(DifferentialDriveKinematics, Rotation2d) is undefinedJava(134217858)”
This is my code
public class Drivetrain extends SubsystemBase {
TalonFX leftMaster = new TalonFX(3);
TalonFX rightMaster = new TalonFX(1);
TalonFX leftSlave = new TalonFX(2);
TalonFX rightSlave = new TalonFX(0);
PigeonIMU gyro = new PigeonIMU(0);
DifferentialDriveKinematics kinematics = new DifferentialDriveKinematics(Units.inchesToMeters(20));
DifferentialDriveOdometry odometry = new DifferentialDriveOdometry(kinematics, getHeading());
public Drivetrain() {
leftSlave.follow(leftMaster);
rightSlave.follow(rightMaster);
leftMaster.setInverted(false);
rightMaster.setInverted(true);
}
public Rotation2d getHeading() {
return Rotation2d.fromDegrees(-gyro.getFusedHeading());
}
}
Thank You,
Nicole Stoddart