Skip to content

Commit

Permalink
Import lesson plans
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanc8 committed Aug 7, 2024
1 parent b2ac377 commit 78a7770
Show file tree
Hide file tree
Showing 17 changed files with 361 additions and 1 deletion.
17 changes: 17 additions & 0 deletions source/PreseasonTraining/2024CodeOverview/index.md
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions source/PreseasonTraining/ArmSimulation/Tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Arm Simulation: Tutorial

TODO: Import https://titanrobotics2022.notion.site/5-4-Arm-91d67fab859a40968919a2f86e20ffcf
15 changes: 15 additions & 0 deletions source/PreseasonTraining/ArmSimulation/index.md
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions source/PreseasonTraining/AutonomousSimulation/Tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Arm Simulation: Tutorial

TODO: Import https://titanrobotics2022.notion.site/3-Autonomous-1717871dea664a40b1e3d33cb9062274
10 changes: 10 additions & 0 deletions source/PreseasonTraining/AutonomousSimulation/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Lesson 4: Autonomous Simulation

```{toctree}
---
maxdepth: 2
caption: Contents
titlesonly: true
---
Tutorial.md
```
162 changes: 162 additions & 0 deletions source/PreseasonTraining/JavaBasics/index.md
Original file line number Diff line number Diff line change
@@ -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<Item> items = new ArrayList<Item>();
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.");
}
}
}
}
```
3 changes: 3 additions & 0 deletions source/PreseasonTraining/LEDProgramming/Tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LED Programming: Tutorial

TODO: Migrate https://titanrobotics2022.notion.site/1-LED-Programming-a513f3e774704473a6b4b1377751d5ee here.
10 changes: 10 additions & 0 deletions source/PreseasonTraining/LEDProgramming/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# LED Programming

```{toctree}
---
maxdepth: 2
caption: Contents
titlesonly: true
---
Tutorial.md
```
25 changes: 25 additions & 0 deletions source/PreseasonTraining/Mock1/index.md
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 14 additions & 0 deletions source/PreseasonTraining/Mock2/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Lesson 7: Mock Season Part 2—Autonomous

```{toctree}
---
maxdepth: 2
caption: Contents
titlesonly: true
---
```

## Agenda

* Provide vision localizer
* Teach PathPlanner
3 changes: 3 additions & 0 deletions source/PreseasonTraining/OpenCV_ColorSegmentation/Tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Color-based segmentation in OpenCV Python: Tutorial

TODO: Figure out where we put the tutorial!
10 changes: 10 additions & 0 deletions source/PreseasonTraining/OpenCV_ColorSegmentation/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Color-based segmentation in OpenCV Python

```{toctree}
---
maxdepth: 2
caption: Contents
titlesonly: true
---
Tutorial.md
```
47 changes: 47 additions & 0 deletions source/PreseasonTraining/Overview/index.md
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions source/PreseasonTraining/TankDriveSimulation/Tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tank Drive Simulation: Tutorial

TODO: Import https://titanrobotics2022.notion.site/2-Tank-Drive-1291dde0e33245d3aa9b26da1b6b99b4
15 changes: 15 additions & 0 deletions source/PreseasonTraining/TankDriveSimulation/index.md
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions source/PreseasonTraining/index.md
Original file line number Diff line number Diff line change
@@ -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
```
3 changes: 2 additions & 1 deletion source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
---
caption: Contents
titlesonly: true
---
---
PreseasonTraining/index.md
Resources/index.md
TitanAlgorithms/index.md
TitanProcessing/index.md
Expand Down

0 comments on commit 78a7770

Please sign in to comment.