mirror of
https://github.com/Team4388/2023WayOfTheRobot.git
synced 2026-06-09 08:38:02 -06:00
I, Aarav Shah, endorse war crimes in various 3rd world countries
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
package frc4388.robot;
|
package frc4388.robot;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj.PWM;
|
import edu.wpi.first.wpilibj.PWM;
|
||||||
|
import edu.wpi.first.wpilibj.Servo;
|
||||||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||||
@@ -17,6 +18,7 @@ import frc4388.robot.Constants.*;
|
|||||||
import frc4388.robot.commands.AutoBalance;
|
import frc4388.robot.commands.AutoBalance;
|
||||||
import frc4388.robot.commands.JoystickPlayback;
|
import frc4388.robot.commands.JoystickPlayback;
|
||||||
import frc4388.robot.subsystems.Arm;
|
import frc4388.robot.subsystems.Arm;
|
||||||
|
import frc4388.robot.subsystems.Claw;
|
||||||
import frc4388.robot.subsystems.SwerveDrive;
|
import frc4388.robot.subsystems.SwerveDrive;
|
||||||
import frc4388.robot.commands.JoystickRecorder;
|
import frc4388.robot.commands.JoystickRecorder;
|
||||||
import frc4388.robot.commands.PlaybackChooser;
|
import frc4388.robot.commands.PlaybackChooser;
|
||||||
@@ -43,6 +45,8 @@ public class RobotContainer {
|
|||||||
|
|
||||||
public final Arm m_robotArm = new Arm(m_robotMap.pivot, m_robotMap.tele, m_robotMap.pivotEncoder);
|
public final Arm m_robotArm = new Arm(m_robotMap.pivot, m_robotMap.tele, m_robotMap.pivotEncoder);
|
||||||
|
|
||||||
|
public final Claw m_robotClaw = new Claw(m_robotMap.servo);
|
||||||
|
|
||||||
/* Controllers */
|
/* Controllers */
|
||||||
private final DeadbandedXboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
private final DeadbandedXboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
||||||
private final DeadbandedXboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
|
private final DeadbandedXboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||||
@@ -135,14 +139,22 @@ public class RobotContainer {
|
|||||||
|
|
||||||
// * Operator Buttons
|
// * Operator Buttons
|
||||||
|
|
||||||
|
// TODO: use the claw subsystem
|
||||||
new JoystickButton(getDeadbandedOperatorController(), XboxController.X_BUTTON)
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.X_BUTTON)
|
||||||
.onTrue(new InstantCommand(() -> {
|
.onTrue(new InstantCommand(() -> {
|
||||||
servo.setRaw(servo_open ? 1000 : 2000);
|
servo.setRaw(servo_open ? 1000 : 2000);
|
||||||
servo_open = !servo_open;
|
servo_open = !servo_open;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.X_BUTTON)
|
||||||
|
.onTrue(new InstantCommand(() -> m_robotClaw.setClaw(servo_open)));
|
||||||
|
servo_open = !servo_open;
|
||||||
|
|
||||||
new JoystickButton(getDeadbandedOperatorController(), XboxController.A_BUTTON)
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.A_BUTTON)
|
||||||
.onTrue(new InstantCommand(() -> m_robotArm.resetTeleSoftLimit()));
|
.onTrue(new InstantCommand(() -> m_robotArm.resetTeleSoftLimit(), m_robotArm));
|
||||||
|
|
||||||
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.LEFT_BUMPER_BUTTON)
|
||||||
|
.onTrue(new InstantCommand(() -> {}, m_robotArm, m_robotSwerveDrive /* claw */));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
|||||||
import com.ctre.phoenix.sensors.CANCoder;
|
import com.ctre.phoenix.sensors.CANCoder;
|
||||||
import com.ctre.phoenix.sensors.WPI_Pigeon2;
|
import com.ctre.phoenix.sensors.WPI_Pigeon2;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.PWM;
|
||||||
import frc4388.robot.Constants.ArmConstants;
|
import frc4388.robot.Constants.ArmConstants;
|
||||||
import frc4388.robot.Constants.SwerveDriveConstants;
|
import frc4388.robot.Constants.SwerveDriveConstants;
|
||||||
import frc4388.robot.subsystems.SwerveModule;
|
import frc4388.robot.subsystems.SwerveModule;
|
||||||
@@ -160,4 +161,8 @@ public class RobotMap {
|
|||||||
tele.configForwardSoftLimitEnable(false);
|
tele.configForwardSoftLimitEnable(false);
|
||||||
tele.configReverseSoftLimitEnable(false);
|
tele.configReverseSoftLimitEnable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// claw stuff (i will punch someone)
|
||||||
|
PWM servo = new PWM(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// Copyright (c) FIRST and other WPILib contributors.
|
||||||
|
// Open Source Software; you can modify and/or share it under the terms of
|
||||||
|
// the WPILib BSD license file in the root directory of this project.
|
||||||
|
|
||||||
|
package frc4388.robot.commands;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
import frc4388.robot.subsystems.Arm;
|
||||||
|
import frc4388.robot.subsystems.Claw;
|
||||||
|
|
||||||
|
public class ArmCommand extends PelvicInflammatoryDisease {
|
||||||
|
private Arm arm;
|
||||||
|
private Claw claw;
|
||||||
|
private boolean toggle;
|
||||||
|
|
||||||
|
/** Creates a new ArmCommand. */
|
||||||
|
public ArmCommand(Arm arm, Claw claw, boolean open) {
|
||||||
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
super(0.6, 0, 0, 0);
|
||||||
|
this.arm = arm;
|
||||||
|
this.claw = claw;
|
||||||
|
this.toggle = open;
|
||||||
|
addRequirements(arm, claw);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArmCommand(Arm arm, Claw claw) {
|
||||||
|
this(arm, claw, claw.isClawOpen());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the command is initially scheduled.
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
super.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
|
@Override
|
||||||
|
public void execute() {}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getError() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runWithOutput(double output) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package frc4388.robot.subsystems;
|
package frc4388.robot.subsystems;
|
||||||
import edu.wpi.first.wpilibj.PWM;
|
import edu.wpi.first.wpilibj.PWM;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
|
||||||
public class Claw {
|
public class Claw extends SubsystemBase {
|
||||||
private PWM m_clawMotor;
|
private PWM m_clawMotor;
|
||||||
private boolean m_open = false;
|
private boolean m_open = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user