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

Comp code with rudimentary Autos and working mechanisms (edit autos before use) #2

Open
wants to merge 54 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3dcb688
Half-finished yourmomsmouth subsystem
samanthanguyen23 Oct 18, 2024
fb94b4a
75% finished yourmomsmouth subsystem
samanthanguyen23 Oct 18, 2024
a3a1913
Tongue subsystem and command started
nolandatall Oct 18, 2024
1789c62
Enguerran thinks it's complete
nolandatall Oct 18, 2024
8c4d9d3
Swerve doesn't turn when it goes straight
NoraZitnick Oct 19, 2024
40be81c
better deadband on joysticks
NoraZitnick Oct 20, 2024
90cda17
Working on the class, trying to fix up the modes and the powers,
nolandatall Oct 21, 2024
e886bfa
In progress
nolandatall Oct 22, 2024
50a1591
finished the intake and outtake mechanisms
samanthanguyen23 Oct 22, 2024
6ae2554
Tongue and all instances renamed
Ith9 Oct 22, 2024
3fcc32e
Zeroing works
samanthanguyen23 Oct 22, 2024
c95c5df
Almost all errors should be fixed
Ith9 Oct 22, 2024
38cf67a
Everything with the modes are fixed now
Ith9 Oct 22, 2024
d064f05
Everything with the modes are fixed now
Ith9 Oct 22, 2024
0b3efc0
Merge remote-tracking branch 'origin/feat/amp' into feat/amp
Ith9 Oct 22, 2024
beb496f
Shoot amp and speaker good
NoraZitnick Oct 22, 2024
ea6799b
New commands created
Ith9 Oct 22, 2024
784239b
Works
NoraZitnick Oct 22, 2024
50ad48c
nora's updated constants
Craptop Oct 23, 2024
d98c83c
Merge branch 'fix/swerve' into feat/integrate-swerve-shooter
Craptop Oct 23, 2024
cb9e137
Driver tuning scalers
Craptop Oct 23, 2024
879bd4b
Changed button bindings
Craptop Oct 23, 2024
1b0f40f
Merge branch 'feat/amp' into feat/integrate-swerve-shooter
Craptop Oct 23, 2024
4085d74
Added auto Paths (going to work on the actual thing in shooter)
nolandatall Oct 23, 2024
69c7eac
Merge remote-tracking branch 'origin/feat/amp' into feat/amp
nolandatall Oct 23, 2024
1824a76
Added autos (CHECK DESCRIPTOINS!!!!!!!!!!!!!!!1121111111)_
nolandatall Oct 23, 2024
45147c2
Merge branch 'feat/integrate-swerve-shooter' into feat/lights
NoraZitnick Oct 23, 2024
0f2ca7c
Merge remote-tracking branch 'origin/feat/amp' into feat/lights
NoraZitnick Oct 23, 2024
0affdaa
Lights work maybe? Need port
NoraZitnick Oct 23, 2024
a171b08
Driver tunnings
Craptop Oct 23, 2024
be777fd
Merge branch 'feat/integrate-swerve-shooter' into feat/lights
Craptop Oct 23, 2024
9e6e042
edits to make work
Craptop Oct 23, 2024
2f2cfc1
Merge branch 'feat/lights' into feat/integrate-swerve-shooter
NoraZitnick Oct 24, 2024
917ef29
Amp shooting forward backward on right trigger.
NoraZitnick Oct 24, 2024
b4b15d7
turning driver requests
audreypj Oct 25, 2024
907902e
Tuning
Craptop Oct 25, 2024
c9c8554
Merge branch 'feat/integrate-swerve-shooter' of https://github.com/Ir…
Craptop Oct 25, 2024
92a2f5c
Tuning drive and amp stuff
Craptop Oct 25, 2024
d04f69a
Merge remote-tracking branch 'origin/feat/shooter' into feat/integrat…
Craptop Oct 25, 2024
45253a5
1shotleave auto
Ith9 Oct 25, 2024
04703c3
Merge remote-tracking branch 'origin/feat/amp' into feat/amp
Ith9 Oct 25, 2024
b9962f1
Trying to fix autos
NoraZitnick Oct 25, 2024
0a5470a
Merge remote-tracking branch 'origin/feat/integrate-swerve-shooter' i…
NoraZitnick Oct 25, 2024
b6b75af
Merge branch 'feat/amp' into feat/integrate-swerve-shooter
Ith9 Oct 25, 2024
fcae969
auto stuff
Ith9 Oct 25, 2024
bac15ed
WIP on feat/integrate-swerve-shooter
Ith9 Oct 25, 2024
542c356
Merge remote-tracking branch 'origin/feat/integrate-swerve-shooter' i…
Ith9 Oct 25, 2024
590a5ca
1shotleaveM auto
Ith9 Oct 25, 2024
c2104c7
1shotonlyshoot auto
Ith9 Oct 25, 2024
9f4be10
Troll auto
Ith9 Oct 25, 2024
8c5a14d
Autos beginning to work
NoraZitnick Oct 25, 2024
8f15971
Merge remote-tracking branch 'origin/feat/integrate-swerve-shooter' i…
NoraZitnick Oct 25, 2024
28d3a9f
Merge branch 'feat/integrate-swerve-shooter' into feat/integrate-auto
NoraZitnick Oct 25, 2024
7f1610e
I do not know what the drive does but ShootAndMoveAwayAuto shoots
NoraZitnick Oct 25, 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
Next Next commit
Half-finished yourmomsmouth subsystem
Yourmomsmouth command + button bindings (UNFINISHED DO NOT BRANCH)
samanthanguyen23 committed Oct 18, 2024
commit 3dcb68826213e7d7a230d68d518629067db93a9e
128 changes: 66 additions & 62 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
@@ -23,24 +23,27 @@

