Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auton rename #32

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": 1.0,
"startingPose": {
"position": {
"x": 1.55744644822623,
"y": 6.0
},
"rotation": 0
},
"command": {
"type": "sequential",
"data": {
"commands": [
{
"type": "path",
"data": {
"pathName": "Straight-Back"
}
}
]
}
},
"folder": null,
"choreoAuto": false
}
32 changes: 12 additions & 20 deletions src/main/deploy/pathplanner/autos/3-Center-Stays.auto
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,22 @@
"data": {
"commands": [
{
"type": "sequential",
"type": "path",
"data": {
"commands": [
{
"type": "path",
"data": {
"pathName": "CenterNote-Center"
}
}
]
"pathName": "CenterNote-Center"
}
},
{
"type": "named",
"data": {
"name": "Intake"
}
},
{
"type": "named",
"data": {
"name": "Spin up Shooter"
}
}
]
}
Expand All @@ -52,24 +51,17 @@
{
"type": "named",
"data": {
"name": "Shoot"
"name": "Outtake"
}
},
{
"type": "deadline",
"data": {
"commands": [
{
"type": "sequential",
"type": "path",
"data": {
"commands": [
{
"type": "path",
"data": {
"pathName": "LeftNote-Center"
}
}
]
"pathName": "LeftNote-Center"
}
},
{
Expand All @@ -90,7 +82,7 @@
{
"type": "named",
"data": {
"name": "Shoot"
"name": "Outtake"
}
}
]
Expand Down
45 changes: 15 additions & 30 deletions src/main/deploy/pathplanner/autos/4-Center-Stays.auto
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,22 @@
"data": {
"commands": [
{
"type": "sequential",
"type": "path",
"data": {
"commands": [
{
"type": "path",
"data": {
"pathName": "CenterNote-Center"
}
}
]
"pathName": "CenterNote-Center"
}
},
{
"type": "named",
"data": {
"name": "Intake"
}
},
{
"type": "named",
"data": {
"name": "Spin up Shooter"
}
}
]
}
Expand All @@ -52,24 +51,17 @@
{
"type": "named",
"data": {
"name": "Shoot"
"name": "Outtake"
}
},
{
"type": "deadline",
"data": {
"commands": [
{
"type": "sequential",
"type": "path",
"data": {
"commands": [
{
"type": "path",
"data": {
"pathName": "LeftNote-Center"
}
}
]
"pathName": "LeftNote-Center"
}
},
{
Expand All @@ -90,24 +82,17 @@
{
"type": "named",
"data": {
"name": "Shoot"
"name": "Outtake"
}
},
{
"type": "deadline",
"data": {
"commands": [
{
"type": "sequential",
"type": "path",
"data": {
"commands": [
{
"type": "path",
"data": {
"pathName": "RightNote-Center"
}
}
]
"pathName": "RightNote-Center"
}
},
{
Expand All @@ -128,7 +113,7 @@
{
"type": "named",
"data": {
"name": "Shoot"
"name": "Outtake"
}
}
]
Expand Down
52 changes: 52 additions & 0 deletions src/main/deploy/pathplanner/paths/Straight-Back.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"version": 1.0,
"waypoints": [
{
"anchor": {
"x": 1.55744644822623,
"y": 6.0
},
"prevControl": null,
"nextControl": {
"x": 2.557446448226229,
"y": 6.0
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 4.0,
"y": 6.0
},
"prevControl": {
"x": 3.0,
"y": 6.0
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [],
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0
},
"goalEndState": {
"velocity": 0,
"rotation": 0,
"rotateFast": false
},
"reversed": false,
"folder": null,
"previewStartingState": {
"rotation": 0,
"velocity": 0
},
"useDefaultConstraints": true
}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static final class ShooterConstants {
public static final int kBottomShooterMotorPort = 35;
public static final double kShooterSpeedTop = 0.8;
public static final double kShooterSpeedBottom = 0.9;
public static final double kPreShooterSpeed = 0.4;
public static final double kPrepShooterSpeed = 0.6;
public static final double kShooterOff = 0;

public static final double kShooterOffTime = 0.04;
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public RobotContainer() {
NamedCommands.registerCommand("Shoot",
new SequentialCommandGroup(
new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Shooting, ShooterConstants.kShooterOnTime),
new ParallelDeadlineGroup(new WaitCommand(0.8), new NoteOuttakeCommand(m_intakeSubsystem)),
new ParallelDeadlineGroup(new WaitCommand(0.8), new ParallelDeadlineGroup(new WaitCommand(1), new NoteOuttakeCommand(m_intakeSubsystem))),
new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Off, ShooterConstants.kShooterOffTime)));

NamedCommands.registerCommand("Intake",
Expand All @@ -76,8 +76,16 @@ public RobotContainer() {
new NoteIntakeCommand(m_intakeSubsystem),
new IntakeArmPositionCommand(m_intakeSubsystem, ArmPosition.Retracted)));

NamedCommands.registerCommand("Pre-Speed - 30%",
new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Halfway, 0.01));
NamedCommands.registerCommand("Prep-Speed - 60%",
new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Prep, 0.01));

NamedCommands.registerCommand("Spin up Shooter",
new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Shooting, 0.01));

NamedCommands.registerCommand("Spin down Shooter",
new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Off, 0.01));

NamedCommands.registerCommand("Outtake", new ParallelDeadlineGroup(new WaitCommand(1), new NoteOuttakeCommand(m_intakeSubsystem)));

NamedCommands.registerCommand("Intake in",
new IntakeArmPositionCommand(m_intakeSubsystem, ArmPosition.Retracted));
Expand Down Expand Up @@ -166,7 +174,7 @@ private void configureBindings() {

new JoystickButton(m_driverController, Button.kX.value)
.onTrue(new SequentialCommandGroup(new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Shooting, ShooterConstants.kShooterOnTime),
new NoteOuttakeCommand(m_intakeSubsystem)))
new ParallelDeadlineGroup(new WaitCommand(1), new NoteOuttakeCommand(m_intakeSubsystem))))
.onFalse(new ShooterSetSpeedCommand(m_shooterSubsystem, ShootSpeed.Off, ShooterConstants.kShooterOffTime));

new JoystickButton(m_driverController, Button.kRightBumper.value)
Expand All @@ -186,7 +194,7 @@ private void configureBindings() {
// Outtake, Operator Controller Right Trigger
new Trigger(() -> {
return m_operatorController.getRightTriggerAxis() > 0.5;
}).whileTrue(new NoteOuttakeCommand(m_intakeSubsystem));
}).whileTrue(new ParallelDeadlineGroup(new WaitCommand(1), new NoteOuttakeCommand(m_intakeSubsystem)));

new Trigger(() -> {
return m_operatorController.getLeftTriggerAxis() > 0.5;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/commands/NoteOuttakeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package frc.robot.commands;

import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.IntakeSubsystem;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/frc/robot/subsystems/ShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public void setShootingSpeed(ShootSpeed speed) {
m_topSpeed = ShooterConstants.kShooterSpeedTop;
m_bottomSpeed = ShooterConstants.kShooterSpeedBottom;
break;
case Halfway:
m_topSpeed = ShooterConstants.kPreShooterSpeed;
m_bottomSpeed = ShooterConstants.kPreShooterSpeed;
case Prep:
m_topSpeed = ShooterConstants.kPrepShooterSpeed;
m_bottomSpeed = ShooterConstants.kPrepShooterSpeed;
break;
case Off:
m_topSpeed = 0.0;
Expand All @@ -69,7 +69,7 @@ public void periodic() {

public static enum ShootSpeed {
Shooting,
Halfway,
Prep,
Off
}
}
Loading