This is a complete recoding of Destiny for the 2020 WPILib.
This can be used as example robot code as most of the code is written in a way that makes it a great example for how to write robot code.
Every part of this project contains useful information about how to code the robot.
This project contains implementations of the Shooter and Drivetrain for Destiny.
The first two files to look at are
Note:
- The SmartNumber class lets you interact with the constant on smart dashboard while the robot is running.
The subsystems are the next thing to look at. A subsystem is basically a part of the code that talks to the hardware directly. This lets things like commands operate the robot without having to initialize motors and other low level things like that.
Some of the values used are from the Constants.java file. Be sure to look back if you forget what a value is.
You can look at them here frc/robot/subsystems/.
A command is the part of the code called from RobotContainer.java that tells the robot what to do with the subsystems.
When a command is created, it takes in everything it needs to use as a parameter. For example, the DrivetrainDriveCommand.java takes in a Drivetrain and a Gamepad as input as they are required in the command.
You can look at them here frc/robot/commands/.
Each of the commands is called and setup in the RobotContainer.java file. Look for things like .setDefaultCommand(...)
and .whileHeld(...)
.
An Auton is a group of commands that operates the robot without user input during the first 30 seconds of the game. The auton is selected through smart dashboard. You can add autons to smard dashboard in RobotContainer.java.
You can find a DoNothingAuton as an example auton here frc/robot/commands/autos/.
Files like Main.java and Robot.java are just for initialization and can be avoided when looking through the project.
In the files DrivetrainAlignCommand.java and Shooter.java, advanced control algorithms are used like PID and Take Back Half.
These aren't too complicated to wrap your head around, but you may need some more information than just this project. Please contact the heads of the SE Department for more information.
If you look in the vendordeps
folder, you will see some .json
files.
These files contain the libraries that we need to move some of the motors on Destiny.