Coder Social home page Coder Social logo

frc-2022-public's Introduction

FRC-2022

Team 254's 2022 FRC robot code for Sideways. Sideways' code is written in Java and is based off of WPILib's Java control system.

The code is divided into several packages, each responsible for a different aspect of the robot function. This README explains setup instructions, the function of each package, and some of the variable naming conventions used. Additional information about each specific class can be found in that class' Java file.

Setup Instructions

General

  1. Clone this repo
  2. Run ./gradlew to download gradle and needed FRC/Vendor libraries
  3. Run ./gradlew tasks to see available options
  4. Enjoy!

Visual Studio Code (Official IDE)

  1. Get the WPILib extension for easiest use from the VSCode Marketplace - Requires Java 11 or greater
  2. In .vscode/settings.json, set the User Setting, java.home, to the correct directory pointing to your JDK 11 directory

IntelliJ

  1. Run ./gradlew idea
  2. Open the FRC-2022-Public.ipr file with IntelliJ

Eclipse

  1. Run ./gradlew eclipse
  2. Open Eclipse and go to File > Open Projects from File System...
  3. Set the import source to the FRC-2022-Public folder then click finish

Basic Gradle Commands

  • Run ./gradlew deploy to deploy to the robot in Terminal (*nix) or Powershell (Windows)
  • Run ./gradlew build to build the code. Use the --info flag for more details
  • Run ./gradlew test to run all of the JUnit tests

Code Highlights

Package Functions

  • com.team254.frc2022

    Contains the robot's central functions and holds a class with all numerical constants used throughout the code (see Constants.java). For example, the Robot class controls all routines depending on the robot mode. In addition, the RobotState class keeps track of the current position of the robot's various frames of reference.

  • com.team254.frc2022.auto

    Handles the execution of autonomous routines and contains the actions and modes packages.

  • com.team254.frc2022.auto.actions

    Contains all actions used during the autonomous period, which all share a common interface, Action (also in this package). Examples include driving paths, auto aiming the turret, and deploying and retracting intakes. Actions interact with the subsystems, which in turn interact with the hardware.

  • com.team254.frc2022.auto.modes

    Contains all autonomous modes. Autonomous modes consist of a list of autonomous actions executed in a specific order.

  • com.team254.frc2022.controlboard

    Contains code for the driver to use either joysticks or gamepad and the operator to use a gamepad. Also contains a wrapper class specifically for Xbox controllers (see XboxController.java).

  • com.team254.frc2022.loops

    Contains codes for loops, which are routines that run periodically on the robot, such as for calculating robot pose, processing vision feedback, or updating subsystems. All loops implement the Loop interface and are handled (started, stopped, added) by the Looper class, which runs at 100 Hz. The Robot class has one main looper, mEnabledLooper, that runs all loops when the robot is enabled.

  • com.team254.frc2022.paths

    Contains the TrajectoryGenerator class which contains the trajectories that the robot drives during autonomous mode. Each Trajectory is composed of a list of Waypoint objects and headings.

  • com.team254.frc2022.planners

    Contains the DriveMotionPlanner class which controls the drivebase as it follows a trajectory during the autonomous period.

  • com.team254.frc2022.shooting

    Contains the ShootingUtil helper class which takes in the current target range and robot state and returns parameters for an ideal shot for both stationary and shooting on the move.

  • com.team254.frc2022.states

    Contains multiple classes representing LED states used in the Superstructure class.

  • com.team254.frc2022.subsystems

    Contains code for subsystems, which are consolidated into one central class per subsystem, all of which extend the Subsystem abstract class. Each subsystem uses state machines for control and is a singleton, meaning that there is only one instance of each. Subsystems also contain an enabled loop, a read periodic inputs method, and a write periodic outputs method, which are controlled by the SubystemManager class.

  • com.team254.lib.control

    Contains classes used for the robot's path following and alternative teleoperated driver modes.

  • com.team254.lib.drivers

    Constains a set of custom classes for motor controllers, color sensors, and solenoids for simplifying motor configuration, reducing CAN Bus usage, and checking motors.

  • com.team254.lib.geometry

    Contains a set of classes that represent various geometric entities.

  • com.team254.lib.motion

    Contains all motion profiling code used for autonomous driving. Trapezoidal motion profiles are used for smooth acceleration and minimal slip.

  • com.team254.lib.physics

    Contains classes to represent physical states of a swerve drive, a swerve's effective wheelbase, and a DC motor.

  • com.team254.lib.spline

    Contains classes to generate and time parameterize splines for smooth autonomous paths.

  • com.team254.lib.swerve

    Contains various drive controllers and classes used for forward and inverse kinematics.

  • com.team254.lib.trajectory

    Contains multiple classes used for representing and following Trajectory objects.

  • com.team254.lib.trajectory.timing

    Contains multiple classes for generating time-parameterized trajectories that obey physical robot constraints.

  • com.team254.lib.util

    Contains a collection of assorted utilities classes used in the robot code. Check each file for more information.

  • com.team254.lib.vision

    Contains various classes that help with tracking and storing information about vision targets.

  • com.team254.lib.wpilib

    Contains parent classes of the main Robot class that get rid of loop overrun and watchdog print messages that clutter the console.

Variable Naming Conventions

  • k*** (i.e. kDriveWheelbaseMeters): Final constants, especially those found in the Constants.java file
  • m*** (i.e. mPathFollower): Private instance variables

frc-2022-public's People

Contributors

nirmalshiju avatar aarnavsawant avatar

Stargazers

 avatar Wyatt Armstrong avatar  avatar Jason Wang avatar Jorge Sánchez Encinas avatar Winston avatar Daffa Khusnureza avatar  avatar Aidan Fleming avatar apple avatar Borong avatar William Li avatar  avatar Sam Richter avatar Christopher Bonomi avatar Bobby Corser avatar  avatar Caleb Fynewever avatar Matt Huesman avatar GONG ZERUI avatar Amanda Zhang avatar Diego Lozano avatar Abhik Ray avatar Neil Ni avatar Evan Kaba avatar  avatar Jimmy McCosker avatar Devin Hazelton avatar leo_mc0480 avatar Charles Buffington avatar Samuel Villegas avatar Stephen Xie avatar Guilherme Samuel avatar Daniel Wenbo avatar Rocky_ avatar  avatar

Watchers

James Cloos avatar Patrick Fairbank avatar  avatar  avatar  avatar Ryan Johnson avatar  avatar  avatar  avatar Jimmy McCosker avatar

frc-2022-public's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.