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

Cleanup for Final Release #282

Merged
merged 30 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f558b14
Fix units for Drivetrain Pose Estimator
ACat701 Mar 31, 2024
da14a7d
Remove unused imports
ACat701 Apr 6, 2024
93b3457
remove MORE unused imports
Alenguye582 Apr 6, 2024
60fbb4d
Add Back Vision (because it still works)
ACat701 Apr 6, 2024
aba0b99
Merge branch 'health-and-wellness' of https://github.com/FRCTeam3255/…
ACat701 Apr 6, 2024
c8d917b
Clean up autos
ACat701 Apr 6, 2024
dbf73da
reorganized and labeled robot preferences
Alenguye582 Apr 6, 2024
af1f0ce
Merge branch 'health-and-wellness' of https://github.com/FRCTeam3255/…
Alenguye582 Apr 6, 2024
528d049
Update Controller Maps
ACat701 Apr 6, 2024
9eac3b8
Merge branch 'health-and-wellness' of https://github.com/FRCTeam3255/…
ACat701 Apr 6, 2024
3eac693
deleted unused preference....in constants o.O
Alenguye582 Apr 6, 2024
614a25f
removed unused preference
Alenguye582 Apr 6, 2024
e2dea1c
update readme but i can't write :(
Alenguye582 Apr 6, 2024
850151a
Move all inversions to constants
ACat701 Apr 6, 2024
981ef56
Merge branch 'health-and-wellness' of https://github.com/FRCTeam3255/…
ACat701 Apr 6, 2024
4c88e16
Guess who re-implemented vision wrong and then saw this comment
ACat701 Apr 6, 2024
ba70912
Clean RobotContainer
ACat701 Apr 6, 2024
cd87378
Remove the part of the Conventions that we didn't follow + PDH ports
ACat701 Apr 6, 2024
da9c099
Went through all of the preferences (Aside from climber ones)
ACat701 Apr 6, 2024
7075a28
Fix Climber Positioning (Might wanna test this one)
ACat701 Apr 6, 2024
9dc76cd
Almost accidentally removed some controls (crisis adverted)
ACat701 Apr 6, 2024
0de266f
Intake visualization is now properly flipped
ACat701 Apr 6, 2024
6428915
Fix pitch visualization (its so pretty now :D)
ACat701 Apr 6, 2024
5fe3159
Begin updating README with sim photos
ACat701 Apr 6, 2024
90a8a05
added robot features to readme
Alenguye582 Apr 6, 2024
ae23a3f
actually fix the climber
ACat701 Apr 7, 2024
56f761e
Fix the climber IN SIM 🤨
ACat701 Apr 8, 2024
fe033a6
Merge branch 'health-and-wellness' of https://github.com/FRCTeam3255/…
ACat701 Apr 8, 2024
c79da37
Add Simulation Photo
ACat701 Apr 12, 2024
5491a50
Upload 3d model
ACat701 Apr 13, 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
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# FRC Team 3255's 2024 Robot Code
# Shang-Chi - FRC Team 3255's 2024 Robot
Jump into the code [`here!`](src/main/java/frc/robot)

This robot will be competing at the regional level in the following competitions:

