Skip to content

Commit

Permalink
Merge branch 'develop' into Oscar-Coral-Scorer
Browse files Browse the repository at this point in the history
  • Loading branch information
Team2486 committed Feb 8, 2025
2 parents 39bf9e7 + 600e126 commit 2bee560
Show file tree
Hide file tree
Showing 42 changed files with 869 additions and 361 deletions.
56 changes: 12 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,28 @@
[![CI](https://github.com/AZ-First/Az-RBSI/actions/workflows/main.yml/badge.svg)](https://github.com/AZ-First/Az-RBSI/actions/workflows/main.yml)
[![CI](https://github.com/Coconuts2486-FRC/FRC-2025/actions/workflows/main.yml/badge.svg)](https://github.com/Coconuts2486-FRC/FRC-2025/actions/workflows/main.yml)


![AzFIRST Logo](https://github.com/AZ-First/Az-RBSI/blob/main/AZ-First-logo.png?raw=true)

# Az-RBSI
Arizona's Reference Build and Software Implementation for FRC Robots (read: "A-Z-ribsy")


## Installation

Installation instructions are found in the [INSTALL.md](INSTALL.md) file. See
the [Releases Page](https://github.com/AZ-First/Az-RBSI/releases) for details
on the latest release, including restrictions and cautions.

![Reefscape Logo](https://github.com/AZ-First/Az-RBSI/blob/main/fd_frc_reefscape_patch+frc_rgb.png?raw=true)

## Purpose

The purpose of Az-RBSI is to help Arizona FRC teams with:
* Improving robot reliability / performance during “Autonomous Play”
* Improving robot build & endurance, gameplay reliability and troubleshooting
skills
* Providing a standardized robot “stack” to allow for quick software setup and
troubleshooting, and make it easier for Arizona teams to form effective
in-state alliances
![AzFIRST Logo](https://github.com/AZ-First/Az-RBSI/blob/main/AZ-First-logo.png?raw=true)

# CocoNuts Team 2486 -- 2025 REEFSCAPE Robot Code

## Design Philosophy
Drive base code built on [Az-RBSI](https://github.com/AZ-First/Az-RBSI) produced by Arizona FIRST.

The Az-RBSI is centered around a "Reference Build" robot that allows for teams
to communicate quickly and effectivly with each other about gameplay strategy
and troubleshooting. Additionally, the consolidation around a standard robot
design allows for easier swapping of spare parts and programming modules.
## Robot Name

The Az-RBSI software is an outline of an FRC robot program upon which teams can
build with their particular mechanisms and designs. It weaves together popular
and currently maintained FIRST- and community-sponsored software libraries to
provide a baseline robot functionality that combines robust reliability with
effective logging for troubleshooting.
We haven't named our 2025 robot yet.

## 2025 Competition Schedule

## Library Dependencies
Week 1 - Orange County Regional (Costa Mesa, CA)

* [WPILib](https://docs.wpilib.org/en/stable/index.html) -- FIRST basic libraries
* [AdvantageKit](
https://github.com/Mechanical-Advantage/AdvantageKit/blob/main/docs/WHAT-IS-ADVANTAGEKIT.md)
-- Logging
* [CTRE Phoenix6](
https://v6.docs.ctr-electronics.com/en/stable/docs/api-reference/mechanisms/swerve/swerve-overview.html)
/ [YAGSL](https://yagsl.gitbook.io/yagsl) -- Swerve drive library
* [PathPlanner](https://pathplanner.dev/home.html) / [Choreo](
https://sleipnirgroup.github.io/Choreo/) -- Autonomous path planning
* [PhotonVision](https://docs.photonvision.org/en/latest/) / [Limelight](
https://docs.limelightvision.io/docs/docs-limelight/getting-started/summary)
-- Robot vision / tracking
Week 3 - Arizona North Regional (Flagstaff, AZ)

## Further Reading
Week 6 - South Florida Regional (Miami, FL)

For tips on command-based programming, see this post:
https://bovlb.github.io/frc-tips/commands/best-practices.html
2025 FIRST Championship (Houston, TX)
Binary file added fd_frc_reefscape_patch+frc_rgb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
213 changes: 178 additions & 35 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) 2025 FRC 2486
// http://github.com/Coconuts2486-FRC
// Copyright (c) 2024-2025 Az-FIRST
// http://github.com/AZ-First
//
Expand Down Expand Up @@ -66,7 +68,7 @@ public final class Constants {
* Define the various multiple robots that use this same code (e.g., COMPBOT, DEVBOT, SIMBOT,
* etc.) and the operating modes of the code (REAL, SIM, or REPLAY)
*/
private static RobotType robotType = RobotType.COMPBOT;
private static RobotType robotType = RobotType.GEORGE;

// Define swerve, auto, and vision types being used
// NOTE: Only PHOENIX6 swerve base has been tested at this point!!!
Expand All @@ -80,7 +82,7 @@ public final class Constants {

/** Enumerate the robot types (name your robots here) */
public static enum RobotType {
DEVBOT, // Development / Alpha / Practice Bot
GEORGE, // Development / Alpha / Practice Bot
COMPBOT, // Competition robot
SIMBOT // Simulated robot
}
Expand Down Expand Up @@ -137,7 +139,7 @@ public static final class DrivebaseConstants {
// Theoretical free speed (m/s) at 12v applied output;
// IMPORTANT: Follow the AdvantageKit instructions for measuring the ACTUAL maximum linear speed
// of YOUR ROBOT, and replace the estimate here with your measured value!
public static final double kMaxLinearSpeed = Units.feetToMeters(18); // 18);
public static final double kMaxLinearSpeed = Units.feetToMeters(18);

// Set 3/4 of a rotation per second as the max angular velocity (radians/sec)
public static final double kMaxAngularSpeed = 1.5 * Math.PI;
Expand Down Expand Up @@ -168,38 +170,138 @@ public static final class DrivebaseConstants {
public static final double kSteerD = 1.0;
}

/** Example Flywheel Mechanism Constants ********************************* */
public static final class FlywheelConstants {
/** Elevator Subsystem Constants ***************************************** */
public static final class ElevatorConstants {

// Mechanism idle mode
public static final MotorIdleMode kFlywheelIdleMode = MotorIdleMode.COAST; // BRAKE, COAST
// Idle Mode
public static final MotorIdleMode kElevatorIdle = MotorIdleMode.BRAKE; // BRAKE, COAST

// Mechanism motor gear ratio
public static final double kFlywheelGearRatio = 1.5;
// Gear Ratio
public static final double kElevatorGearRatio = 10.0;

// MODE == REAL / REPLAY
// Feedforward constants
// mode real/replay
public static final double kStaticGainReal = 0.1;
public static final double kVelocityGainReal = 0.05;
// Feedback (PID) constants
public static final PIDConstants pidReal = new PIDConstants(1.0, 0.0, 0.0);

// MODE == SIM
// Feedforward constants
public static final double kStaticGainSim = 0.0;
public static final double kVelocityGainSim = 0.03;
// Feedback (PID) constants
public static final PIDConstants pidSim = new PIDConstants(1.0, 0.0, 0.0);
// motor configs
public static final double kGReal = 0.3375;
public static final double kSReal = 0.075;
public static final double kVReal = 0.0018629;
public static final double kAReal = 0; // 0.000070378;
// ka kv values found from putting elevator at a perfect 90 degree and running sys id
public static final double kPReal = 17.983;
public static final double kIReal = 0;
public static final double kDReal = 0;

// mode sim
public static final double kStaticGainSim = 0.1;
public static final double kVelocityGainSim = 0.05;
// motor configs
public static final double kGSim = 0;
public static final double kSSim = 0;
public static final double kVSim = 0;
public static final double kASim = 0;
public static final double kPSim = 0;
public static final double kISim = 0;
public static final double kDSim = 0;

// Motion Magic constants
public static final double kVelocity = 1.4;
public static final double kAcceleration = 2.8;
public static final double kJerk = 0;
}

/** elevator subsystem constants ***************************************** */
public static final class ElevatorConstants {
/** Coral Mechanism Subsystem Constants ********************************** */
public static final class CoralMechConstants {

// Idle Mode
public static final MotorIdleMode kCoralIdle = MotorIdleMode.BRAKE; // BRAKE, COAST

// Gear Ratio
public static final double kCoralGearRatio = 10.0;

// mode real/replay
public static final double kStaticGainReal = 0.1;
public static final double kVelocityGainReal = 0.05;
// motor configs
public static final double kGReal = 0.3375;
public static final double kSReal = 0.075;
public static final double kVReal = 0.0018629;
public static final double kAReal = 0; // 0.000070378;
// ka kv values found from putting elevator at a perfect 90 degree and running sys id
public static final double kPReal = 17.983;
public static final double kIReal = 0;
public static final double kDReal = 0;

// mode sim
public static final double kStaticGainSim = 0.1;
public static final double kVelocityGainSim = 0.05;
// motor configs
public static final double kGSim = 0;
public static final double kSSim = 0;
public static final double kVSim = 0;
public static final double kASim = 0;
public static final double kPSim = 0;
public static final double kISim = 0;
public static final double kDSim = 0;

// Motion Magic constants
public static final double kVelocity = 1.4;
public static final double kAcceleration = 2.8;
public static final double kJerk = 0;
}

/** Intake Subsystem Constants ******************************************* */
public static final class IntakeConstants {

// Idle Mode
public static final MotorIdleMode kIntakePivotIdle = MotorIdleMode.BRAKE; // BRAKE, COAST
public static final MotorIdleMode kIntakeRollerIdle = MotorIdleMode.BRAKE; // BRAKE, COAST

// Gear Ratio
public static final double kIntakePivotGearRatio = 10.0;
public static final double kIntakeRollerGearRatio = 10.0;

// mode real/replay
public static final double kStaticGainReal = 0.1;
public static final double kVelocityGainReal = 0.05;
// motor configs
public static final double kGReal = 0.3375;
public static final double kSReal = 0.075;
public static final double kVReal = 0.0018629;
public static final double kAReal = 0; // 0.000070378;
// ka kv values found from putting elevator at a perfect 90 degree and running sys id
public static final double kPReal = 17.983;
public static final double kIReal = 0;
public static final double kDReal = 0;

// idle mode //6
public static final MotorIdleMode kElevatorIdle = MotorIdleMode.BRAKE;
// mode sim
public static final double kStaticGainSim = 0.1;
public static final double kVelocityGainSim = 0.05;
// motor configs
public static final double kGSim = 0;
public static final double kSSim = 0;
public static final double kVSim = 0;
public static final double kASim = 0;
public static final double kPSim = 0;
public static final double kISim = 0;
public static final double kDSim = 0;

// Motion Magic constants
public static final double kVelocity = 1.4;
public static final double kAcceleration = 2.8;
public static final double kJerk = 0;
}

/** Algae Mechanism Subsystem Constants ********************************** */
public static final class AlgaeMechConstants {

// Idle Mode
public static final MotorIdleMode kAlgaePivotIdle = MotorIdleMode.BRAKE; // BRAKE, COAST
public static final MotorIdleMode kAlgaeRollerIdle = MotorIdleMode.BRAKE; // BRAKE, COAST

// gear ratio
public static final double kElevatorGearRatio = 0.1;
// Gear Ratio
public static final double kAlgaePivotGearRatio = 10.0;
public static final double kAlgaeRollerGearRatio = 10.0;

// mode real/replay
public static final double kStaticGainReal = 0.1;
Expand All @@ -226,7 +328,47 @@ public static final class ElevatorConstants {
public static final double kISim = 0;
public static final double kDSim = 0;

// Magic motion constants
// Motion Magic constants
public static final double kVelocity = 1.4;
public static final double kAcceleration = 2.8;
public static final double kJerk = 0;
}

/** Climb Subsystem Constants ******************************************** */
public static final class ClimbConstants {

// Idle Mode
public static final MotorIdleMode kClimbIdle = MotorIdleMode.BRAKE; // BRAKE, COAST

// Gear Ratio
public static final double kClimbGearRatio = 10.0;

// mode real/replay
public static final double kStaticGainReal = 0.1;
public static final double kVelocityGainReal = 0.05;
// motor configs
public static final double kGReal = 0.3375;
public static final double kSReal = 0.075;
public static final double kVReal = 0.0018629;
public static final double kAReal = 0; // 0.000070378;
// ka kv values found from putting elevator at a perfect 90 degree and running sys id
public static final double kPReal = 17.983;
public static final double kIReal = 0;
public static final double kDReal = 0;

// mode sim
public static final double kStaticGainSim = 0.1;
public static final double kVelocityGainSim = 0.05;
// motor configs
public static final double kGSim = 0;
public static final double kSSim = 0;
public static final double kVSim = 0;
public static final double kASim = 0;
public static final double kPSim = 0;
public static final double kISim = 0;
public static final double kDSim = 0;

// Motion Magic constants
public static final double kVelocity = 1.4;
public static final double kAcceleration = 2.8;
public static final double kJerk = 0;
Expand All @@ -242,14 +384,14 @@ public static class AccelerometerConstants {
public static final Rotation2d kRioOrientation =
switch (getRobot()) {
case COMPBOT -> Rotation2d.fromDegrees(90.);
case DEVBOT -> Rotation2d.fromDegrees(0.);
case GEORGE -> Rotation2d.fromDegrees(0.);
default -> Rotation2d.fromDegrees(0.);
};
// IMU can be one of Pigeon2 or NavX
public static final Rotation2d kIMUOrientation =
switch (getRobot()) {
case COMPBOT -> Rotation2d.fromDegrees(0.);
case DEVBOT -> Rotation2d.fromDegrees(0.);
case GEORGE -> Rotation2d.fromDegrees(0.);
default -> Rotation2d.fromDegrees(0.);
};
}
Expand All @@ -259,7 +401,12 @@ public static class OperatorConstants {

// Joystick Functions
// Set to TRUE for Drive = Left Stick, Turn = Right Stick; else FALSE
public static final boolean kDriveLeftTurnRight = true;
public static final boolean kDriveLeftTurnRight =
switch (getRobot()) {
case GEORGE -> true; // Testing
case COMPBOT -> false; // Kate's preference
case SIMBOT -> true; // Default
};

// Joystick Deadbands
public static final double kDeadband = 0.1;
Expand Down Expand Up @@ -462,10 +609,6 @@ public static class AprilTagConstants {
public enum AprilTagLayoutType {
OFFICIAL("2025-official");

// SPEAKERS_ONLY("2024-speakers"),
// AMPS_ONLY("2024-amps"),
// WPI("2024-wpi");

private AprilTagLayoutType(String name) {
if (Constants.disableHAL) {
layout = null;
Expand Down Expand Up @@ -519,7 +662,7 @@ public static RobotType getRobot() {
/** Get the current robot mode */
public static Mode getMode() {
return switch (robotType) {
case DEVBOT, COMPBOT -> RobotBase.isReal() ? Mode.REAL : Mode.REPLAY;
case GEORGE, COMPBOT -> RobotBase.isReal() ? Mode.REAL : Mode.REPLAY;
case SIMBOT -> Mode.SIM;
};
}
Expand Down
File renamed without changes.
Loading

0 comments on commit 2bee560

Please sign in to comment.