Skip to content

Commit

Permalink
Merge branch 'main' into Initial-Pivot
Browse files Browse the repository at this point in the history
  • Loading branch information
mwitcpalek committed Jan 14, 2024
2 parents 275263c + 246bd06 commit fa73e25
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ logs/
ctre_sim/

#Build constants for Gversion (advantage kit)
src/main/java/frc/robot/BuildConstants.java
src/main/java/frc/robot/constants/BuildConstants.java
51 changes: 29 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,42 @@

## CAN Bus

| Subsystem | Type | Talon | ID | Comp PDP | Proto PDP | Motor | Breaker |
| ---------- | -------- | --------------------- | -- | -------- | --------- | ---------- | ------- |
| Drive | SRX | azimuth | 0 | | | 9015 | |
| Drive | SRX | azimuth | 1 | | | 9015 | |
| Drive | SRX | azimuth | 2 | | | 9015 | |
| Drive | SRX | azimuth | 3 | | | 9015 | |
| Drive | FX | drive | 10 | | | kraken | |
| Drive | FX | drive | 11 | | | kraken | |
| Drive | FX | drive | 12 | | | kraken | |
| Drive | FX | drive | 13 | | | kraken | |
| Subsystem | Type | Talon | ID | Comp PDP | Proto PDP | Motor | Breaker |
| --------- | ---- | ---------- | --- | -------- | --------- | ------ | ------- |
| Drive | SRX | azimuth | 0 | | | 9015 | |
| Drive | SRX | azimuth | 1 | | | 9015 | |
| Drive | SRX | azimuth | 2 | | | 9015 | |
| Drive | SRX | azimuth | 3 | | | 9015 | |
| Drive | FX | drive | 10 | | | kraken | |
| Drive | FX | drive | 11 | | | kraken | |
| Drive | FX | drive | 12 | | | kraken | |
| Drive | FX | drive | 13 | | | kraken | |
| Intake | FX | intake | 20 | | | falcon | |
| Magazine | FX | magazine | 25 | | | falcon | |
| Elbow | FX | elbow | 30 | | | falcon | |
| Wrist | SRX | wrist | 35 | | | 9015 | |
| Shooter | FX | leftShoot | 40 | | | falcon | |
| Shooter | FX | rightShoot | 41 | | | falcon | |
| Climb | FX | climb | 50 | | | falcon | |

## Roborio
| Subsystem | Interface | Device |
| --------- | --------- | ------ |
| Drive | USB | NAVX |

## DIO
| Subsystem | name | ID |
| --------- | ---------- | -- |
| Auto | autoSwitch | 0 |
| Auto | autoSwitch | 1 |
| Auto | autoSwitch | 2 |
| Auto | autoSwitch | 3 |
| Auto | autoSwitch | 4 |
| Auto | autoSwitch | 5 |
| | | 6 |
| | | 7 |
| | | 8 |
| | | 9 |
| Subsystem | name | ID |
| --------- | -------------- | --- |
| Auto | autoSwitch | 0 |
| Auto | autoSwitch | 1 |
| Auto | autoSwitch | 2 |
| Auto | autoSwitch | 3 |
| Auto | autoSwitch | 4 |
| Auto | autoSwitch | 5 |
| Robot | eventInterlock | 6 |
| | | 7 |
| | | 8 |
| | | 9 |

