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

A lot of new code #1

Merged
merged 34 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
60f1dc5
Intake stops at serializer, and the shooter shoots from the serializer
nolandatall Sep 4, 2024
482a6bb
Added arm code to elevatorsubsystem
samanthanguyen23 Sep 10, 2024
b0983e6
Angle and Height commands added
samanthanguyen23 Sep 10, 2024
155bb89
Merge remote-tracking branch 'origin/Feat/pivot' into elevator
samanthanguyen23 Sep 10, 2024
648b240
SHOOT_AMP command added
samanthanguyen23 Sep 10, 2024
06ee3c5
Moved serializer code from intake to shooter
samanthanguyen23 Sep 10, 2024
0644c0d
Button bound amp height
samanthanguyen23 Sep 10, 2024
802adf7
Merge branch 'feat/elevator' into feat/shooter
NoraZitnick Sep 11, 2024
dc278ff
Added TransferNoteCommand
samanthanguyen23 Sep 11, 2024
3ed4742
Elevator subsystem uses gear ratios and works better
NoraZitnick Sep 11, 2024
c02da34
Changed subsystem of serializer beam break to shooter subsystem
NoraZitnick Sep 11, 2024
f5740da
Serializer to shooter and vise versa code
NoraZitnick Sep 11, 2024
06d11d5
Removed some unused stuff and made shoot command
NoraZitnick Sep 12, 2024
67dc191
Merge branch 'feat/shooter' into feat/elevator
NoraZitnick Sep 12, 2024
c2a8507
Added saftey requirements
NoraZitnick Sep 12, 2024
72fe070
Shooter ready to be tested
NoraZitnick Sep 13, 2024
2fadc5d
Pivot works without cancoder for test
NoraZitnick Sep 13, 2024
8fe2947
Pivot goes up and down for testing
NoraZitnick Sep 13, 2024
e5c9d73
Merge branch 'feat/elevator' into feat/testing-shooter
NoraZitnick Sep 15, 2024
0ad3844
Added feedforward to pivot
NoraZitnick Sep 15, 2024
85b49d3
Formatting
NoraZitnick Sep 15, 2024
0f32cc6
uncomment autos, spotless
audreypj Sep 18, 2024
e1077e8
Merge branch 'feat/testing-shooter' into feat/code-review
audreypj Sep 18, 2024
516fa1c
Intake subsystem/command edits
audreypj Sep 18, 2024
6a6f4e9
shooter subsystem edits
audreypj Sep 18, 2024
f271cba
clearing unnecessary commands
audreypj Sep 18, 2024
2c95e5d
Made the elevator and pivot go down when needed
NoraZitnick Sep 19, 2024
cfb7306
Checked pivot subsystem
NoraZitnick Sep 20, 2024
6018eeb
Pivot edits
NoraZitnick Sep 20, 2024
07be5d2
improve naming, delete some unnecessary stuff, left comments for fixes
audreypj Sep 20, 2024
fb07786
Transferring note in two commands
NoraZitnick Sep 20, 2024
7cfc734
Elevator manual
NoraZitnick Sep 20, 2024
e2262c9
Added manual pivot commands and placeholer trap
NoraZitnick Sep 20, 2024
14564b9
Spotless apply
NoraZitnick Sep 27, 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
Empty file modified gradlew
100644 → 100755
Empty file.
189 changes: 104 additions & 85 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static final class Config {
}

