pathplanner directions wrong
This commit is contained in:
parent
eb00b1146e
commit
4d260809d8
@ -285,7 +285,7 @@ public class RobotContainer {
|
|||||||
|
|
||||||
sensorTab.addDouble("dt distance", drivetrain::driveDistance);
|
sensorTab.addDouble("dt distance", drivetrain::driveDistance);
|
||||||
|
|
||||||
|
//sensorTab.add("odometry", drivetrain::getPose);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ public class AutoConstants {
|
|||||||
public static final double kMaxAngularSpeedRadiansPerSecond = Math.PI;
|
public static final double kMaxAngularSpeedRadiansPerSecond = Math.PI;
|
||||||
public static final double kMaxAngularSpeedRadiansPerSecondSquared = Math.PI;
|
public static final double kMaxAngularSpeedRadiansPerSecondSquared = Math.PI;
|
||||||
|
|
||||||
public static final double kPXController = 1;
|
public static final double kPXController = 15;
|
||||||
public static final double kPYController = 1;
|
public static final double kPYController = 15;
|
||||||
public static final double kPThetaController = 1;
|
public static final double kPThetaController = 5;
|
||||||
|
|
||||||
// Constraint for the motion profiled robot angle controller
|
// Constraint for the motion profiled robot angle controller
|
||||||
public static final TrapezoidProfile.Constraints kThetaControllerConstraints = new TrapezoidProfile.Constraints(
|
public static final TrapezoidProfile.Constraints kThetaControllerConstraints = new TrapezoidProfile.Constraints(
|
||||||
|
@ -22,10 +22,17 @@ public class DrivetrainConstants {
|
|||||||
public static final double kWheelBase = Units.inchesToMeters(24.5);
|
public static final double kWheelBase = Units.inchesToMeters(24.5);
|
||||||
|
|
||||||
// Angular offsets of the modules relative to the chassis in radians
|
// Angular offsets of the modules relative to the chassis in radians
|
||||||
|
/*
|
||||||
public static final double kFrontLeftChassisAngularOffset = Math.PI;
|
public static final double kFrontLeftChassisAngularOffset = Math.PI;
|
||||||
public static final double kFrontRightChassisAngularOffset = -Math.PI / 2;
|
public static final double kFrontRightChassisAngularOffset = -Math.PI / 2;
|
||||||
public static final double kBackLeftChassisAngularOffset = Math.PI / 2;
|
public static final double kBackLeftChassisAngularOffset = Math.PI / 2;
|
||||||
public static final double kBackRightChassisAngularOffset = 0;
|
public static final double kBackRightChassisAngularOffset = 0;
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static final double kFrontLeftChassisAngularOffset = 0;
|
||||||
|
public static final double kFrontRightChassisAngularOffset = Math.PI / 2;
|
||||||
|
public static final double kBackLeftChassisAngularOffset = -Math.PI / 2;
|
||||||
|
public static final double kBackRightChassisAngularOffset = Math.PI;
|
||||||
|
|
||||||
// 1, 7, 10 is the default for these three values
|
// 1, 7, 10 is the default for these three values
|
||||||
public static final double kSysIDDrivingRampRate = 1;
|
public static final double kSysIDDrivingRampRate = 1;
|
||||||
|
@ -47,7 +47,7 @@ public class ModuleConstants {
|
|||||||
|
|
||||||
public static final IdleMode kTurnIdleMode = IdleMode.kBrake;
|
public static final IdleMode kTurnIdleMode = IdleMode.kBrake;
|
||||||
|
|
||||||
public static final InvertedValue kDriveInversionState = InvertedValue.Clockwise_Positive;
|
public static final InvertedValue kDriveInversionState = InvertedValue.CounterClockwise_Positive;
|
||||||
public static final NeutralModeValue kDriveIdleMode = NeutralModeValue.Brake;
|
public static final NeutralModeValue kDriveIdleMode = NeutralModeValue.Brake;
|
||||||
|
|
||||||
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A NEW CONFIGURATION ITEM
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A NEW CONFIGURATION ITEM
|
||||||
|
@ -74,7 +74,7 @@ public class MAXSwerveModule {
|
|||||||
public SwerveModuleState getState() {
|
public SwerveModuleState getState() {
|
||||||
// Apply chassis angular offset to the encoder position to get the position
|
// Apply chassis angular offset to the encoder position to get the position
|
||||||
// relative to the chassis.
|
// relative to the chassis.
|
||||||
return new SwerveModuleState(m_drive.getVelocity().getValueAsDouble(),
|
return new SwerveModuleState(m_drive.getVelocity().getValueAsDouble() * ModuleConstants.kWheelCircumferenceMeters,
|
||||||
new Rotation2d(m_turningEncoder.getPosition() - m_chassisAngularOffset));
|
new Rotation2d(m_turningEncoder.getPosition() - m_chassisAngularOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class MAXSwerveModule {
|
|||||||
public SwerveModulePosition getPosition() {
|
public SwerveModulePosition getPosition() {
|
||||||
// Apply chassis angular offset to the encoder position to get the position
|
// Apply chassis angular offset to the encoder position to get the position
|
||||||
// relative to the chassis.
|
// relative to the chassis.
|
||||||
return new SwerveModulePosition(m_drive.getPosition().getValueAsDouble(),
|
return new SwerveModulePosition(m_drive.getPosition().getValueAsDouble() * ModuleConstants.kWheelCircumferenceMeters,
|
||||||
new Rotation2d(m_turningEncoder.getPosition() - m_chassisAngularOffset));
|
new Rotation2d(m_turningEncoder.getPosition() - m_chassisAngularOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +140,6 @@ public class MAXSwerveModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getTotalDist(){
|
public double getTotalDist(){
|
||||||
return m_drive.getPosition().getValueAsDouble();
|
return m_drive.getPosition().getValueAsDouble() * ModuleConstants.kWheelCircumferenceMeters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user