Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
d7528f9
Started on the ground intake. Added new contants, two new commands fo…
rake6682 Mar 2, 2024
97d20e4
Ground Intake Subsystem
Andrew-Lam9035 Mar 2, 2024
8eb1a9a
Fixed a few errors in the intake subsystem.
rake6682 Mar 11, 2024
0693fef
fixed errors with moveIntake command
9573maraudertech Mar 13, 2024
e207661
sysID template from examples ported over
9573maraudertech Mar 14, 2024
01ae98a
added back robotcontainer.java, fixed errors with robot.java
julianalg Mar 14, 2024
2497472
fix
Mar 15, 2024
c8a1e84
fixed compiling
Mar 15, 2024
d18f21c
binded "x" to move intake arm
Mar 15, 2024
62f52f0
simplified shooter functions
julianalg Mar 16, 2024
efe2507
new movement
julianalg Mar 16, 2024
99bd699
Changed constants, seeing if it works
Mar 18, 2024
ee09ccf
Added shoot command just to test for controller error
Mar 18, 2024
ae9e2bc
Added constructor
Mar 18, 2024
61c3d4c
Initialized robotcontainer, removed port numbers to mimic prev code
Mar 18, 2024
a646b39
intake
julianalg Mar 18, 2024
c50c46f
Ground Intake Variable Fix
Andrew-Lam9035 Mar 18, 2024
b78a470
hi
Mar 18, 2024
ad6b854
Update IntakeSubsystem motor types
julianalg Mar 18, 2024
cc2e19a
change
julianalg Mar 19, 2024
7c37a9b
intake fix
julianalg Mar 19, 2024
ae61728
changed default function
julianalg Mar 19, 2024
804258a
changed default function
julianalg Mar 19, 2024
bfcc703
Merge pull request #30 from MarauderTech-FRC-9573/updated-shooter
9573maraudertech Mar 19, 2024
fd0988c
replaced tankdrive function with arcade
julianalg Mar 19, 2024
b5a8427
remove safety warnings
julianalg Mar 19, 2024
fb105a0
Revert "remove safety warnings"
rake6682 Mar 19, 2024
b8cda6e
Revert "replaced tankdrive function with arcade"
rake6682 Mar 19, 2024
a72b04c
updated tank drive volts hopefully to do something
rake6682 Mar 19, 2024
183ff7f
added print statements to check how many volts we are inputting to mo…
rake6682 Mar 19, 2024
829fe51
Testing volt drive via button instead of controller joystick
rake6682 Mar 19, 2024
b476e83
readded urcl logger
rake6682 Mar 19, 2024
eddd3fd
added urcl back
Mar 19, 2024
d414a11
started using built in tankdrive function
julianalg Mar 19, 2024
35d75d7
trying to fix tankdrive, commenting out gyro to debug sysid routine
julianalg Mar 19, 2024
0ec0430
troubleshooting tankdrive function, commenting out print statements f…
julianalg Mar 19, 2024
17b7179
Merge branch 'SystemIdentification' of https://github.com/MarauderTec…
julianalg Mar 19, 2024
4563b07
replacing with arcade drive examples
julianalg Mar 19, 2024
d39514b
Added some encoder code to get the position.
Andrew-Lam9035 Mar 19, 2024
cf526bc
sysid routine
julianalg Mar 19, 2024
73a6099
Merge branch 'Ground-Intake-Subsystem' of https://github.com/Marauder…
Andrew-Lam9035 Mar 19, 2024
a80fb69
Update Constants.java
Andrew-Lam9035 Mar 20, 2024
e933712
ah
Mar 20, 2024
7196334
trying to get encoders to work
julianalg Mar 20, 2024
3a2e6da
fix some stuff
Mar 20, 2024
90c93c3
adding routine, troubleshooting encoders
julianalg Mar 20, 2024
d344d7a
fixing ground intake
julianalg Mar 20, 2024
cfcf703
fixing arcade drive, troubleshooting encoders still
julianalg Mar 20, 2024
c5e9f48
adding updated sys id routine
julianalg Mar 20, 2024
0eba446
Revert "sysid routine"
julianalg Mar 20, 2024
03432d8
refactored to use arrays for port numbers
rake6682 Mar 20, 2024
eed6900
LESS
julianalg Mar 20, 2024
665d930
prints out arm position
Mar 20, 2024
606a357
added backwards function of the arm
Mar 20, 2024
7b16aa7
button bindings
Mar 20, 2024
30d5a16
.
julianalg Mar 20, 2024
e232645
fix
Mar 20, 2024
e7a5189
replacing left encoder with right encoder and seeing what happens
julianalg Mar 20, 2024
8a1f631
fix id constants
julianalg Mar 20, 2024
f96da5a
testing
Mar 20, 2024
e278bc7
intake fix
Mar 20, 2024
a180549
fix
Mar 20, 2024
49d4f57
Update Constants.java
Mar 20, 2024
d8557a1
added armSwitch positions
Mar 20, 2024
7c5c0ec
fix
Mar 20, 2024
353b9c8
PID for the arm of the intake subsystem
Mar 20, 2024
8297a3b
setpoint
Mar 20, 2024
8c9f47d
Moved sysId to auto?
rake6682 Mar 20, 2024
a99f8df
fixed build errors due to missing imports
julianalg Mar 21, 2024
0f93f97
changing PID values, debugging
Mar 21, 2024
17456fe
Put smartdashboard stuff in
rake6682 Mar 21, 2024
8ceb722
Merge branch 'SystemIdentification' of https://github.com/MarauderTec…
rake6682 Mar 21, 2024
6170de4
fixexd missing import
julianalg Mar 21, 2024
be84b3e
cleaning up warnings
Mar 21, 2024
d046ed3
sysid for the ground intake. has to be tested
Mar 21, 2024
9412c12
sysId button mappings
Mar 21, 2024
5876035
Revert "PID for the arm of the intake subsystem"
Mar 21, 2024
664980b
removing references to PID, sysID
Mar 21, 2024
ee1d1db
FIX
Mar 21, 2024
ab444ef
FINAL FIX
Mar 21, 2024
02c86d7
Merge branch 'main' into Ground-Intake-Subsystem
Mar 21, 2024
4052177
fixing merge conflict
Mar 21, 2024
601aecc
Merge pull request #25 from MarauderTech-FRC-9573/Ground-Intake-Subsy…
9573maraudertech Mar 21, 2024
56ae28e
removing photonvision references, not using it for regional comp
Mar 21, 2024
15734eb
Merge pull request #32 from MarauderTech-FRC-9573/rip-vision
9573maraudertech Mar 21, 2024
843d698
commit stashed changes
julianalg Mar 21, 2024
7fd3698
commented out left encoder bc it doesn't work
julianalg Mar 21, 2024
79f42e3
trying to remove shuffleboard to see if sysid wont crash
Mar 21, 2024
85b2698
Merge branch 'main' into SystemIdentification
Mar 21, 2024
7e1d765
resolving problems of sysid autonomous
Mar 21, 2024
c1c9416
replacing encoders to use REV motor controller
Mar 21, 2024
aff4754
Revert "replacing encoders to use REV motor controller"
Mar 22, 2024
f73f32d
trying to add missing URCL logging stuff
Mar 22, 2024
db09545
what is Logger????
Mar 22, 2024
581d6fb
Revert "what is Logger????"
Mar 22, 2024
8b3de96
Revert "trying to add missing URCL logging stuff"
Mar 22, 2024
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
1 change: 1 addition & 0 deletions .DataLogTool/datalogtool.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions .SysId/sysid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file removed bin/main/frc/robot/Constants.class
Binary file not shown.
Binary file removed bin/main/frc/robot/Main.class
Binary file not shown.
Binary file removed bin/main/frc/robot/Robot.class
Binary file not shown.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2024.3.1"
id "edu.wpi.first.GradleRIO" version "2024.3.2"
}