@SuppressWarnings("java:S1118")
/**
* The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean
* constants. This class should not be used for any other purpose. All constants should be declared
* The Constants class provides a convenient place for teams to hold robot-wide
* numerical or boolean
* constants. This class should not be used for any other purpose. All constants
* should be declared
* globally (i.e. public static). Do not put anything functional in this class.
*
* <p>It is advised to statically import this class (or one of its inner classes) wherever the
* <p>
* It is advised to statically import this class (or one of its inner classes)
* wherever the
* constants are needed, to reduce verbosity.
*/
public final class Constants {

public static final class Config {
// maybe tune PID values?
public static final HolonomicPathFollowerConfig PATH_FOLLOWER_CONFIG =
new HolonomicPathFollowerConfig(
new PIDConstants(20, 0, 0),
new PIDConstants(10, 0, 0),
Drive.MAX_VELOCITY_METERS_PER_SECOND,
Math.sqrt(Math.pow(Dims.TRACKWIDTH_METERS, 2) * 2),
new ReplanningConfig());
public static final HolonomicPathFollowerConfig PATH_FOLLOWER_CONFIG = new HolonomicPathFollowerConfig(
new PIDConstants(20, 0, 0),
new PIDConstants(10, 0, 0),
Drive.MAX_VELOCITY_METERS_PER_SECOND,
Math.sqrt(Math.pow(Dims.TRACKWIDTH_METERS, 2) * 2),
new ReplanningConfig());

/** turn this off before comp. */
public static final boolean SHOW_SHUFFLEBOARD_DEBUG_DATA = true;
@@ -51,11 +54,14 @@ public static final class Config {
/** keep this on for pigeon, disable if absolutely necessary */
public static final boolean FLIP_GYROSCOPE = true;

/** def turn this off unless you are using it, generates in excess of 100k rows for a match. */
/**
* def turn this off unless you are using it, generates in excess of 100k rows
* for a match.
*/
public static final boolean WRITE_APRILTAG_DATA = false;

public static final Path APRILTAG_DATA_PATH =
Filesystem.getDeployDirectory().toPath().resolve("poseEstimationsAtDistances.csv");
public static final Path APRILTAG_DATA_PATH = Filesystem.getDeployDirectory().toPath()
.resolve("poseEstimationsAtDistances.csv");
public static final double REAL_X = 0.0;
public static final double REAL_Y = 0.0;
}
@@ -69,63 +75,63 @@ public static final class Drive {
public static final double MAX_VOLTAGE = 12.0;
// maximum velocity
// FIXME measure this value experimentally
public static final double MAX_VELOCITY_METERS_PER_SECOND =
6380.0 // falcon 500 free speed rpm
/ 60.0
* 0.10033
* (1 / 6.12) // mk4i l3 16t falcon drive reduction (sourced from adrian)
* Math.PI;
public static final double MAX_VELOCITY_METERS_PER_SECOND = 6380.0 // falcon 500 free speed rpm
/ 60.0
* 0.10033
* (1 / 6.12) // mk4i l3 16t falcon drive reduction (sourced from adrian)
* Math.PI;
// theoretical value
// FIXME measure and validate experimentally
public static final double MAX_ANGULAR_VELOCITY_RADIANS_PER_SECOND =
MAX_VELOCITY_METERS_PER_SECOND
/ Math.hypot(Dims.TRACKWIDTH_METERS / 2.0, Dims.WHEELBASE_METERS / 2.0)
* .5;
public static final double MAX_ANGULAR_VELOCITY_RADIANS_PER_SECOND = MAX_VELOCITY_METERS_PER_SECOND
/ Math.hypot(Dims.TRACKWIDTH_METERS / 2.0, Dims.WHEELBASE_METERS / 2.0)
* .5;

/** the maximum amount of angular error pid loops will tolerate for rotation */
public static final double ANGULAR_ERROR = 1.0;
/** the minimum magnitude of the right stick for it to be used as a new rotation angle */
/**
* the minimum magnitude of the right stick for it to be used as a new rotation
* angle
*/
public static final double ROTATE_VECTOR_MAGNITUDE = .7;

public static final class Dims {
// FIXME validate with hardware
public static final double TRACKWIDTH_METERS =
.5207; // 20.5 inches (source: cad) converted to meters
public static final double TRACKWIDTH_METERS = .5207; // 20.5 inches (source: cad) converted to meters
public static final double WHEELBASE_METERS = TRACKWIDTH_METERS; // robot is square

public static final double BUMPER_WIDTH_METERS_X = .9779;
public static final double BUMPER_WIDTH_METERS_Y = .8382;
}

/*
module layout:
|──────
|->│# ##steer motor
│ │ ##cancoder
│##drive motor
module number

steer is always left
from corner perspective

robot visualization:
|──────────────────────|
│2 10 04 1│
25 24
│11 S D 03│
│ D S
│ S D
│ D S
│12 |────────| 02│
26 │ │ 27
│3 13│ batt │01 4│
|──────┴───┬┬───┴──────|
││
││
▼▼
software front
* module layout:
* |──────
* |->│# ##steer motor
* │ │ ##cancoder
* │ │##drive motor
* module number
*
* steer is always left
* from corner perspective
*
* robot visualization:
* |──────────────────────|
* │2 10 04 1│
* │ 25 24
* │11 S D 03│
* │ D S
* │
* │
* │ S D
* │ D S
* │12 |────────| 02│
* │ 26 │ │ 27
* │3 13│ batt │01 4│
* |──────┴───┬┬───┴──────|
* ││
* ││
* ▼▼
* software front
*/

public static final class Modules {
@@ -134,14 +140,12 @@ public static final class Params {
public static final double COUPLING_GEAR_RATIO = 3.125;
public static final double DRIVE_GEAR_RATIO = 5.357142857142857;
public static final double STEER_GEAR_RATIO = 21.428571428571427;
public static final Slot0Configs DRIVE_MOTOR_GAINS =
new Slot0Configs().withKP(3).withKI(0).withKD(0).withKS(0.32).withKV(0.11).withKA(0);
public static final Slot0Configs STEER_MOTOR_GAINS =
new Slot0Configs().withKP(11).withKI(0).withKD(0).withKS(0.4).withKV(0.6).withKA(0);
public static final ClosedLoopOutputType DRIVE_CLOSED_LOOP_OUTPUT =
ClosedLoopOutputType.Voltage;
public static final ClosedLoopOutputType STEER_CLOSED_LOOP_OUTPUT =
ClosedLoopOutputType.Voltage;
public static final Slot0Configs DRIVE_MOTOR_GAINS = new Slot0Configs().withKP(3).withKI(0).withKD(0)
.withKS(0.32).withKV(0.11).withKA(0);
public static final Slot0Configs STEER_MOTOR_GAINS = new Slot0Configs().withKP(11).withKI(0).withKD(0)
.withKS(0.4).withKV(0.6).withKA(0);
public static final ClosedLoopOutputType DRIVE_CLOSED_LOOP_OUTPUT = ClosedLoopOutputType.Voltage;
public static final ClosedLoopOutputType STEER_CLOSED_LOOP_OUTPUT = ClosedLoopOutputType.Voltage;
public static final SteerFeedbackType FEEDBACK_SOURCE = SteerFeedbackType.FusedCANcoder;
public static final double SPEED_TWELVE_VOLTS = MAX_VELOCITY_METERS_PER_SECOND;
public static final double SLIP_CURRENT = 0; // optional, unused rn
12 changes: 8 additions & 4 deletions src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
@@ -7,17 +7,21 @@
import edu.wpi.first.wpilibj.RobotBase;

/**
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
* you are doing, do not modify this file except to change the parameter class to the startRobot
* Do NOT add any static variables to this class, or any initialization at all.
* Unless you know what
* you are doing, do not modify this file except to change the parameter class
* to the startRobot
* call.
*/
public final class Main {
private Main() {}
private Main() {
}

/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
* <p>
* If you change your main robot class, change the parameter type.
*/
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
39 changes: 27 additions & 12 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
@@ -10,9 +10,12 @@
import edu.wpi.first.wpilibj2.command.CommandScheduler;

/**
* The VM is configured to automatically run this class, and to call the functions corresponding to
* each mode, as described in the TimedRobot documentation. If you change the name of this class or
* the package after creating this project, you must also update the build.gradle file in the
* The VM is configured to automatically run this class, and to call the
* functions corresponding to
* each mode, as described in the TimedRobot documentation. If you change the
* name of this class or
* the package after creating this project, you must also update the
* build.gradle file in the
* project.
*/
public class Robot extends TimedRobot {
@@ -23,30 +26,39 @@ public class Robot extends TimedRobot {
private boolean matchStartingMethodCalled = false;

/**
* This function is run when the robot is first started up and should be used for any
* This function is run when the robot is first started up and should be used
* for any
* initialization code.
*/
@Override
public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// Instantiate our RobotContainer. This will perform all our button bindings,
// and put our
// autonomous chooser on the dashboard.
robotContainer = new RobotContainer();

LiveWindow.disableAllTelemetry();
}

/**
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
* This function is called every robot packet, no matter the mode. Use this for
* items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and
* test.
*
* <p>This runs after the mode specific periodic functions, but before LiveWindow and
* <p>
* This runs after the mode specific periodic functions, but before LiveWindow
* and
* SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
// Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
// commands, running already-scheduled commands, removing finished or interrupted commands,
// and running subsystem periodic() methods. This must be called from the robot's periodic
// Runs the Scheduler. This is responsible for polling buttons, adding
// newly-scheduled
// commands, running already-scheduled commands, removing finished or
// interrupted commands,
// 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();
}
@@ -62,7 +74,10 @@ public void disabledPeriodic() {
// This method intentionally left empty
}

/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
/**
* This autonomous runs the autonomous command selected by your
* {@link RobotContainer} class.
*/
@Override
public void autonomousInit() {
// trigger the match starting method
Loading