public static final class Drive {
public static final int PIGEON_PORT = 0; // placeholder
public static final int PIGEON_PORT = 0; // FIXME
public static final String SWERVE_CANBUS = "rio"; // placeholder

// max voltage delivered to drivebase
Expand Down Expand Up @@ -118,42 +118,43 @@ public static final class Drive {
public static final class Dims {
// FIXME validate with hardware
public static final double TRACKWIDTH_METERS =
.5207; // 20.5 inches (source: cad) converted to 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 {
Expand Down Expand Up @@ -241,53 +242,49 @@ public static final class Ports {
}

public static final class Modes {
public static final IntakePowers INTAKE = new IntakePowers(.95, .75);
public static final IntakePowers HOLD = new IntakePowers(0, 0d);
public static final IntakePowers REVERSE = new IntakePowers(-.5, -.5);
public static final IntakePowers INTAKE = new IntakePowers(.95);
public static final IntakePowers HOLD = new IntakePowers(0);
public static final IntakePowers REVERSE = new IntakePowers(-.5);
}

public static final boolean IS_BEAMBREAK = true;
}

public static final class Shooter {
public static final class Ports {
public static final int TOP_SHOOTER_MOTOR_PORT = 20;
public static final int BOTTOM_SHOOTER_MOTOR_PORT = 19;
public static final int TOP_SHOOTER_MOTOR_PORT = 0;
public static final int BOTTOM_SHOOTER_MOTOR_PORT = 5;
public static final int ACCELERATOR_MOTOR_PORT = 17;
public static final int BEAM_BREAK_SENSOR_PORT = 8;
}

public static final class Modes {
public static final ShooterSubsystem.ShooterPowers INTAKE =
new ShooterSubsystem.ShooterPowers(76, 1, .15);
new ShooterSubsystem.ShooterPowers(0, 1, 0, 0.5);
public static final ShooterSubsystem.ShooterPowers IDLE =
new ShooterSubsystem.ShooterPowers(0, 0, 0);
new ShooterSubsystem.ShooterPowers(0, 0, 0, 0);
public static final ShooterSubsystem.ShooterPowers RAMP_AMP =
new ShooterSubsystem.ShooterPowers(0, 0, 0, 0);
public static final ShooterSubsystem.ShooterPowers RAMP_SPEAKER =
new ShooterSubsystem.ShooterPowers(76, 1, 0);
public static final ShooterSubsystem.ShooterPowers RAMP_AMP_BACK =
new ShooterSubsystem.ShooterPowers(25, 0.4, 0);
public static final ShooterSubsystem.ShooterPowers RAMP_AMP_FRONT =
new ShooterSubsystem.ShooterPowers(10, 2.5, 0);
new ShooterSubsystem.ShooterPowers(76, 1, 0, 0);
public static final ShooterSubsystem.ShooterPowers SHOOT_SPEAKER =
new ShooterSubsystem.ShooterPowers(76, 1, .5);
public static final ShooterSubsystem.ShooterPowers TARGET_LOCK =
new ShooterSubsystem.ShooterPowers(0, 1, 0);
public static final ShooterSubsystem.ShooterPowers SHOOT_AMP_BACK =
new ShooterSubsystem.ShooterPowers(25, 0.4, .5);
public static final ShooterSubsystem.ShooterPowers SHOOT_AMP_FORWARD =
new ShooterSubsystem.ShooterPowers(8, 2.5, .5);
public static final ShooterSubsystem.ShooterPowers MAINTAIN_VELOCITY =
new ShooterSubsystem.ShooterPowers(40, 1, 0);
public static final ShooterSubsystem.ShooterPowers SHUTTLE =
new ShooterSubsystem.ShooterPowers(30, 1, 0);
new ShooterSubsystem.ShooterPowers(76, 1, .5, 0);
public static final ShooterSubsystem.ShooterPowers SHOOT_AMP =
new ShooterSubsystem.ShooterPowers(0, 0, 0, -1);
public static final ShooterSubsystem.ShooterPowers RAMP_SHUTTLE =
new ShooterSubsystem.ShooterPowers(30, 1, 0, 0);
public static final ShooterSubsystem.ShooterPowers SHOOT_SHUTTLE =
new ShooterSubsystem.ShooterPowers(30, 1, 0.5);
new ShooterSubsystem.ShooterPowers(30, 1, 0.5, 0);
public static final ShooterSubsystem.ShooterPowers ACCEL_SECURE =
new ShooterSubsystem.ShooterPowers(76, 1, 0.5);
new ShooterSubsystem.ShooterPowers(76, 1, 0.5, 0);
public static final ShooterSubsystem.ShooterPowers VARIABLE_VELOCITY =
new ShooterSubsystem.ShooterPowers(30, 1, 0);
new ShooterSubsystem.ShooterPowers(30, 1, 0, 0);
public static final ShooterSubsystem.ShooterPowers SHOOT_VAR =
new ShooterSubsystem.ShooterPowers(30, 1, 0.5);
new ShooterSubsystem.ShooterPowers(30, 1, 0.5, 0);
public static final ShooterSubsystem.ShooterPowers LOAD_SHOOTER =
new ShooterSubsystem.ShooterPowers(0, 0, 0.5, 0.5);
public static final ShooterSubsystem.ShooterPowers UNLOAD_SHOOTER =
new ShooterSubsystem.ShooterPowers(0, 0, -0.5, -0.5);
}

public static final Slot0Configs ROLLER_PID_CONFIG =
Expand Down Expand Up @@ -346,8 +343,9 @@ public static final class Setpoints {
public static final int EPSILON = 2;

public static final double PIVOT_CANCODER_OFFSET = -0.625977 + (0.070139 - 0.031250);
public static final double PIVOT_GEAR_RATIO =
(60 / 8) * (60 / 16) * (72 / 15); // FIXME placeholder values
/** degrees per rotation */
public static final double PIVOT_GEAR_RATIO = 5.33333; // not used
// values
public static final double CENTER_OF_ROBOT_TO_BUMPER = 0.41275;

public static final Pose2d RED_SPEAKER_POSE = new Pose2d(16.45, 5.5, null);
Expand All @@ -367,30 +365,32 @@ public static record VisionSource(String name, Transform3d robotToCamera) {}

public static final List<VisionSource> VISION_SOURCES =
List.of(
/*new VisionSource(
"frontCam",
new Transform3d(
new Translation3d(
-0.305, // front/back
-0.2286, // left/right
-0.2159 // up/down
),
new Rotation3d(
0,
Math.toRadians(30), // angle up/down
Math.toRadians(180)))),
new VisionSource(
"backCam",
new Transform3d(
new Translation3d(
-0.2796, // front/back
-0.2286, // left/right
-0.2159 // up/down
),
new Rotation3d(
0,
Math.toRadians(30), // angle up/down
Math.toRadians(180)))),*/
/*
* new VisionSource(
* "frontCam",
* new Transform3d(
* new Translation3d(
* -0.305, // front/back
* -0.2286, // left/right
* -0.2159 // up/down
* ),
* new Rotation3d(
* 0,
* Math.toRadians(30), // angle up/down
* Math.toRadians(180)))),
* new VisionSource(
* "backCam",
* new Transform3d(
* new Translation3d(
* -0.2796, // front/back
* -0.2286, // left/right
* -0.2159 // up/down
* ),
* new Rotation3d(
* 0,
* Math.toRadians(30), // angle up/down
* Math.toRadians(180)))),
*/
new VisionSource(
"backUpCam",
new Transform3d(
Expand Down Expand Up @@ -565,8 +565,27 @@ public static final class AutoAlign {
public static final double AMP_TARGET_ANGLE = 0;
public static final PathConstraints CONSTRAINTS =
new PathConstraints(3, 3, Units.degreesToRadians(540), Units.degreesToRadians(720));
}

public static class Elevator {
public static final class Ports {
public static final int ARM_MOTOR_PORT = 18;
public static final int ELEVATOR_MOTOR_PORT = 28;
}
public static class Elevator{ //Placeholder elevator constant (update as needed)
public static final double GEAR_RATIO = 0;
/** inches per rotation */
public static final double ELEVATOR_GEAR_RATIO = 0.0906065;
/** FIXME */
public static final double MAX_HEIGHT = 50;
/** FIXME */
public static final double ELEVATOR_FEEDFORWARD = 0.01;
/** FIXME */
public static final double AMP_HEIGHT = 20;

public static final class Arm {
/** FIXME */
public static final double MAX_ANGLE = 50;
/** inches per rotation */
public static final double ARM_GEAR_RATIO = 0.0231481481;
}
}
}
Loading
Loading