generated from Team488/FRCRobotTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into SetArmAndShooterInSpeakerCommandGroup
- Loading branch information
Showing
6 changed files
with
136 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 100 additions & 1 deletion
101
src/main/java/competition/electrical_contract/PracticeContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,107 @@ | ||
package competition.electrical_contract; | ||
|
||
import xbot.common.injection.electrical_contract.DeviceInfo; | ||
import xbot.common.injection.swerve.SwerveInstance; | ||
import xbot.common.math.XYPair; | ||
import com.ctre.phoenix.motorcontrol.FeedbackDevice; | ||
import competition.subsystems.pose.PoseSubsystem; | ||
import xbot.common.injection.electrical_contract.CANTalonInfo; | ||
import xbot.common.injection.electrical_contract.DeviceInfo; | ||
import xbot.common.injection.swerve.SwerveInstance; | ||
import xbot.common.math.XYPair; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class PracticeContract extends CompetitionContract { | ||
@Inject | ||
public PracticeContract() {} | ||
public PracticeContract() { | ||
|
||
} | ||
|
||
public boolean isScoocherReady() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isArmReady() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isShooterReady() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isDriveReady() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean areCanCodersReady() { | ||
return true; | ||
} | ||
|
||
|
||
@Override | ||
public DeviceInfo getDriveMotor(SwerveInstance swerveInstance) { | ||
return switch (swerveInstance.label()) { | ||
case "FrontLeftDrive" -> | ||
new DeviceInfo(getDriveControllerName(swerveInstance), 20, false, simulationScalingValue); | ||
case "FrontRightDrive" -> | ||
new DeviceInfo(getDriveControllerName(swerveInstance), 29, false, simulationScalingValue); | ||
case "RearLeftDrive" -> | ||
new DeviceInfo(getDriveControllerName(swerveInstance), 31, false, simulationScalingValue); | ||
case "RearRightDrive" -> | ||
new DeviceInfo(getDriveControllerName(swerveInstance), 39, false, simulationScalingValue); | ||
default -> null; | ||
}; | ||
} | ||
|
||
@Override | ||
public DeviceInfo getSteeringMotor(SwerveInstance swerveInstance) { | ||
double simulationScalingValue = 1.0; | ||
|
||
return switch (swerveInstance.label()) { | ||
case "FrontLeftDrive" -> | ||
new DeviceInfo(getSteeringControllerName(swerveInstance), 28, false, simulationScalingValue); | ||
case "FrontRightDrive" -> | ||
new DeviceInfo(getSteeringControllerName(swerveInstance), 21, false, simulationScalingValue); | ||
case "RearLeftDrive" -> | ||
new DeviceInfo(getSteeringControllerName(swerveInstance), 30, false, simulationScalingValue); | ||
case "RearRightDrive" -> | ||
new DeviceInfo(getSteeringControllerName(swerveInstance), 38, false, simulationScalingValue); | ||
default -> null; | ||
}; | ||
} | ||
|
||
@Override | ||
public DeviceInfo getSteeringEncoder(SwerveInstance swerveInstance) { | ||
double simulationScalingValue = 1.0; | ||
|
||
return switch (swerveInstance.label()) { | ||
case "FrontLeftDrive" -> | ||
new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 51, false, simulationScalingValue); | ||
case "FrontRightDrive" -> | ||
new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 52, false, simulationScalingValue); | ||
case "RearLeftDrive" -> | ||
new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 53, false, simulationScalingValue); | ||
case "RearRightDrive" -> | ||
new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 54, false, simulationScalingValue); | ||
default -> null; | ||
}; | ||
} | ||
|
||
@Override | ||
public XYPair getSwerveModuleOffsets(SwerveInstance swerveInstance) { | ||
return switch (swerveInstance.label()) { | ||
case "FrontLeftDrive" -> new XYPair(15, 15); | ||
case "FrontRightDrive" -> new XYPair(15, -15); | ||
case "RearLeftDrive" -> new XYPair(-15, 15); | ||
case "RearRightDrive" -> new XYPair(-15, -15); | ||
default -> new XYPair(0, 0); | ||
}; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters