--- /dev/null
+
+
+
+public class Roller extends SubsystemBase {
+ private TalonFX motor;
+ private MotionMagicVelocityVoltage request = new MotionMagicVelocityVoltage(0);
+
+ public Roller() {
+ motor = new TalonFX(0, Constants.CANIVORE_CAN);
+
+ TalonFXConfiguration config = new TalonFXConfiguration();
+
+ // config Slot 0 PID params
+ var slot0Configs = config.Slot0;
+ slot0Configs.kP = 5.0;
+ slot0Configs.kI = 0.0;
+ slot0Configs.kD = 0.0;
+ slot0Configs.kV = 0.0;
+ slot0Configs.kA = 0.0;
+
+ // set the brake mode
+ config.MotorOutput.withNeutralMode(NeutralModeValue.Brake);
+
+
+ // configure MotionMagic
+ MotionMagicConfigs motionMagicConfigs = config.MotionMagic;
+
+ motionMagicConfigs.MotionMagicCruiseVelocity = 420;
+ motionMagicConfigs.MotionMagicAcceleration = 69;
+
+ // apply the configuration
+ motor.getConfigurator().apply(config);
+
+ // invert motors
+ motor.getConfigurator().apply(
+ new MotorOutputConfigs().withInverted(InvertedValue.Clockwise_Positive)
+ .withNeutralMode(NeutralModeValue.Coast)
+ );
+
+ }
+
+ public void spin(double speedRps) {
+ motor.setControl(request.withVelocity(speedRps));
+ }
+}
--- /dev/null
+#import "@local/robotics:0.1.0": ting
+#show: ting
+
+#set document(title: "Motion Magic Intro")
+
+#import "@local/touying:0.7.3": *
+#import themes.ironclaw: *
+
+#show link: set text(blue)
+#show link: underline
+
+#import "@local/codly:1.3.1": *
+#import "@preview/codly-languages:0.1.10": *
+#show: codly-init.with()
+
+#show raw: set text(size: 20pt, font: "Miracode")
+
+#import "@preview/fletcher:0.5.8" as fletcher: diagram, edge, node
+#import fletcher.shapes: circle, diamond, ellipse, parallelogram, pill, rect
+
+#let logo = image("./ironclaw.png")
+
+
+#title-slide()[
+ #text(36pt)[#heading(level: 3)[#title()]]
+ #linebreak()
+ #datetime.today().display("[month repr:long] [day] [year]")
+ #linebreak()
+ #box(height: 20%)[#logo]
+]
+
+== What is Motion Magic?
+- Basically, a more advanced API to control motors
+- Abstracts away direct PID and Feedforward calculations
+- Is a bit verbose imo :(
+
+== Resources
+- #link("https://v6.docs.ctr-electronics.com/en/stable/docs/api-reference/device-specific/talonfx/talonfx-control-intro.html")[CTRE Guide]
+- #link("https://api.ctr-electronics.com/phoenix6/stable/java/index.html")[API Docs] (#link("https://api.ctr-electronics.com/phoenix6/latest/java/index.html")[wpilib alpha])
+- #link("https://frcteam3255.github.io/Wiki/Lessons%20(Software)/MotionMagic/")[SuperNURDS]
+
+
+== Old Way
+
+== New Way
+
+== When to NOT use MotionMagic
+- The alternative is `motor.setThrottle`
+- Sets motor output as percentage of full power
+- No feedback or position control
+- Basically just when you want to spin a roller really fast with no regard for velocity
+
+
+== Tips
+- There are a lot of Control Request types
+ - VSCode autocomplete is the goat for this
+- Make one request and reuse it
+- Be careful with your tuning
+
+== PID Review
+#link("https://docs.google.com/presentation/d/1ldI8mJS26nq8nHIjNz_SLeJR6j8HoKEYOPCpbXV1PzY/edit?usp=sharing")[Activities Slide Deck]
+
+
+= Feedforward
+
+== What is Feedforward
+- A component of *Closed Loop Control*
+ - works _with_ PID usually
+- Compensates for system characteristics
+ - eg. Friction, Inertia, Gravity
+- #link("https://docs.google.com/presentation/d/1g4LiEVMSLd43Ues3Nt_aV0utcySI1vf5iADmorDXjzA/edit?slide=id.g2ed2767c617_0_60#slide=id.g2ed2767c617_0_60")[Activities Slides]
+
+
+== How to use Feedforward with Motion Magic
+- Basically just modify the constants during motor configuration
+- To tune, do this! #link("https://v6.docs.ctr-electronics.com/en/stable/docs/api-reference/device-specific/talonfx/manual-pid-tuning.html")[fun activity]
+
+== Practice Task
+If you still have the basic little intake subsystem that I assigned you before the rewrite, use that, but otherwise just do this on your rewrite subsystem. Try to modify the control to use Motion Magic. Ask questions :)