dependencies {
Expand Down
3 changes: 0 additions & 3 deletions build/tmp/jar/MANIFEST.MF

This file was deleted.

9 changes: 0 additions & 9 deletions simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@
"open": true
},
"open": true
},
"Shuffleboard": {
".metadata": {
"open": true
},
".recording": {
"open": true
},
"open": true
}
}
},
Expand Down
45 changes: 38 additions & 7 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import edu.wpi.first.math.util.Units;

public final class Constants {

public static final class DriveConstants {

// PWM ports/CAN IDs for motor controllers
Expand Down Expand Up @@ -69,10 +70,9 @@ public static final class DriveConstants {

public static final LinearSystem<N2, N2, N2> kDrivetrainPlant = LinearSystemId.identifyDrivetrainSystem(kvVoltSecondsPerMeter, kaVoltSecondsSquaredPerMeter,kvVoltSecondsPerRadian, kaVoltSecondsSquaredPerRadian);

public static final int[] kLeftLeadEncoderPorts = new int[] {4, 5};
public static final int[] kRightLeadEncoderPorts = new int[] {6, 7};
public static final int[] kLeftFollowEncoderPorts = new int[] {8, 9};
public static final int[] kRightFollowEncoderPorts = new int[] {10, 11};
public static final int[] kLeftLeadEncoderPorts = new int[] {2,3};
public static final int[] kRightLeadEncoderPorts = new int [] {4,5};


public static final boolean kLeftEncoderReversed = false;
public static final boolean kRightEncoderReversed = true;
Expand All @@ -85,7 +85,37 @@ public static final class DriveConstants {

}


// public static final class ShooterConstants {

// public static double kIntakeLauncherSpeed = -3.0;
// public static double kIntakeFeederSpeed = -3.0;
// public static int launchWheelPort = 6;
// public static int intakeWheelPort = 7;
// public static double AmpLaunchWheelSpeed = 3.0;
// public static double AmpFeedWheelSpeed = 3.0;
// public static double SpeakerLaunchWheelSpeed = 6.0;
// public static double SpeakerFeedWheelSpeed = 6.0;


// }

// Intake Constants
public static final class IntakeConstants {

// Motor Speeds
public static double IntakeMotorReleaseSpeed = -0.01;
public static double IntakeMotorReceiveSpeed = 0.01;
public static double ArmMotorMoveForwardSpeed = 0.01;
public static double ArmMotorMoveBackwardSpeed = -0.01;

// Motor ID Ports
public static int IntakeMotorPort = 9;
public static int ArmMotorPort = 8;

}

// OI constants
public static final class OIConstants {

}
Expand Down Expand Up @@ -141,6 +171,8 @@ public static double findTargetHeight(int targetID) {
public static final double GOAL_RANGE_METERS = Units.feetToMeters(3);
public static double CAMERA_PITCH_RADIANS = Units.degreesToRadians(3);

public static final int kAngleSetpoint = 0;

}

public static class FieldConstants {
Expand All @@ -162,8 +194,8 @@ public static final class ShooterConstants {
// in reverse
public static final double kSpeakerLauncherSpeed = -1;
public static final double kSpeakerLaunchFeederSpeed = -1;
public static final double kSpeakerAmpLaunchSpeed = -0.5;
public static final double kSpeakerAmpLaunchFeederSpeed = -0.5;
public static final double kSpeakerAmpLaunchSpeed = -0.3;
public static final double kSpeakerAmpLaunchFeederSpeed = -0.3;
public static final double kIntakeLauncherSpeed = 1;
public static final double kIntakeFeederSpeed = .2;

Expand All @@ -172,5 +204,4 @@ public static final class ShooterConstants {

}


}
13 changes: 12 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

package frc.robot;

import edu.wpi.first.wpilibj.DataLogManager;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import org.littletonrobotics.urcl.URCL;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
* The VM is configured to automatically run this class, and to call the functions corresponding to
Expand All @@ -28,6 +31,12 @@ public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
m_robotContainer = new RobotContainer();

//Log stuff hopefully

DataLogManager.start();
URCL.start();

}

/**
Expand All @@ -44,6 +53,8 @@ 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();
SmartDashboard.putData(CommandScheduler.getInstance());


}

Expand All @@ -62,7 +73,7 @@ public void autonomousInit() {
/** This function is called periodically during autonomous. */
@Override
public void autonomousPeriodic() {
// m_autonomousCommand = m_robotContainer.getAutonomousCommand();
m_autonomousCommand = m_robotContainer.getAutonomousCommand();

if (m_autonomousCommand != null) {
m_autonomousCommand.schedule();
Expand Down
175 changes: 129 additions & 46 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
@@ -1,61 +1,144 @@
// 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;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj.PowerDistribution.ModuleType;
import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.commands.LaunchAmp;
import frc.robot.commands.LaunchSpeaker;
import frc.robot.commands.PrepareLaunchAmp;
import frc.robot.commands.PrepareLaunchSpeaker;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine;
import frc.robot.Constants.DriveConstants;
import frc.robot.subsystems.DriveSubsystem;
import frc.robot.subsystems.IntakeSubsystem;
import frc.robot.subsystems.ShooterSubsystem;
import frc.robot.subsystems.VisionSubsystem;
import frc.robot.Constants.DriveConstants;
import frc.robot.Constants.OIConstants;
import frc.robot.Constants.ShooterConstants;
import frc.robot.commands.TurnToAngle;
import frc.robot.commands.TurnToAngleProfiled;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import frc.robot.subsystems.DriveSubsystem;
import frc.robot.subsystems.IntakeSubsystem;
import frc.robot.subsystems.ShooterSubsystem;
import frc.robot.Constants.DriveConstants;
import edu.wpi.first.wpilibj2.command.InstantCommand;

public class RobotContainer {
private final DriveSubsystem driveSubsystem = new DriveSubsystem();
private final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();
private final ShooterSubsystem shooterSubsystem = new ShooterSubsystem();
private final VisionSubsystem visionSubsystem = new VisionSubsystem();
/**
* This class is where the bulk of the robot should be declared. Since Command-based is a
* "declarative" paradigm, very little robot logic should actually be handled in the {@link Robot}
* periodic methods (other than the scheduler calls). Instead, the structure of the robot (including
* subsystems, commands, and button mappings) should be declared here.
**/

private final CommandXboxController driveController = new CommandXboxController(DriveConstants.driveControllerPort);
private final CommandXboxController operatorController = new CommandXboxController(DriveConstants.operatorControllerPort);
/**
* Use this to define the command that runs during autonomous.
*
* <p>Scheduled during {@link Robot#autonomousInit()}.
*/
import frc.robot.commands.*;

public RobotContainer() {
configureButtonBindings();
driveSubsystem.setDefaultCommand(new RunCommand(() -> driveSubsystem.driveArcade(-driveController.getLeftY(), -driveController.getRightX()), driveSubsystem));
public class RobotContainer {
private final DriveSubsystem driveSubsystem = new DriveSubsystem();
private final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();
private final ShooterSubsystem shooterSubsystem = new ShooterSubsystem();

}

private void configureButtonBindings() {
/*Create an inline sequence to run when the operator presses and holds the A (green) button. Run the PrepareLaunch
* command for 1 seconds and then run the LaunchNote command */
operatorController.a().whileTrue(new PrepareLaunchSpeaker(shooterSubsystem).withTimeout(ShooterConstants.kLauncherDelay).andThen(new LaunchSpeaker(shooterSubsystem)).handleInterrupt(() -> shooterSubsystem.stop()));
operatorController.b().whileTrue(new PrepareLaunchAmp(shooterSubsystem).withTimeout(ShooterConstants.kLauncherDelay).andThen(new LaunchAmp(shooterSubsystem)).handleInterrupt(() -> shooterSubsystem.stop()));

// Set up a binding to run the intake command while the operator is pressing and holding the left Bumper
operatorController.leftBumper().whileTrue(shooterSubsystem.getIntakeCommand());

//New commands from this branch specifically, idk why they were removed
driveController.x().whileTrue(shooterSubsystem.getIntakeCommand());
driveController.y().whileTrue(shooterSubsystem.getLaunchCommand());
private final CommandXboxController driveController = new CommandXboxController(DriveConstants.driveControllerPort);
private final CommandXboxController operatorController = new CommandXboxController(DriveConstants.operatorControllerPort);

private final PowerDistribution pdh = new PowerDistribution(1, ModuleType.kRev);

driveController.rightBumper()
.whileTrue(new InstantCommand(() -> driveSubsystem.setMaxOutput(0.1)))
.whileFalse(new InstantCommand(() -> driveSubsystem.setMaxOutput(1.0)));
private final SendableChooser<Command> m_autoChooser = new SendableChooser<Command>();


}

// public Command getAutonomousCommand() {
// return Autos.exampleAuto(driveSubsystem, driveController);
// }
}


public RobotContainer() {
pdh.setSwitchableChannel(true);
configureButtonBindings();
driveSubsystem.setDefaultCommand(new RunCommand(() -> driveSubsystem.driveArcade(-driveController.getLeftY(), -driveController.getRightX()), driveSubsystem));

}

private void configureButtonBindings() {
/*Create an inline sequence to run when the operator presses and holds the A (green) button. Run the PrepareLaunch
* command for 1 seconds and then run the LaunchNote command */
driveController.a().whileTrue(new LaunchSpeaker(shooterSubsystem));
driveController.b().whileTrue(new LaunchAmp(shooterSubsystem));

// Set up a binding to run the intake command while the operator is pressing and holding the left Bumper
driveController.leftBumper().whileTrue(new IntakeSource(shooterSubsystem));

//New commands from this branch specifically, idk why they were removed

driveController.rightBumper()
.whileTrue(new InstantCommand(() -> driveSubsystem.setMaxOutput(0.1)))
.whileFalse(new InstantCommand(() -> driveSubsystem.setMaxOutput(1.0)));


// Arm Ground Intake Button Bindings
operatorController.leftBumper().whileTrue(new ArmForward(intakeSubsystem).handleInterrupt(() -> intakeSubsystem.stop()));
operatorController.rightBumper().whileTrue(new ArmBackward(intakeSubsystem).handleInterrupt(() -> intakeSubsystem.stop()));

// Intake Ground Intake Button Bindings
operatorController.x().whileTrue(new IntakeReceiver(intakeSubsystem).handleInterrupt(() -> intakeSubsystem.stop()));
operatorController.y().whileTrue(new IntakeReleaser(intakeSubsystem).withTimeout(1).handleInterrupt(() -> intakeSubsystem.stop()));

// FOR SYSID
// m_driverController
// .a().whileTrue(new PrepareLaunchSpeaker(m_shooter).withTimeout(ShooterConstants.kLauncherDelay).andThen(new LaunchSpeaker(m_shooter)).handleInterrupt(() -> m_shooter.stop()));

// m_driverController
// .b().whileTrue(new PrepareLaunchAmp(m_shooter).withTimeout(ShooterConstants.kLauncherDelay).andThen(new LaunchAmp(m_shooter)).handleInterrupt(() -> m_shooter.stop()));

// m_driverController.leftBumper().whileTrue(m_shooter.getIntakeCommand());

// m_driverController.rightBumper()
// .whileTrue(new InstantCommand(() -> m_drive.setMaxOutput(0.1)))
// .whileFalse(new InstantCommand(() -> m_drive.setMaxOutput(1.0)));

// m_driverController
// .a()
// .whileTrue(new WaitCommand(0.1)
// .andThen(new TurnToAngle(90, m_drive).withTimeout(1)));

// // Turn to -90 degrees with a profile when the Circle button is pressed, with a 5 second timeout
// m_driverController
// .b()
// .whileTrue(new WaitCommand(0.1)
// .andThen(new TurnToAngleProfiled(-90, m_drive).withTimeout(1)));


}

public void initializeAutoChooser() {

m_autoChooser.setDefaultOption("Drive forward: ",
new WaitCommand(0.1)
.andThen(new DriveForwardCmd(driveSubsystem, 10, 0.5))
.withTimeout(3)
.andThen(new RunCommand(() -> driveSubsystem.driveArcade(0,0), driveSubsystem)));

m_autoChooser.addOption("SysID Quasistatic Foward(backward): ",
driveSubsystem.sysIdQuasistatic(SysIdRoutine.Direction.kForward));

m_autoChooser.addOption("SysID Quasistatic Backward(real forward): ",
driveSubsystem.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));

m_autoChooser.addOption("SysID Dynamic Foward(backward): ",
driveSubsystem.sysIdDynamic(SysIdRoutine.Direction.kForward));

m_autoChooser.addOption("SysID Dynamic Backward(real forward): ",
driveSubsystem.sysIdDynamic(SysIdRoutine.Direction.kReverse));



}



public Command getAutonomousCommand() {
return m_autoChooser.getSelected();
}
}

37 changes: 37 additions & 0 deletions src/main/java/frc/robot/commands/ArmBackward.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants.IntakeConstants;
import frc.robot.subsystems.IntakeSubsystem;
// IntakeReceiver is for the brush motors to receive the note from the ground.
/*Basicly the same code from the shootersubsystem with different names.
*
*/

public class ArmBackward extends Command {
IntakeSubsystem intakeSubsystem;
public ArmBackward(IntakeSubsystem intakeSubsystem) {
this.intakeSubsystem = intakeSubsystem;
addRequirements(intakeSubsystem);
}

@Override
public void initialize() {
intakeSubsystem.setArmMotor(IntakeConstants.ArmMotorMoveBackwardSpeed);
}

@Override
public void execute() {

}

@Override
public boolean isFinished() {
return false;
}

@Override
public void end(boolean interrupted) {
intakeSubsystem.stop();
}
}
Loading