Shang-Chi competed at the regional level in the following competitions:
- [Port Hueneme](https://www.thebluealliance.com/event/2024caph)
- [San Diego](https://www.thebluealliance.com/event/2024casd)

## View our Robot in Action!
At the end of qualification matches at SDR, Shang-Chi ranked 2nd of 51 teams. We ultimately placed 4th as the 2nd seeded alliance with [Team 2102 Team Paradox](https://www.thebluealliance.com/team/2102/2024) and [Team 3341 Option 16](https://www.thebluealliance.com/team/3341/2024)!

## View Shang-Chi in Action!
- [Instagram](https://www.instagram.com/frcteam3255/)
- [YouTube (Primary)](https://www.youtube.com/@FRC3255)
- [YouTube (Clips)](https://www.youtube.com/@FRC3255Clips)
Expand All @@ -22,4 +25,9 @@ competitions (depending on region) to qualify for the FIRST Championship in Hous
Interested in learning more about CRESCENDO? Visit [FIRST's website](https://www.firstinspires.org/robotics/frc/game-and-season) for more details!

## Controls
![Controls](src/main/assets/controllerMap2024.png)
![Controllers](src/main/assets/controllerMap2024.png)
![Numpad](src/main/assets/numpadMap2024.png)

## Robot Simulation
![Photo of Shang-Chi in Sim](src/main/assets/simPhoto.png)
Interested in visualizing our code in AdvantageScope? Find our 3d robot model [here](https://drive.google.com/drive/folders/1FDgifq-smxX3cTIWhzZPKftL3REFLVva?usp=sharing)! Download the "Robot_2024_Shang-Chi" folder and follow the official instructions on [importing custom assets into AdvantageScope](https://github.com/Mechanical-Advantage/AdvantageScope/blob/main/docs/CUSTOM-ASSETS.md#custom-assets).
24 changes: 15 additions & 9 deletions simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
{
"axisConfig": [
{
"decKey": 65,
"incKey": 68
"decKey": 65
},
{
"decKey": 87,
"incKey": 83
"decKey": 87
},
{
"decayRate": 0.0,
Expand All @@ -25,13 +23,18 @@
"incKey": 82
}
],
"axisCount": 5,
"buttonCount": 4,
"axisCount": 0,
"buttonCount": 9,
"buttonKeys": [
90,
88,
67,
86
86,
83,
68,
-1,
-1,
-1
],
"povConfig": [
{
Expand All @@ -45,7 +48,7 @@
"key90": 326
}
],
"povCount": 1
"povCount": 0
},
{
"axisConfig": [
Expand Down Expand Up @@ -99,11 +102,14 @@
],
"robotJoysticks": [
{
"guid": "78696e70757401000000000000000000",
"useGamepad": true
},
{
"guid": "78696e70757401000000000000000000",
"useGamepad": true
},
{
"guid": "Keyboard0"
}
]
}
Binary file modified src/main/assets/controllerMap2024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/assets/numpadMap2024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/assets/simPhoto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 6 additions & 48 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
import com.ctre.phoenix6.signals.NeutralModeValue;
import com.ctre.phoenix6.signals.SensorDirectionValue;
import com.frcteam3255.components.swerve.SN_SwerveConstants;
import com.frcteam3255.preferences.SN_BooleanPreference;

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Rotation3d;
import edu.wpi.first.math.geometry.Transform3d;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.math.interpolation.InterpolatingDoubleTreeMap;
import edu.wpi.first.math.util.Units;
import frc.robot.Constants.constDrivetrain.pracBot;

/*
* @formatter:off
Expand All @@ -32,21 +30,12 @@
* | Angle per Time | Degrees per Second |
* | Time | Seconds |
* @formatter:on
*
* If the unit does not fall under any of these types,
* add a JavaDoc for that variable specifying it's unit.
* Avoid specifying units in the variable name.
* Preferences that obviously don't use the above units (ex. PID)
* are exempt from this
*/
public final class Constants {
public static class constClimber {
public static final double GEAR_RATIO = 18.56;
public static final double GEAR_RATIO = 133.0739;
public static final NeutralModeValue NEUTRAL_MODE = NeutralModeValue.Brake;
public static final GravityTypeValue GRAVITY_TYPE = GravityTypeValue.Elevator_Static;

public static final SN_BooleanPreference climberInverted = new SN_BooleanPreference("climberInverted", true);

public static final InvertedValue MOTOR_INVERTED = InvertedValue.Clockwise_Positive;
}

Expand Down Expand Up @@ -120,7 +109,7 @@ public static class pracBot {
SN_SwerveConstants.MK4I.KRAKEN.L3.driveGearRatio,
SN_SwerveConstants.MK4I.KRAKEN.L3.maxSpeedMeters);

public static final InvertedValue DRIVE_MOTOR_INVERT = InvertedValue.CounterClockwise_Positive; // false
public static final InvertedValue DRIVE_MOTOR_INVERT = InvertedValue.CounterClockwise_Positive;
public static final InvertedValue STEER_MOTOR_INVERT = InvertedValue.Clockwise_Positive;
public static final SensorDirectionValue CANCODER_INVERT = SensorDirectionValue.CounterClockwise_Positive;

Expand Down Expand Up @@ -212,14 +201,15 @@ public static final class pracBot {
public static final InterpolatingDoubleTreeMap DISTANCE_MAP = new InterpolatingDoubleTreeMap();

// Comments indicate where we placed the robot directly in line with the SPEAKER
// to get the value
static {
DISTANCE_MAP.put(1.3373, 56.0); // Subwoofer
DISTANCE_MAP.put(2.295, 41.0); // Starting Line
DISTANCE_MAP.put(3.3073, 31.0); // Spike Mark
DISTANCE_MAP.put(4.6173, 25.5); // Mid Wing
DISTANCE_MAP.put(6.2296, 20.6995); // Edge Wing, value sponsored by NOMAD
DISTANCE_MAP.put(6.5973, 19.9); // Mid Centerline
DISTANCE_MAP.put(8.6973, 18.3255); // Edge Centerline, value sponsored by us :)
DISTANCE_MAP.put(8.6973, 18.3255); // Edge Centerline, value sponsored by us :D

// edge of bumper to center of turret = 42.29cm = 0.4229 m
}
Expand Down Expand Up @@ -257,41 +247,7 @@ public static class constRobot {

public static final boolean TUNING_MODE = false;

/**
* Volts
*/
public static final boolean SILENCE_JOYSTICK_WARNINGS = true;

// @formatter:off
/**
* Updated by Alice to match Comp bot Feb. 19
*/
public static final String[] PDH_DEVICES = {
/* 0 */ "Swerve/FL Steer",
/* 1 */ "Swerve/FL Drive",
/* 2 */ "Shooter/Right",
/* 3 */ "Transfer/Feeder",
/* 4 */ "Shooter/Pitch",
/* 5 */ "Transfer/Transfer",
/* 6 */ "Shooter/Left",
/* 7 */ "7 HAS NOTHING!",
/* 8 */ "Swerve/FR Steer",
/* 9 */ "Swerve/FR Drive",
/* 10 */ "Swerve/BR Drive",
/* 11 */ "Swerve/BR Steer",
/* 12 */ "12 HAS NOTHING!",
/* 13 */ "13 HAS NOTHING!",
/* 14 */ "14 HAS NOTHING!",
/* 15 */ "15 HAS NOTHING!",
/* 16 */ "Turret",
/* 17 */ "Swerve/BL Steer",
/* 18 */ "Swerve/BL Drive",
/* 19 */ "Ethernet Switch",
/* 20 */ "Swerve CANCoders & Pigeon",
/* 21 */ "RoboRIO",
/* 22 */ "Radio Power Module",
/* 23 */ "Beelink" };
// @formatter:on
}

public static class constShooter {
Expand All @@ -317,6 +273,8 @@ public static class pracBot {
public static final double ABS_ENCODER_OFFSET = 0.011700;
public static final boolean ABS_ENCODER_INVERT = false;

public static final InvertedValue MOTOR_INVERTED = InvertedValue.CounterClockwise_Positive;

/**
* The amount that the absolute encoder's rotation must surpass before we start
* calculating the angle as negative
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ public void robotPeriodic() {
CommandScheduler.getInstance().run();

// Logging to SmartDashboard
// RobotContainer.logPDHValues();
// RobotContainer.AddVisionMeasurement().schedule();
RobotContainer.updateLoggedPoses();
RobotContainer.AddVisionMeasurement();
SmartDashboard.putString("Current Locked Location", RobotContainer.getLockedLocation().toString());
}

Expand All @@ -81,7 +80,6 @@ public void autonomousInit() {
m_autonomousCommand = m_robotContainer.getAutonomousCommand();

RobotContainer.zeroClimber().schedule();
// RobotContainer.stowIntakePivot().schedule();
if (m_autonomousCommand != null) {
m_autonomousCommand.schedule();
}
Expand All @@ -104,7 +102,6 @@ public void teleopInit() {

if (!hasAutonomousRun) {
RobotContainer.zeroClimber().schedule();
// RobotContainer.stowIntakePivot().schedule();
}
}

Expand Down
Loading