From 78a7770ad3eb0c6c02a17a63cbf844110b872dde Mon Sep 17 00:00:00 2001 From: ethanc8 Date: Tue, 6 Aug 2024 19:43:37 -0500 Subject: [PATCH] Import lesson plans --- .../2024CodeOverview/index.md | 17 ++ .../ArmSimulation/Tutorial.md | 3 + .../PreseasonTraining/ArmSimulation/index.md | 15 ++ .../AutonomousSimulation/Tutorial.md | 3 + .../AutonomousSimulation/index.md | 10 ++ source/PreseasonTraining/JavaBasics/index.md | 162 ++++++++++++++++++ .../LEDProgramming/Tutorial.md | 3 + .../PreseasonTraining/LEDProgramming/index.md | 10 ++ source/PreseasonTraining/Mock1/index.md | 25 +++ source/PreseasonTraining/Mock2/index.md | 14 ++ .../OpenCV_ColorSegmentation/Tutorial.md | 3 + .../OpenCV_ColorSegmentation/index.md | 10 ++ source/PreseasonTraining/Overview/index.md | 47 +++++ .../TankDriveSimulation/Tutorial.md | 3 + .../TankDriveSimulation/index.md | 15 ++ source/PreseasonTraining/index.md | 19 ++ source/index.md | 3 +- 17 files changed, 361 insertions(+), 1 deletion(-) create mode 100644 source/PreseasonTraining/2024CodeOverview/index.md create mode 100644 source/PreseasonTraining/ArmSimulation/Tutorial.md create mode 100644 source/PreseasonTraining/ArmSimulation/index.md create mode 100644 source/PreseasonTraining/AutonomousSimulation/Tutorial.md create mode 100644 source/PreseasonTraining/AutonomousSimulation/index.md create mode 100644 source/PreseasonTraining/JavaBasics/index.md create mode 100644 source/PreseasonTraining/LEDProgramming/Tutorial.md create mode 100644 source/PreseasonTraining/LEDProgramming/index.md create mode 100644 source/PreseasonTraining/Mock1/index.md create mode 100644 source/PreseasonTraining/Mock2/index.md create mode 100644 source/PreseasonTraining/OpenCV_ColorSegmentation/Tutorial.md create mode 100644 source/PreseasonTraining/OpenCV_ColorSegmentation/index.md create mode 100644 source/PreseasonTraining/Overview/index.md create mode 100644 source/PreseasonTraining/TankDriveSimulation/Tutorial.md create mode 100644 source/PreseasonTraining/TankDriveSimulation/index.md create mode 100644 source/PreseasonTraining/index.md diff --git a/source/PreseasonTraining/2024CodeOverview/index.md b/source/PreseasonTraining/2024CodeOverview/index.md new file mode 100644 index 0000000..86933a4 --- /dev/null +++ b/source/PreseasonTraining/2024CodeOverview/index.md @@ -0,0 +1,17 @@ +# Lesson 8: 2024 Code overview + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +``` + +## Agenda + +* Overview of last years code +* Every command and subsystem +* Vision code +* QnA +* Watch old matches for strategy and inspiration \ No newline at end of file diff --git a/source/PreseasonTraining/ArmSimulation/Tutorial.md b/source/PreseasonTraining/ArmSimulation/Tutorial.md new file mode 100644 index 0000000..73f0903 --- /dev/null +++ b/source/PreseasonTraining/ArmSimulation/Tutorial.md @@ -0,0 +1,3 @@ +# Arm Simulation: Tutorial + +TODO: Import https://titanrobotics2022.notion.site/5-4-Arm-91d67fab859a40968919a2f86e20ffcf \ No newline at end of file diff --git a/source/PreseasonTraining/ArmSimulation/index.md b/source/PreseasonTraining/ArmSimulation/index.md new file mode 100644 index 0000000..fa23f59 --- /dev/null +++ b/source/PreseasonTraining/ArmSimulation/index.md @@ -0,0 +1,15 @@ +# Lesson 5: Arm Simulation + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +Tutorial.md +``` + +## TODO + +* Add torque gravity(?) +* Talk about PIDF usage \ No newline at end of file diff --git a/source/PreseasonTraining/AutonomousSimulation/Tutorial.md b/source/PreseasonTraining/AutonomousSimulation/Tutorial.md new file mode 100644 index 0000000..11457bb --- /dev/null +++ b/source/PreseasonTraining/AutonomousSimulation/Tutorial.md @@ -0,0 +1,3 @@ +# Arm Simulation: Tutorial + +TODO: Import https://titanrobotics2022.notion.site/3-Autonomous-1717871dea664a40b1e3d33cb9062274 \ No newline at end of file diff --git a/source/PreseasonTraining/AutonomousSimulation/index.md b/source/PreseasonTraining/AutonomousSimulation/index.md new file mode 100644 index 0000000..1465364 --- /dev/null +++ b/source/PreseasonTraining/AutonomousSimulation/index.md @@ -0,0 +1,10 @@ +# Lesson 4: Autonomous Simulation + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +Tutorial.md +``` \ No newline at end of file diff --git a/source/PreseasonTraining/JavaBasics/index.md b/source/PreseasonTraining/JavaBasics/index.md new file mode 100644 index 0000000..4f28454 --- /dev/null +++ b/source/PreseasonTraining/JavaBasics/index.md @@ -0,0 +1,162 @@ +# Lesson 2: Java Basics + +## Agenda + +* What is Java + * A JIT (compiled "Just-In-Time") language + * Compiled into Java bytecode + * Then bytecode is translated into machine code on target platform + * Makes code more cross-platform than C/C++, which is directly compiled + * Statically typed + * Every variable has a "type" + * E.g. "int" \== integer number, "double" \== decimal number, "string" \== text, etc + * Lower case type is primitive type: basic type included with java + * Upper case type is class type: complex type, see next +* Object oriented programming + * Everything is an "object" of a certain "class" + * Each class can have "variables" and "functions" + * There's also "constructors", which are methods that run when you create an object + * There's also modifiers: "public", "private", "readonly", "static" + * Private things can only be accessed inside the object + * Static are the same for all object instances of a class + * Readonly cant be modified after creation, all readonly are static + * Btw, "variable" \== "member" \== "attribute" and "function" \== "method" + * Python and C++ also have classes + * Example class: + +```{code-block} java +:caption: Car.java +:lineno-start: 1 + +class Car { + public Engine engine = new Engine(); +public float fuel = 0; // Unit is gallons +public mileage = 0; // Unit is miles + +// The constructor +public Car(float fuel, float mileage) { + this.fuel = fuel; + this.mileage = mileage; +} + +// This method drives the car by X miles +public void driveCar(float miles) { + this.mileage += miles; + this.fuel -= miles / 33.0; // 33 miles per gallon +} + +// Adds fuel to car + public void addFuel(float fuel) { + this.fuel += fuel; + } +} +``` + +```{code-block} java +:caption: Main.java +:lineno-start: 1 + +// ... +Car hondaCivic = new Car(0, 0); // Brand new car with zero mileage +car.addFuel(10.0); // Filled it up +car.driveCar(30.0); // Drove the car to IMSA +// ... +``` + +* Libraries + * Other code you import, typically written by other people + * Consists of classes + * Standard library is included with java + * WPILib is the library we use for FRC + * It has stuff like classes for motors and sensors + * We also have a library for our gyroscope written by the manufacturer + * And also our own library for reusable code: Titan Algorithms +* Walkthrough practice: inventory manager + +```{code-block} java +:caption: Item.java +:lineno-start: 1 + +class Item { + public string Name; + public int Quantity; + + public Item(string name, int quantity) { + this.Name = name; + this.Quantity = quantity; + } +} +``` + +```{code-block} java +:caption: Inventory.java +:lineno-start: 1 + +class Inventory { +private ArrayList items = new ArrayList(); + +public Inventory() {} + +public void addItem(Item item) { +items.add(item); +} + +public String search(String query) { + String result = ""; + for (int i = 0; i < items.size(); i++) { + If (items.get(i).Name.contains(query)) { + // Yes you can add strings + // "\n" or "\r\n" on Windows is special character for new line + result += items.get(i).Name + "\r\n"; + } +} +} +} +``` + +```{code-block} java +:caption: Main.java +:lineno-start: 1 + +import java.util.Scanner; // Import standard library for print, this is done automatically by VSCode + +// Name of our program +class InventoryManager { + public static void main(String[] args) { + // Java’s print function + System.out.println("Welcome to inventory manager."); + System.out.println("Type ‘/add [item name] [quantity]’ to add an item. No spaces in name."); + System.out.println("Type ‘/search [item name]’ to find an item."); + System.out.println("Type ‘/exit’ to leave the program."); + + // Scanner object used to record user input +Scanner inputScanner = new Scanner(System.in); + +// Our inventory +Inventory inventory = new Inventory(); + + // While loops run if the condition is true + boolean isRunning = true; + while (isRunning) { +String userInput = inputScanner.nextLine(); // Get command input +String[] splittedCommand = userInput.split("\\s+"); // Array with each word + + If (userInput.startsWith("/exit")) { + isRunning = false; +System.out.println("Exiting."); + } else if (userInput.startsWith("/add")) { + // Item count is a string but has to be converted to an integer type + Item newItem = new Item(splittedCommand[1], Integer.parseInt( +splittedCommand[2])); + inventory.addItem(newItem); +System.out.println("Item added."); + } else if (userInput.startsWith("/search")) { + String query = splittedCommand[1]; + System.out.println(inventory.search(query)); + } else { + System.out.println("Unknown command."); + } + } + } +} +``` \ No newline at end of file diff --git a/source/PreseasonTraining/LEDProgramming/Tutorial.md b/source/PreseasonTraining/LEDProgramming/Tutorial.md new file mode 100644 index 0000000..abc0bb7 --- /dev/null +++ b/source/PreseasonTraining/LEDProgramming/Tutorial.md @@ -0,0 +1,3 @@ +# LED Programming: Tutorial + +TODO: Migrate https://titanrobotics2022.notion.site/1-LED-Programming-a513f3e774704473a6b4b1377751d5ee here. \ No newline at end of file diff --git a/source/PreseasonTraining/LEDProgramming/index.md b/source/PreseasonTraining/LEDProgramming/index.md new file mode 100644 index 0000000..d123ef4 --- /dev/null +++ b/source/PreseasonTraining/LEDProgramming/index.md @@ -0,0 +1,10 @@ +# LED Programming + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +Tutorial.md +``` \ No newline at end of file diff --git a/source/PreseasonTraining/Mock1/index.md b/source/PreseasonTraining/Mock1/index.md new file mode 100644 index 0000000..1a2113e --- /dev/null +++ b/source/PreseasonTraining/Mock1/index.md @@ -0,0 +1,25 @@ +# Lesson 6: Mock Season Part 1—Subsystems/Commands + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +``` + +## Agenda + +* Provide: + * Swerve subsystem + * Localizer + * Utils, etc + * Measurements + * Motor and sensor IDs + * Resources and links +* Programming subsystems and commands +* Split into groups for subsystems + * Group 1: intake, indexer, LEDs + * Group 2: elevator + * Group 3: shooter +* Give hints and implementation details for some subsystems (e.g. shooter positioning math) \ No newline at end of file diff --git a/source/PreseasonTraining/Mock2/index.md b/source/PreseasonTraining/Mock2/index.md new file mode 100644 index 0000000..b4a7215 --- /dev/null +++ b/source/PreseasonTraining/Mock2/index.md @@ -0,0 +1,14 @@ +# Lesson 7: Mock Season Part 2—Autonomous + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +``` + +## Agenda + +* Provide vision localizer +* Teach PathPlanner \ No newline at end of file diff --git a/source/PreseasonTraining/OpenCV_ColorSegmentation/Tutorial.md b/source/PreseasonTraining/OpenCV_ColorSegmentation/Tutorial.md new file mode 100644 index 0000000..9d6994e --- /dev/null +++ b/source/PreseasonTraining/OpenCV_ColorSegmentation/Tutorial.md @@ -0,0 +1,3 @@ +# Color-based segmentation in OpenCV Python: Tutorial + +TODO: Figure out where we put the tutorial! \ No newline at end of file diff --git a/source/PreseasonTraining/OpenCV_ColorSegmentation/index.md b/source/PreseasonTraining/OpenCV_ColorSegmentation/index.md new file mode 100644 index 0000000..7538a10 --- /dev/null +++ b/source/PreseasonTraining/OpenCV_ColorSegmentation/index.md @@ -0,0 +1,10 @@ +# Color-based segmentation in OpenCV Python + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +Tutorial.md +``` diff --git a/source/PreseasonTraining/Overview/index.md b/source/PreseasonTraining/Overview/index.md new file mode 100644 index 0000000..3e9b1bc --- /dev/null +++ b/source/PreseasonTraining/Overview/index.md @@ -0,0 +1,47 @@ +# Lesson 1: Setup, Strategy, Overview (All-Team) + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +``` + +## Agenda + +* What does FRC programming do + * Make best/smoothest driving experience for the drivers + * Reduce amount of thinking and time wasted during the game + * We do that through optimizing driving and automating tasks + * Score as much points in autonomous 15 second period + * Good autonomous can make a bad robot perform good +* Structure + * All project files stored on Github, project management software like Bild + * Vision code is on the coprocessors, robot control code is on the roborio +* roboRIO + * Most important part of the robot + * Should always be accessible + * Can be plugged into a computer through USB, ethernet, or WiFi +* Driver Station + * Press enter to disable + * Press space to emergency stop (the robot has to restart to be enabled again) + * All these lights have to be green for it it work +* Phoenix Tuner X + * Can be used to control or monitor motors, here's how to do it + * Needs driver station to work +* What non programmers need to know (remember this) + * We can't make the robot fly + * Software is not a substitute for bad hardware + * Hard stops \>\>\> software stops + * DI only has two customers: the programming team and the drive team + * Please ask us while designing, not after\!\! +* Links + * Cheatsheets + * Driver Station \+ Phoenix Tuner X \+ REV Hardware Client + * Git + * WPILib VSCode \+ WPILib overview + * Linux +* Homework for programming subteam + * Download Java, VSCode, WPILib, and Git \+ sign-in + diff --git a/source/PreseasonTraining/TankDriveSimulation/Tutorial.md b/source/PreseasonTraining/TankDriveSimulation/Tutorial.md new file mode 100644 index 0000000..4a64b9c --- /dev/null +++ b/source/PreseasonTraining/TankDriveSimulation/Tutorial.md @@ -0,0 +1,3 @@ +# Tank Drive Simulation: Tutorial + +TODO: Import https://titanrobotics2022.notion.site/2-Tank-Drive-1291dde0e33245d3aa9b26da1b6b99b4 \ No newline at end of file diff --git a/source/PreseasonTraining/TankDriveSimulation/index.md b/source/PreseasonTraining/TankDriveSimulation/index.md new file mode 100644 index 0000000..ed731b1 --- /dev/null +++ b/source/PreseasonTraining/TankDriveSimulation/index.md @@ -0,0 +1,15 @@ +# Lesson 3: Tank Drive Simulation + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +Tutorial.md +``` + +## TODO + +* Add more friction physics +* Talk about PIDF usage \ No newline at end of file diff --git a/source/PreseasonTraining/index.md b/source/PreseasonTraining/index.md new file mode 100644 index 0000000..fa0db1a --- /dev/null +++ b/source/PreseasonTraining/index.md @@ -0,0 +1,19 @@ +# Preseason Training + +```{toctree} +--- +maxdepth: 2 +caption: Contents +titlesonly: true +--- +Overview/index.md +LEDProgramming/index.md +OpenCV_ColorSegmentation/index.md +JavaBasics/index.md +TankDriveSimulation/index.md +AutonomousSimulation/index.md +ArmSimulation/index.md +Mock1/index.md +Mock2/index.md +2024CodeOverview/index.md +``` \ No newline at end of file diff --git a/source/index.md b/source/index.md index 86a7acd..4c09727 100644 --- a/source/index.md +++ b/source/index.md @@ -4,7 +4,8 @@ --- caption: Contents titlesonly: true ---- +--- +PreseasonTraining/index.md Resources/index.md TitanAlgorithms/index.md TitanProcessing/index.md