mirror of
https://github.com/Team4388/2023WayOfTheRobot.git
synced 2026-06-09 00:37:59 -06:00
Merge branch 'master' into auto-placement
This commit is contained in:
@@ -10,7 +10,11 @@ package frc4388.robot;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import edu.wpi.first.math.geometry.Translation2d;
|
import edu.wpi.first.math.geometry.Translation2d;
|
||||||
|
import com.revrobotics.CANSparkMax;
|
||||||
|
import com.revrobotics.REVLibError;
|
||||||
|
import com.revrobotics.CANSparkMax.FaultID;
|
||||||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.ConditionalCommand;
|
import edu.wpi.first.wpilibj2.command.ConditionalCommand;
|
||||||
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||||
@@ -54,7 +58,7 @@ 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);
|
public final Claw m_robotClaw = new Claw(m_robotMap.leftClaw, m_robotMap.rightClaw, m_robotMap.spinnyspin);
|
||||||
|
|
||||||
public final Limelight m_robotLimeLight = new Limelight();
|
public final Limelight m_robotLimeLight = new Limelight();
|
||||||
|
|
||||||
@@ -283,6 +287,12 @@ public class RobotContainer {
|
|||||||
// kill soft limits
|
// kill soft limits
|
||||||
new JoystickButton(getDeadbandedOperatorController(), XboxController.Y_BUTTON) // final
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.Y_BUTTON) // final
|
||||||
.onTrue(new InstantCommand(() -> m_robotArm.killSoftLimits()));
|
.onTrue(new InstantCommand(() -> m_robotArm.killSoftLimits()));
|
||||||
|
|
||||||
|
// SmartDashboard.putBoolean("isn't SparkMAX", );
|
||||||
|
|
||||||
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.RIGHT_BUMPER_BUTTON)
|
||||||
|
.onTrue (new InstantCommand(() -> m_robotClaw.yesspinnyspin()))
|
||||||
|
.onFalse (new InstantCommand(() -> m_robotClaw.nospinnyspin()));
|
||||||
|
|
||||||
//Arm to Home
|
//Arm to Home
|
||||||
new JoystickButton(getDeadbandedOperatorController(), XboxController.LEFT_BUMPER_BUTTON) // final
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.LEFT_BUMPER_BUTTON) // final
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ import com.ctre.phoenix.motorcontrol.NeutralMode;
|
|||||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
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 com.revrobotics.CANSparkMax;
|
||||||
|
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj.PWM;
|
import edu.wpi.first.wpilibj.PWM;
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
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;
|
||||||
@@ -168,6 +171,7 @@ public class RobotMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// claw stuff (WHAT IS A SOAP ENGINEER)
|
// claw stuff (WHAT IS A SOAP ENGINEER)
|
||||||
PWM servo = new PWM(0);
|
PWM leftClaw = new PWM(0);
|
||||||
|
PWM rightClaw = new PWM(1);
|
||||||
}
|
CANSparkMax spinnyspin = new CANSparkMax(18, MotorType.kBrushless);
|
||||||
|
}
|
||||||
@@ -1,21 +1,46 @@
|
|||||||
package frc4388.robot.subsystems;
|
package frc4388.robot.subsystems;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import com.revrobotics.CANSparkMax;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj.PWM;
|
import edu.wpi.first.wpilibj.PWM;
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
|
||||||
public class Claw extends SubsystemBase {
|
public class Claw extends SubsystemBase {
|
||||||
private PWM m_clawMotor;
|
|
||||||
private boolean m_open = false;
|
private final PWM m_leftMotor;
|
||||||
|
private final PWM m_rightMotor;
|
||||||
|
private final CANSparkMax m_spinnyspin;
|
||||||
|
|
||||||
|
private boolean m_open = false;
|
||||||
|
|
||||||
// Opens claw
|
// Opens claw
|
||||||
public Claw(PWM m_clawMotor) {
|
public Claw(PWM leftMotor, PWM rightMotor, CANSparkMax spinnyspin) {
|
||||||
this.m_clawMotor = m_clawMotor;
|
m_leftMotor = leftMotor;
|
||||||
setClaw(true);
|
m_rightMotor = rightMotor;
|
||||||
|
m_spinnyspin = spinnyspin;
|
||||||
|
|
||||||
|
setClaw(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClaw(boolean open) {
|
public void setClaw(boolean open) {
|
||||||
// Open claw
|
// Open claw
|
||||||
m_open = open;
|
m_open = open;
|
||||||
m_clawMotor.setRaw(m_open ? 1000 : 2000);
|
m_leftMotor.setRaw(m_open ? 1000 : 2000);
|
||||||
|
m_rightMotor.setRaw(m_open ? 2000 : 1000);
|
||||||
|
|
||||||
|
if (!m_open) {
|
||||||
|
m_spinnyspin.set(-0.2);
|
||||||
|
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
nospinnyspin();
|
||||||
|
}
|
||||||
|
}, 750);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggle() {
|
public void toggle() {
|
||||||
@@ -26,4 +51,11 @@ public class Claw extends SubsystemBase {
|
|||||||
return m_open;
|
return m_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void yesspinnyspin() {
|
||||||
|
m_spinnyspin.set(0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nospinnyspin() {
|
||||||
|
m_spinnyspin.set(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"fileName": "REVLib.json",
|
||||||
|
"name": "REVLib",
|
||||||
|
"version": "2023.1.3",
|
||||||
|
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://maven.revrobotics.com/"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://software-metadata.revrobotics.com/REVLib-2023.json",
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-java",
|
||||||
|
"version": "2023.1.3"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jniDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-driver",
|
||||||
|
"version": "2023.1.3",
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"isJar": false,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"windowsx86",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cppDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-cpp",
|
||||||
|
"version": "2023.1.3",
|
||||||
|
"libName": "REVLib",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"windowsx86",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-driver",
|
||||||
|
"version": "2023.1.3",
|
||||||
|
"libName": "REVLibDriver",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"windowsx86",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user