Skip to content

Commit

Permalink
Merge pull request #29 from WHS-FRC-3467/claw-roller
Browse files Browse the repository at this point in the history
Claw roller
  • Loading branch information
Spybh66 authored Feb 3, 2025
2 parents 85833d6 + e648f3c commit b4c9fab
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 179 deletions.
8 changes: 1 addition & 7 deletions src/main/java/frc/robot/Ports.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public class Ports {
// "canivore1");

/* SUBSYSTEM CAN DEVICE IDS */
public static final CanDeviceId SAMPLE_ROLLER = new CanDeviceId(15, "rio");

public static final CanDeviceId TWO_ROLLER_1 = new CanDeviceId(16, "rio");
public static final CanDeviceId TWO_ROLLER_2 = new CanDeviceId(17, "rio");
public static final CanDeviceId CLAW_ROLLER = new CanDeviceId(16, "rio");

public static final CanDeviceId ELEVATOR_MAIN = new CanDeviceId(18, "rio");
public static final CanDeviceId ELEVATOR_FOLLOWER = new CanDeviceId(19, "rio");
Expand All @@ -30,9 +27,6 @@ public class Ports {
public static final CanDeviceId ARM_FOLLOWER = new CanDeviceId(22, "rio");
public static final CanDeviceId ARM_CANCODER = new CanDeviceId(23, "rio");

public static final CanDeviceId PROFROLLER_MAIN = new CanDeviceId(24, "rio");
public static final CanDeviceId PROFROLLER_FOLLOWER = new CanDeviceId(25, "rio");

public static final CanDeviceId CLIMBER = new CanDeviceId(26, "rio");

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems.SampleProfiledRoller;
package frc.robot.subsystems.ClawRoller;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.GenericMotionProfiledSubsystem.GenericMotionProfiledSubsystem;
Expand All @@ -9,13 +9,13 @@

@Setter
@Getter
public class SampleProfiledRoller
extends GenericMotionProfiledSubsystem<SampleProfiledRoller.State> {
public class ClawRoller
extends GenericMotionProfiledSubsystem<ClawRoller.State> {

@RequiredArgsConstructor
@Getter
public enum State implements TargetState {
OFF(0.0, 0.0, ProfileType.OPEN_VOLTAGE),
OFF(0.0, 0.0, ProfileType.OPEN_VOLTAGE), // TODO: tune on real robot
INTAKE(6.0, 0.0, ProfileType.OPEN_VOLTAGE),
EJECT(-6.0, 0.0, ProfileType.OPEN_VOLTAGE),
POSITION(20.0, 0.0, ProfileType.MM_POSITION);
Expand All @@ -29,12 +29,10 @@ public enum State implements TargetState {
@Setter
private State state = State.OFF;

private final boolean debug = true;

/** Constructor */
public SampleProfiledRoller(SampleProfiledRollerIO io, boolean isSim)
public ClawRoller(ClawRollerIO io, boolean isSim)
{
super(ProfileType.OPEN_VOLTAGE, SampleProfiledRollerConstants.kSubSysConstants, io, isSim);
super(ProfileType.OPEN_VOLTAGE, ClawRollerConstants.kSubSysConstants, io, isSim);
}

public Command setStateCommand(State state)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems.SampleProfiledRoller;
package frc.robot.subsystems.ClawRoller;

import com.ctre.phoenix6.signals.FeedbackSensorSourceValue;
import com.ctre.phoenix6.signals.InvertedValue;
Expand All @@ -9,15 +9,15 @@
import frc.robot.subsystems.GenericMotionProfiledSubsystem.GenericMotionProfiledSubsystemConstants.simType;

/** Add your docs here. */
public final class SampleProfiledRollerConstants {
public final class ClawRollerConstants {

public static final GenericMotionProfiledSubsystemConstants kSubSysConstants =
new GenericMotionProfiledSubsystemConstants();

static {
kSubSysConstants.kName = "SampleProfiledRoller";
kSubSysConstants.kName = "ClawRoller";

kSubSysConstants.kLeaderMotor = Ports.PROFROLLER_MAIN;
kSubSysConstants.kLeaderMotor = Ports.CLAW_ROLLER;
kSubSysConstants.kFollowMotor = null;
kSubSysConstants.kFollowerOpposesMain = true;

Expand All @@ -29,20 +29,6 @@ public final class SampleProfiledRollerConstants {
kSubSysConstants.kMotorConfig.Feedback.SensorToMechanismRatio = 1.0;
kSubSysConstants.kMotorConfig.Feedback.RotorToSensorRatio = 1.0;

// Using a remote CANcoder
/*
* kSubSysConstants.kCANcoder = Ports.ARM_CANCODER;
* kSubSysConstants.kMotorConfig.Feedback.FeedbackSensorSource =
* FeedbackSensorSourceValue.FusedCANcoder;
* kSubSysConstants.kMotorConfig.Feedback.SensorToMechanismRatio = 7.04;
* kSubSysConstants.kMotorConfig.Feedback.RotorToSensorRatio = 54.4/7.04;
* kSubSysConstants.kEncoderConfig.MagnetSensor.MagnetOffset = 0.3467;
* kSubSysConstants.kEncoderConfig.MagnetSensor.SensorDirection =
* SensorDirectionValue.Clockwise_Positive;
* kSubSysConstants.kEncoderConfig.MagnetSensor.AbsoluteSensorRange =
* AbsoluteSensorRangeValue.Unsigned_0To1;
*/

kSubSysConstants.kMotorConfig.MotorOutput.NeutralMode = NeutralModeValue.Brake;
kSubSysConstants.kMotorConfig.MotorOutput.Inverted =
InvertedValue.CounterClockwise_Positive;
Expand All @@ -55,7 +41,7 @@ public final class SampleProfiledRollerConstants {
kSubSysConstants.kMotorConfig.CurrentLimits.StatorCurrentLimitEnable = true;

/* REAL system profile constants */
kSubSysConstants.kMotorConfig.Slot0.kP = 0;
kSubSysConstants.kMotorConfig.Slot0.kP = 0; // TODO: tune on real robot
kSubSysConstants.kMotorConfig.Slot0.kI = 0;
kSubSysConstants.kMotorConfig.Slot0.kD = 0;
kSubSysConstants.kMotorConfig.Slot0.kG = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package frc.robot.subsystems.ClawRoller;

import frc.robot.subsystems.GenericMotionProfiledSubsystem.GenericMotionProfiledSubsystemIO;

public interface ClawRollerIO extends GenericMotionProfiledSubsystemIO {
}
12 changes: 12 additions & 0 deletions src/main/java/frc/robot/subsystems/ClawRoller/ClawRollerIOSim.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package frc.robot.subsystems.ClawRoller;

import frc.robot.subsystems.GenericMotionProfiledSubsystem.GenericMotionProfiledSubsystemIOImpl;

public class ClawRollerIOSim extends GenericMotionProfiledSubsystemIOImpl
implements ClawRollerIO {

public ClawRollerIOSim()
{
super(ClawRollerConstants.kSubSysConstants, true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package frc.robot.subsystems.ClawRoller;

import frc.robot.subsystems.GenericMotionProfiledSubsystem.GenericMotionProfiledSubsystemIOImpl;

public class ClawRollerIOTalonFX extends GenericMotionProfiledSubsystemIOImpl
implements ClawRollerIO {

public ClawRollerIOTalonFX()
{
super(ClawRollerConstants.kSubSysConstants, false);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit b4c9fab

Please sign in to comment.