Skip to content
Open
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
Empty file modified gradlew
100644 → 100755
Empty file.
82 changes: 57 additions & 25 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

package frc.robot;

import frc.robot.subsystems.Intake;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.StartEndCommand;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.subsystems.Elevator;
import frc.robot.subsystems.Shooter;
import frc.robot.subsystems.Funnel;

/**
* This class is where the bulk of the robot should be declared. Since Command-based is a
Expand All @@ -18,10 +21,17 @@
*/
public class RobotContainer {
// The robot's subsystems and commands are defined here...
private final Intake m_intake = new Intake();

private final Shooter m_shooter = new Shooter();

private final Funnel m_funnel = new Funnel();

private final Joystick main_stick = new Joystick(4);

//private final Climber m_climber = new Climber();

private final Elevator m_Elevator = new Elevator();

/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
// Configure the trigger bindings
Expand All @@ -31,39 +41,61 @@ public RobotContainer() {
private void configureBindings() {


new JoystickButton(main_stick, 1)
new JoystickButton(main_stick, 7)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok it might also be worth making like a JoystickButtonConstants file so if we look at this next year, we aren't confused what button is which on the controller

.whileTrue(new StartEndCommand(
() -> m_intake.runMotors(0.4),
() -> m_intake.runMotors(0)));
() -> m_shooter.runMotors(.2),
() -> m_shooter.runMotors(0)));

new JoystickButton(main_stick, 2)
.whileTrue(new StartEndCommand(
() -> m_intake.runMotors(-0.4),
() -> m_intake.runMotors(0)));
new JoystickButton(main_stick, 8)
.onTrue(new InstantCommand(m_funnel::flip));

new JoystickButton(main_stick, 3)
.whileTrue(new StartEndCommand(
() -> m_intake.runMotors(0.9),
() -> m_intake.runMotors(0)));
/*new JoystickButton(main_stick, 9)
.onTrue(new IntantCommand(m_climber::grabDown(2)));

new JoystickButton(main_stick, 4)
.whileTrue(new StartEndCommand(
() -> m_intake.runMotors(-0.9),
() -> m_intake.runMotors(0)));
new JoystickButton(main_stick, 9)
.whileTrue(new StartEndCommand(
() -> m_climber.grabUp(2),
() -> m_climber.afk()));

new JoystickButton(main_stick, 5)
.whileTrue(new StartEndCommand(
() -> m_intake.runWrist(1),
() -> m_intake.runWrist(0)));
new JoystickButton(main_stick, 10){
.whileTrue(new StartEndCommand(
() -> m_climber.runMotors(2),
() -> m_climber.afk()));

new JoystickButton(main_stick, 6)
.whileTrue(new StartEndCommand(
() -> m_intake.runWrist(-1),
() -> m_intake.runWrist(0)));
//button 3
new JoystickButton(main_stick,12)
.onTrue(new StartEndCommand(,
() -> m_climber.afk()));

//upButton
new JoystickButton(main_stick,11)
.whileTrue(new StartEndCommand(
() -> m_climber.grabUp(2),
() -> m_climber.afk()));

//downbutton
new JoystickButton(main_stick,11)
.whileTrue(new StartEndCommand(
() -> m_climber.grabDown(2),
() -> m_climber.afk()));


*/

//i've got this *ding*

//l4 preset
new JoystickButton(main_stick, 9)
.whileTrue(new StartEndCommand(
() -> m_Elevator.l4(),
() -> m_Elevator.afk()));


}
// Schedule `exampleMethodCommand` when the Xbox controller's B button is pressed,
// cancelling on release.
}


/**
* Use this to pass the autonomous command to the main {@link Robot} class.
Expand Down
86 changes: 43 additions & 43 deletions src/main/java/frc/robot/commands/ExampleCommand.java
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
// // 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 frc.robot.commands;

// import frc.robot.subsystems.ExampleSubsystem;
// import edu.wpi.first.wpilibj2.command.Command;

// /** An example command that uses an example subsystem. */
// public class ExampleCommand extends Command {
// @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"})
// private final ExampleSubsystem m_subsystem;

// /**
// * Creates a new ExampleCommand.
// *
// * @param subsystem The subsystem used by this command.
// */
// public ExampleCommand(ExampleSubsystem subsystem) {
// m_subsystem = subsystem;
// // Use addRequirements() here to declare subsystem dependencies.
// addRequirements(subsystem);
// }

// // Called when the command is initially scheduled.
// @Override
// public void 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;
// }
// }
// 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 frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Shooter;

/** An example command that uses an example subsystem. */
public class ExampleCommand extends Command {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commands might be a little out of scope, but you can see some example commands that were used on Reefscape here: https://github.com/FRC-Team-1160/2025-Reefscape/blob/main/src/main/java/frc/robot/SubsystemManager.java

They didn't seem to create their own Command classes, but they combined a set of commands that changed and/or tracked some of the robot's states until it met certain objectives so they could use them for the pathplanner auto.

@SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"})
private final Shooter m_subsystem;

/**
* Creates a new ExampleCommand.
*
* @param subsystem The subsystem used by this command.
*/
public ExampleCommand(Shooter subsystem) {
m_subsystem = subsystem;
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(subsystem);
}

// Called when the command is initially scheduled.
@Override
public void 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;
}
}
34 changes: 34 additions & 0 deletions src/main/java/frc/robot/subsystems/Climber
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is probably freaking out because it's not .java

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package frc.robot.subsystems;

