Skip to content

Commit

Permalink
Merge pull request #3 from StuyPulse/se/algae-mech
Browse files Browse the repository at this point in the history
Se/algae mech
  • Loading branch information
Owen-Zeng authored Jan 22, 2025
2 parents 7dea6ca + b9e5417 commit bada46e
Show file tree
Hide file tree
Showing 17 changed files with 617 additions and 3 deletions.
1 change: 1 addition & 0 deletions networktables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
92 changes: 92 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"keyboardJoysticks": [
{
"axisConfig": [
{
"decKey": 65,
"incKey": 68
},
{
"decKey": 87,
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
}
],
"axisCount": 3,
"buttonCount": 4,
"buttonKeys": [
90,
88,
67,
86
],
"povConfig": [
{
"key0": 328,
"key135": 323,
"key180": 322,
"key225": 321,
"key270": 324,
"key315": 327,
"key45": 329,
"key90": 326
}
],
"povCount": 1
},
{
"axisConfig": [
{
"decKey": 74,
"incKey": 76
},
{
"decKey": 73,
"incKey": 75
}
],
"axisCount": 2,
"buttonCount": 4,
"buttonKeys": [
77,
44,
46,
47
],
"povCount": 0
},
{
"axisConfig": [
{
"decKey": 263,
"incKey": 262
},
{
"decKey": 265,
"incKey": 264
}
],
"axisCount": 2,
"buttonCount": 6,
"buttonKeys": [
260,
268,
266,
261,
269,
267
],
"povCount": 0
},
{
"axisCount": 0,
"buttonCount": 0,
"povCount": 0
}
]
}
44 changes: 44 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo",
"/SmartDashboard/Autonomous": "String Chooser",
"/SmartDashboard/algae": "Mechanism2d"
},
"windows": {
"/SmartDashboard/algae": {
"window": {
"visible": true
}
}
}
},
"NetworkTables": {
"transitory": {
"FMSInfo": {
"open": true
},
"LiveWindow": {
"open": true
},
"Shuffleboard": {
"open": true
},
"SmartDashboard": {
"algae": {
"open": true
},
"open": true
}
}
},
"NetworkTables Info": {
"Clients": {
"open": true
},
"Server": {
"open": true
},
"visible": true
}
}
47 changes: 46 additions & 1 deletion src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,37 @@

package com.stuypulse.robot;

import javax.management.openmbean.OpenType;

// Algae Commands
import com.stuypulse.robot.commands.algae.AlgaeGroundPickup;
import com.stuypulse.robot.commands.algae.AlgaeL2;
import com.stuypulse.robot.commands.algae.AlgaeL3;
import com.stuypulse.robot.commands.algae.AlgaeProcessorScore;
import com.stuypulse.robot.commands.algae.AlgaeReefKnockoff;
import com.stuypulse.robot.commands.algae.AlgaeStopRoller;
import com.stuypulse.robot.commands.algae.AlgaeStow;

import com.stuypulse.robot.commands.auton.DoNothingAuton;
import com.stuypulse.robot.constants.Ports;
import com.stuypulse.robot.subsystems.algae.Algae;

import com.stuypulse.stuylib.input.Gamepad;
import com.stuypulse.stuylib.input.gamepads.AutoGamepad;

import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;


public class RobotContainer {

// Gamepads
public final Gamepad driver = new AutoGamepad(Ports.Gamepad.DRIVER);
public final Gamepad operator = new AutoGamepad(Ports.Gamepad.OPERATOR);

// Subsystem
public final Algae algae = Algae.getInstance();

// Autons
private static SendableChooser<Command> autonChooser = new SendableChooser<>();
Expand All @@ -43,7 +58,37 @@ private void configureDefaultCommands() {}
/*** BUTTONS ***/
/***************/

private void configureButtonBindings() {}

private void configureButtonBindings() {
configureDriverBindings();
configureOperatorBindings();
}

private void configureDriverBindings() {}

private void configureOperatorBindings() {

operator.getBottomButton()
.onTrue(new AlgaeStow());

operator.getTopButton()
.onTrue(new AlgaeGroundPickup());

operator.getLeftButton()
.onTrue(new AlgaeL2());

operator.getRightButton()
.onTrue(new AlgaeL3());

operator.getLeftBumper()
.onTrue(new AlgaeProcessorScore());

operator.getRightBumper()
.onTrue(new AlgaeReefKnockoff());

operator.getLeftMenuButton()
.onTrue(new AlgaeStopRoller());
}

/**************/
/*** AUTONS ***/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.constants.Settings;

public class AlgaeGroundPickup extends AlgaeSetPivot {

public AlgaeGroundPickup(){
super(Settings.Algae.GROUND_PICKUP_ANGLE);
algae.acquireUnder();
}
public void initialize(){
super.initialize();
}

}
15 changes: 15 additions & 0 deletions src/main/java/com/stuypulse/robot/commands/algae/AlgaeL2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.constants.Settings;

public class AlgaeL2 extends AlgaeSetPivot {

public AlgaeL2(){
super(Settings.Algae.L2_ANGLE);
algae.acquireUnder();
}

public void initialize(){
super.initialize();
}
}
15 changes: 15 additions & 0 deletions src/main/java/com/stuypulse/robot/commands/algae/AlgaeL3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.constants.Settings;

public class AlgaeL3 extends AlgaeSetPivot {

public AlgaeL3(){
super(Settings.Algae.L3_ANGLE);
algae.acquireOver();
}

public void initialize(){
super.initialize();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.constants.Settings;


public class AlgaeProcessorScore extends AlgaeSetPivot {

public AlgaeProcessorScore(){
super(Settings.Algae.PROCESSOR_ANGLE);

algae.deacquireUnder();
}

public void initialize(){
super.initialize();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.constants.Settings;

public class AlgaeReefKnockoff extends AlgaeSetPivot {

public AlgaeReefKnockoff(){
super(Settings.Algae.REEF_KNOCKOFF_ANGLE);
}

public void initialize(){
super.initialize();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.subsystems.algae.*;

import edu.wpi.first.wpilibj2.command.InstantCommand;

public class AlgaeSetPivot extends InstantCommand {

protected final Algae algae;
private final double angle; //target angle

public AlgaeSetPivot(double angle) {
algae = Algae.getInstance();

this.angle = angle;
addRequirements(algae);
}

@Override
public void initialize() {
algae.setTargetAngle(angle);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.subsystems.algae.*;

import edu.wpi.first.wpilibj2.command.InstantCommand;

public class AlgaeStopRoller extends InstantCommand {

private final Algae algae;

public AlgaeStopRoller() {
algae = Algae.getInstance();

addRequirements(algae);
}

@Override
public void initialize() {
algae.stopRollers();
}

}
10 changes: 10 additions & 0 deletions src/main/java/com/stuypulse/robot/commands/algae/AlgaeStow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.stuypulse.robot.commands.algae;

import com.stuypulse.robot.constants.Settings;

public class AlgaeStow extends AlgaeSetPivot {

public AlgaeStow() {
super(Settings.Algae.STOW_ANGLE);
}
}
7 changes: 6 additions & 1 deletion src/main/java/com/stuypulse/robot/constants/Ports.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public interface Gamepad {
int OPERATOR = 1;
int DEBUGGER = 2;
}
}

public interface Algae {
int ROLLER_ID = 0; // update ports later -- def won't be 0
int PIVOT_ID = 1; // update ports later
}
}
Loading

0 comments on commit bada46e

Please sign in to comment.