Skip to content

1b. Code Templates

Jordan edited this page Aug 9, 2020 · 6 revisions

Overview

There are different templates for coding such as Command Robot, and Timed Robot. Unfortunately, we only have experience with Timed Robot. So that is what we'll be talking about.

When you first use a template, this will be the file structure.

└───sample
    ├───.gradle
    │   ├───6.0.1
    │   │   ├───executionHistory
    │   │   ├───fileChanges
    │   │   ├───fileContent
    │   │   ├───fileHashes
    │   │   ├───javaCompile
    │   │   └───vcsMetadata-1
    │   ├───buildOutputCleanup
    │   └───vcs-1
    ├───.vscode
    ├───.wpilib
    ├───build
    │   ├───classes
    │   │   └───java
    │   │       └───main
    │   │           └───frc
    │   │               └───robot
    │   ├───generated
    │   │   └───sources
    │   │       └───annotationProcessor
    │   │           └───java
    │   │               └───main
    │   ├───libs
    │   └───tmp
    │       ├───compileJava
    │       ├───expandedArchives
    │       │   ├───cscore-cpp-2020.3.2-windowsx86-64.zip_1893bb55bbd32305d3f8edc7992fffe3
    │       │   │   └───windows
    │       │   │       └───x86-64
    │       │   │           └───shared
    │       │   ├───hal-cpp-2020.3.2-windowsx86-64.zip_3fbd0b9a4bb16390e6a525e244fa504a
    │       │   │   └───windows
    │       │   │       └───x86-64
    │       │   │           └───shared
    │       │   ├───ntcore-cpp-2020.3.2-windowsx86-64.zip_bdd5b7648bf4577da18211bf5773e616
    │       │   │   └───windows
    │       │   │       └───x86-64
    │       │   │           └───shared
    │       │   ├───opencv-cpp-3.4.7-2-windowsx86-64.zip_c1b4afe02f1d1728ff01a21481793f4b
    │       │   │   └───windows
    │       │   │       └───x86-64
    │       │   │           └───shared
    │       │   └───wpiutil-cpp-2020.3.2-windowsx86-64.zip_fe3abbc5f8730cc6603a29fe451bc716
    │       │       └───windows
    │       │           └───x86-64
    │       │               └───shared
    │       ├───jar
    │       └───jniExtractDir
    ├───gradle
    │   └───wrapper
    ├───src
    │   └───main
    │       ├───deploy
    │       └───java
    │           └───frc
    │               └───robot
    └───vendordeps

Wow, quite a mouthful isn't it. Thankfully, the src folder is what we want. So this little bit

├───src
    │   └───main
    │       ├───deploy
    │       └───java
    │           └───frc
    │               └───robot

More specifically, the robot folder is where the work gets done. You'll find two .java files: Robot.java, Main.java. Robot.java is where your code will live. Both autonomous and teleop code will be found here.

Clone this wiki locally