Filetree Structure

From Team 449 Wiki

This page details how our robot code is supposed to be organized. In a repo, this only applies to everything inside RoboRIO.


General

All Java code for the robot should be in src/main/java/org/usfirst/frc/team449/robot. YAML files and motion profiles go in src/main/resources. File names should go from most generic to least generic so that when alphabetized, similar stuff goes together (e.g. SubsystemSolenoid instead of SolenoidSubsystem). Robot and RobotMap go in the base directory (src/main/java/org/usfirst/frc/team449/robot), but everything else should go in a sub-directory.

Subsystems

All non-drive subsystems and subsystem interfaces should go in the subsystems folder. Under src/main/java/org/usfirst/frc/team449/robot/subsystem/interfaces, each interface has a directory that shares its name. In that directory should be the interface itself (called Subsystem[interface name]), a simple and generic implementation of that interface if it makes sense (called [interface name]Simple), any other implementations of that subsystem and that subsystem alone, and a directory called commands that contains the commands that take either only that interface or a generic of that interface and YamlSubsystem. Any other interfaces that extend that interface should have their own directory inside of the one for the interface they extend. Going back out to src/main/java/org/usfirst/frc/team449/robot/subsystem/, there should be another directory called "complex" which holds subsystems that implement multiple subsystem interfaces. The final directory in src/main/java/org/usfirst/frc/team449/robot/subsystem/ is "singleImplementation," which holds the subsystems that don't implement any interfaces because we won't need to make different implementations. Each of those should have its own directory with a commands subdirectory, like for interfaces.

Drive Subsystems

Drive subsystems and interfaces are complex enough that they get their own organizational system. They all go in src/main/java/org/usfirst/frc/team449/robot/subsystem/drive, which contains the interface DriveSubsystem, which all other drive interfaces extend. Also in that directory, each interface that extends DriveSubsystem gets its own directory, like for interfaces. All of those interfaces follow the naming convention Drive[interface name], and their simple implementations are Drive[interface name]Simple. However, unlike for interfaces, any drive subsystem that implements a certain interface goes in that interface's directory, even if it implements other interfaces. If a subsystem implements multiple drive interfaces, it goes in the directory of the interface that is most important (e.g. if it implements DriveShifting and another drive interface, shifting is just sort of an "add-on," so it goes in the other interface's directory).

Commands

Commands that don't take a single interface go in one of four subdirectories of src/main/java/org/usfirst/frc/team449/robot/commands. autonomous holds the autonomous CommandGroups, general holds commands that don't take any subsystem, multiInterface holds commands that take a generic that implements multiple interfaces, and multiSubsystem holds commands that take multiple different subsystems.

OI

src/main/java/org/usfirst/frc/team449/robot/oi holds all the OI-related code, including OI interfaces and implementations, buttons, and throttles. Throttles go under throttles and buttons go under buttons. Then, each OI interface gets its own directory, organized like for subsystems, but without a commands folder.

Other Stuff

Interfaces that can be implemented by something other than a subystem go under src/main/java/org/usfirst/frc/team449/robot/generalInterfaces, in their own directory with a "commands" subdirectory like any other interface. Components (i.e. objects following the Component design pattern) go under src/main/java/org/usfirst/frc/team449/robot/components. Wrappers on WPILib objects to make them compatible with Jackson (e.g. MappedVictor or RotPerSecCANTalon) go under src/main/java/org/usfirst/frc/team449/robot/jacksonWrappers. Everything else goes under src/main/java/org/usfirst/frc/team449/robot/other, but if you see other start to pile up, try to add a new directory that some of that stuff can go in.