// SimGUI: Persistent Values, Preferences, RobotId, then restart Simulation
// changes networktables.json, networktables.json.bck (both Untracked)
// Uncomment the next line, set the desired RobotId, deploy, and then comment the line out
- // RobotId.setRobotId(RobotId.SwerveCompetition);
+
+ RobotId.setRobotId(RobotId.WaffleHouse);
DriveConstants.update(RobotId.getRobotId());
RobotController.setBrownoutVoltage(6.0);
// obtain this robot's identity
import frc.robot.controls.BaseDriverConfig;
import frc.robot.controls.Operator;
import frc.robot.controls.PS5ControllerDriverConfig;
+import frc.robot.subsystems.Intake.Intake;
import frc.robot.subsystems.drivetrain.Drivetrain;
import frc.robot.subsystems.drivetrain.GyroIOPigeon2;
import frc.robot.subsystems.indexer.Spindexer;
// Controllers are defined here
private BaseDriverConfig driver = null;
private Operator operator = null;
+ private Intake intake = null;
/**
* The container for the robot. Contains subsystems, OI devices, and commands.
default:
case WaffleHouse:
+ intake = new Intake();
+
case SwerveCompetition: // AKA "Vantage"
import com.ctre.phoenix6.signals.NeutralModeValue;
import com.revrobotics.spark.config.SparkMaxConfig;
-
+import edu.wpi.first.wpilibj.smartdashboard.Mechanism2d;
+import edu.wpi.first.wpilibj.smartdashboard.MechanismLigament2d;
+import edu.wpi.first.wpilibj.smartdashboard.MechanismRoot2d;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Intake extends SubsystemBase {
+
+ private Mechanism2d mechanism;
+ private MechanismLigament2d mechanismLigament2d;
// set actual IDs
final int rightID = 1;
final int leftID = 2;
private double startingPoint; // this should go in a constants file
private MotionMagicVoltage voltageRequest = new MotionMagicVoltage(0);
+ final MechanismLigament2d extensionLigament;
+ final double kMaxRotations = 37.5;
+ final double kMaxVisualLength = 0.75;
+
public Intake() {
rightMotor = new TalonFX(rightID);
leftMotor = new TalonFX(leftID);
rollerMotor = new TalonFX(rollerID);
+
+
// right motor configs
TalonFXConfiguration Config = new TalonFXConfiguration();
var slot0Configs = Config.Slot0;
SmartDashboard.putData("Extend Intake", new InstantCommand(() -> extend()));
SmartDashboard.putData("Retract Intake", new InstantCommand(() -> retract()));
+
+
+ Mechanism2d mechanism = new Mechanism2d(1.2, 0.6);
+
+ MechanismRoot2d root = mechanism.getRoot("ExtensionRoot", 0.1, 0.3);
+
+ extensionLigament = root.append(new MechanismLigament2d("Extension", 0.0, 0.0)); // horizontal
+
+ SmartDashboard.putData("Extension Mechanism", mechanism);
+
}
}
public void simulationPeriodic(){
+ double percentExtended = getPosition() / kMaxRotations;
+
+ percentExtended = Math.max(0.0, Math.min(1.0, percentExtended));
+ extensionLigament.setLength(percentExtended * kMaxVisualLength);
}
/**