import com.ctre.phoenix6.controls.VoltageOut;
import com.ctre.phoenix6.hardware.TalonFX;
import com.revrobotics.spark.SparkMax;
import com.revrobotics.spark.SparkLowLevel.MotorType;

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

public class Climber extends SubsystemBase {

TalonFX motor_one, motor_two;

public Climber() {
motor_one = new TalonFx(27, /*idk what type our motors are*/);
motor_two = new TalonFX(28, /*idk what type our motors are*/ );
Comment on lines +15 to +16
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know either :)
Also probably during the season, you'll want to either name the ports here clearly (e.g. LeftClimberMotor = 27), or storing these in a Constants file of some kind (e.g. MotorConstants.java)

}

public void grabUp(double volts) {
motor_one.set(volts);
motor_two.set(volts);
}

public void afk(){
motor_one.set(0.5);
motor_two.set(0.5)
}

public void grabDown(double volts) {
motor_one.set(-volts);
motor_two.set(-volts);
}

}
101 changes: 101 additions & 0 deletions src/main/java/frc/robot/subsystems/Elevator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package frc.robot.subsystems;

import com.ctre.phoenix6.controls.VoltageOut;
import com.ctre.phoenix6.hardware.TalonFX;
import com.revrobotics.spark.SparkMax;
import com.revrobotics.spark.SparkLowLevel.MotorType;

import edu.wpi.first.wpilibj.motorcontrol.Talon;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class Elevator extends SubsystemBase {
TalonFx motor_one;
TalonFX motor_two;

//max speed is .05

public Elevator(){
//lmk if these below are errors on the team computer too because
//it might just be my computer being difficult again
motor_one; = new TalonFx(/*port*/);
motor_two; = new TalonFx(/*port*/); //side note (again ikr eyeroll) idk the ports but
//im pretty sure the ones we use are in the constants...
Comment on lines +20 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same idea here - I think since this is a totally separate project and branch, you can choose where you want to store them and name them appropriately

also I think Reefscape's elevator uses just one motor so you can probably just make this one guy


motor_one.setPosition(0);
motor_one.set(.02); //you can change this value if its too slow
// i think...
motor_one.setPosition(0);
motor_two.set(.02);

//most of the stuff is encoder values i believe bc setPosition is
//using rotations
}
//grab values from actual tests from riologs?
double l4value = motor_one.getPositon();
//assuming levels are equidistant
public double l3val = .66*l4value;
public double l2val = .33*l4value;
public double l1val = 0.01;
Comment on lines +34 to +38
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine for now. probably when you do this for reals you'll get the exact values and just set them as constants for this subsystem


public void runMotors(double speed) {
motor_one.set(speed);
motor_two.set(-speed);

}

//making seperate methods for each level so perchance i can set
//one button per each thing
//joystick thing was perchance too ambitious
public void l4(){
motor_one.setPositon(l4value);
motor_two.setPosition(-l4value);
//idk if this works for sure, if the
// motors work in opposite directions th
// en do they do to the same positon but
// just like the opposite? idk.
//gemini said yes 🥹
Comment on lines +52 to +56
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming you configure the motors facing each other and configure them the same, probably...?

also Positon -> Position


}

public void l3(){
motor_one.setPositon(l3value);
motor_two.setPosition(-l3value);
}

public void l2(double l2value){
motor_one.setPositon(l2value);
motor_two.setPosition(-l2value);
}


//i believe zeroeing out the position after each preset might
//make these work and im scared to see what would happen
//if you dont

public void zeroout(){
motor_one.setPosition(0);
motor_one.setPosition(0);
} //if this line has an error for you i genuinely dont know why
//girl bye this bracket is making me go insane
//the class ISN'T supposed to end liek dawg ik
//vscode make sense challenge go!t6y54rt


//my attempt with the joysticks 🫩✌️
//the rest is in robot container where all the controls are
//just fry me already

public void generalmove(velo){
motor_one.setVotlage(velo);
}
//this error above is related to the one on line 77... 🫩
//(insert speed gif)

//also gonna make an "afk" thing that applies constant voltage to perchance
//keep the elevator at the target position like how we did witht eh climber wow
Comment on lines +94 to +95
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try a NeutralOut()

You'd configure the motor in the constructor to "brake" when in neutral (probably have to configure one of these) and then requesting a NeutralOut will probably do what you want.


public void afk(){
if(motor_one.getPositon() < )
}

}
32 changes: 32 additions & 0 deletions src/main/java/frc/robot/subsystems/Funnel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package frc.robot.subsystems;

import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class Funnel extends SubsystemBase {

Servo motor_one, motor_two;
boolean on_off = false;

public Funnel() {
motor_one = new Servo(1);
motor_two = new Servo(2);
}

public void setBoth(double angle, double secondAngle) {
motor_one.setAngle(angle);
motor_two.setAngle(secondAngle);
}

public void flip() {
if (on_off) {
motor_one.setAngle(180.0);
motor_two.setAngle(0);
} else {
motor_one.setAngle(0);
motor_two.setAngle(180.0);
}
on_off = !on_off;
}

}
Loading