## MXP
| Subsystem | name | ID |
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc.robot.constants.BuildConstants;
import frc.robot.constants.RobotConstants;
import org.littletonrobotics.junction.LogFileUtil;
import org.littletonrobotics.junction.LoggedRobot;
import org.littletonrobotics.junction.Logger;
Expand Down Expand Up @@ -46,7 +47,7 @@ public void robotInit() {
Logger.addDataReceiver(new WPILOGWriter());

// Comp robot conditions or not
eventFlag = new DigitalInput(0);
eventFlag = new DigitalInput(RobotConstants.kEventInterlockID);
isEvent = eventFlag.get();
if (isEvent) {
System.setProperty(ContextInitializer.CONFIG_FILE_PROPERTY, "logback-event.xml");
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/frc/robot/constants/BuildConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "crescendo";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 22;
public static final String GIT_SHA = "69bab672834466214710620030b40473e312100c";
public static final String GIT_DATE = "2024-01-14 13:18:52 EST";
public static final int GIT_REVISION = 24;
public static final String GIT_SHA = "275263c2cf20ebcc8399e4a6e015e277703ddab3";
public static final String GIT_DATE = "2024-01-14 14:13:05 EST";
public static final String GIT_BRANCH = "Initial-Pivot";
public static final String BUILD_DATE = "2024-01-14 13:33:55 EST";
public static final long BUILD_UNIX_TIME = 1705257235169L;
public static final String BUILD_DATE = "2024-01-14 14:34:52 EST";
public static final long BUILD_UNIX_TIME = 1705260892998L;
public static final int DIRTY = 1;

private BuildConstants(){}
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/frc/robot/constants/RobotConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package frc.robot.constants;

import edu.wpi.first.wpilibj.RobotController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RobotConstants {
private Logger logger = LoggerFactory.getLogger(this.getClass());
public static String kProtoSerialNumber = "030dbdd8";
public static boolean isCompBot = (!RobotController.getSerialNumber().equals(kProtoSerialNumber));

public static final int kTalonConfigTimeout = 10; // ms

// Joysticks
public static final double kJoystickDeadband = 0.1;

// Roborio ID's
public static final int kMinAutoSwitchID = 0;
public static final int kMaxAutoSwitchID = 5;
public static final int kEventInterlockID = 6;

// Constants Different between Comp and Proto
public static Double kWheelDiameterInches = 3.0;

public RobotConstants() {
if (isCompBot) {
logger.info("Using Comp Robot Constants");
kWheelDiameterInches = CompConstants.kWheelDiameterInches;
} else {
logger.info("Using Proto Robot Constants");
kWheelDiameterInches = ProtoConstants.kWheelDiameterInches;
}
}

public static class CompConstants {
// Drive
public static final Double kWheelDiameterInches = 3.0;
}

public static class ProtoConstants {
// Drive
public static final Double kWheelDiameterInches = 3.0;
}
}
1 change: 0 additions & 1 deletion src/main/java/frc/robot/constants/WristConstants.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package frc.robot.constants;

import com.ctre.phoenix.motorcontrol.can.TalonSRXConfiguration;
import com.ctre.phoenix6.configs.TalonFXConfiguration;

public class WristConstants {
public static final int kWristTalonFxId = 0;
Expand Down
14 changes: 3 additions & 11 deletions src/main/java/frc/robot/subsystems/wrist/WristIOSRX.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

import com.ctre.phoenix.motorcontrol.TalonSRXControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import com.ctre.phoenix6.StatusSignal;
import com.ctre.phoenix6.configs.TalonFXConfiguration;
import com.ctre.phoenix6.configs.TalonFXConfigurator;
import com.ctre.phoenix6.controls.MotionMagicDutyCycle;
import com.ctre.phoenix6.hardware.TalonFX;
import frc.robot.constants.ElbowConstants;
import frc.robot.constants.WristConstants;
import org.slf4j.Logger;
Expand All @@ -27,19 +22,16 @@ public WristIOSRX() {

@Override
public void zero() {
double absolute = wrist.getSensorCollection().getQuadraturePosition() & 0xFFF;
double absolute = wrist.getSensorCollection().getQuadraturePosition() & 0xFFF;
double offset = absolute - WristConstants.kWristZeroTicks;
wrist.setSelectedSensorPosition(offset);
logger.info(
"Abs: {}, Zero Pos: {}, Offset: {}",
absolute,
ElbowConstants.kElbowZeroTicks,
offset);
"Abs: {}, Zero Pos: {}, Offset: {}", absolute, ElbowConstants.kElbowZeroTicks, offset);
}

@Override
public void setPosition(double position) {
wrist.set(TalonSRXControlMode.MotionMagic, position) ;
wrist.set(TalonSRXControlMode.MotionMagic, position);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/wrist/WristSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void setPosition(double position) {
}

public double getPosition() {
return inputs.positionTicks;
return inputs.position;
}

public WristStates getState() {
Expand All @@ -40,7 +40,7 @@ public void setState(WristStates state) {
}

public boolean isFinished() {
return Math.abs(inputs.positionTicks - setpoint) <= WristConstants.kCloseEnoughTicks;
return Math.abs(inputs.position - setpoint) <= WristConstants.kCloseEnoughTicks;
}

public void zero() {
Expand Down

0 comments on commit fa73e25

Please sign in to comment.