Skip to content

Commit

Permalink
Final comp changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
NRG948DriverStation authored and edreed committed Mar 27, 2024
1 parent 34a92cc commit 6ee2cc7
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 1 deletion.
174 changes: 174 additions & 0 deletions src/main/deploy/pathplanner/autos/XbotAmpSweep.auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"version": 1.0,
"startingPose": {
"position": {
"x": 0.77,
"y": 6.66
},
"rotation": 60.0
},
"command": {
"type": "sequential",
"data": {
"commands": [
{
"type": "named",
"data": {
"name": "ShootSubwooferShot"
}
},
{
"type": "wait",
"data": {
"waitTime": 10.0
}
},
{
"type": "path",
"data": {
"pathName": "Amp Start to Amp Spike"
}
},
{
"type": "race",
"data": {
"commands": [
{
"type": "wait",
"data": {
"waitTime": 2.0
}
},
{
"type": "deadline",
"data": {
"commands": [
{
"type": "named",
"data": {
"name": "IntakeUntilNoteDetected"
}
},
{
"type": "named",
"data": {
"name": "AutoOrientToSpeaker"
}
},
{
"type": "named",
"data": {
"name": "SetShooterContinuous"
}
},
{
"type": "wait",
"data": {
"waitTime": 2.0
}
}
]
}
}
]
}
},
{
"type": "named",
"data": {
"name": "ShootAtCurrentRPM"
}
},
{
"type": "path",
"data": {
"pathName": "Amp Spike to Amp Note"
}
},
{
"type": "race",
"data": {
"commands": [
{
"type": "wait",
"data": {
"waitTime": 2.0
}
},
{
"type": "named",
"data": {
"name": "IntakeUntilNoteDetectedNoAutoCentering"
}
}
]
}
},
{
"type": "path",
"data": {
"pathName": "Amp Note to Amp Farshot"
}
},
{
"type": "race",
"data": {
"commands": [
{
"type": "wait",
"data": {
"waitTime": 2.0
}
},
{
"type": "named",
"data": {
"name": "ShootAmpFarShot"
}
}
]
}
},
{
"type": "path",
"data": {
"pathName": "Amp Farshot to Mid Amp Note"
}
},
{
"type": "race",
"data": {
"commands": [
{
"type": "wait",
"data": {
"waitTime": 3.0
}
},
{
"type": "named",
"data": {
"name": "IntakeUntilNoteDetectedNoAutoCentering"
}
}
]
}
},
{
"type": "path",
"data": {
"pathName": "Mid Amp Note To Amp Farshot"
}
},
{
"type": "named",
"data": {
"name": "ShootAmpFarShot"
}
}
]
}
},
"folder": null,
"choreoAuto": false
}
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj.PowerDistribution.ModuleType;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;

Expand All @@ -23,6 +24,7 @@ public class Robot extends TimedRobot {

private Command autonomousCommand;
PowerDistribution powerDistribution = new PowerDistribution(1, ModuleType.kRev);
private Timer gcTimer = new Timer();

private RobotContainer robotContainer;

Expand All @@ -40,6 +42,7 @@ public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
robotContainer = new RobotContainer();
gcTimer.start();
}

/**
Expand All @@ -57,6 +60,9 @@ public void robotPeriodic() {
// and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();
if (gcTimer.advanceIfElapsed(5)) {
System.gc();
}
}

/** This function is called once each time the robot enters Disabled mode. */
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/frc/robot/subsystems/ClimberSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public class ClimberSubsystem extends SubsystemBase {

private final StatusSignal<Double> rightEncoder = winchRightMotor.getPosition();
private double currentPosition;
private double positionOffset;

/** Creates a new ClimberSubsystem. */
public ClimberSubsystem() {
winchLeftMotor.setInverted(true);
winchRightMotor.setInverted(false);
winchLeftMotor.setNeutralMode(NeutralModeValue.Brake);
winchRightMotor.setNeutralMode(NeutralModeValue.Brake);
resetCurrentPosition();

// TalonFXConfiguration config = new TalonFXConfiguration();
// config.CurrentLimits =
Expand Down Expand Up @@ -70,7 +72,11 @@ public void stopMotors() {
}

public double getCurrentPosition() {
return currentPosition;
return currentPosition - positionOffset;
}

public void resetCurrentPosition() {
positionOffset = rightEncoder.refresh().getValueAsDouble();
}

@Override
Expand Down

0 comments on commit 6ee2cc7

Please sign in to comment.