Skip to content

Commit

Permalink
Cleanup for Final Release (#282)
Browse files Browse the repository at this point in the history
* Fix units for Drivetrain Pose Estimator

* Remove unused imports

* remove MORE unused imports

woah all the files are white now :0

* Add Back Vision (because it still works)

* Clean up autos

* reorganized and labeled robot preferences

* Update Controller Maps

* deleted unused preference....in constants o.O

* removed unused preference

also changed a transfer preference to correct preference (they're the same value anyway so i didn't explode anything)

* update readme but i can't write :(

* Move all inversions to constants

* Guess who re-implemented vision wrong and then saw this comment

* Clean RobotContainer

* Remove the part of the Conventions that we didn't follow + PDH ports

* Went through all of the preferences (Aside from climber ones)

* Fix Climber Positioning (Might wanna test this one)

* Almost accidentally removed some controls (crisis adverted)

* Intake visualization is now properly flipped

* Fix pitch visualization (its so pretty now :D)

* Begin updating README with sim photos

* added robot features to readme

aaa

* actually fix the climber

* Fix the climber IN SIM 🤨

* Add Simulation Photo

---------

Co-authored-by: Alena <112772895+Alenguye582@users.noreply.github.com>
  • Loading branch information
ACat701 and Alenguye582 authored Apr 13, 2024
1 parent f7a345f commit f044d95
Show file tree
Hide file tree
Showing 33 changed files with 424 additions and 573 deletions.
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

0 comments on commit f044d95

Please sign in to comment.