-
Notifications
You must be signed in to change notification settings - Fork 6
PID and Advanced Control Systems
It’s the special magic sauce of Mustard. It’s like Grey Poupon. Goes nice with ketchup.
PID is used if we are trying to go from one particular value or position(elevator position, etc.) to another. It has a wide variety of use cases, of which we mainly use it for driving motors to specific values. It involves setting several constants that interact with complex calculations to drive our motors in specific ways. We haven't fully researched it, but to use it for our purposes, see below:
Before jumping into using PID, we need to clarify what motor type we are using. **REVLib** and **Pheonix** use very different systems to assign values and drive motors with them, so make sure to follow the steps listed for your specified motor.
PID has three main variables: **Proportional**, **Integral**, and **Derivative**. We don’t use integral in FRC. **Proportional** drives the value towards the target value. **Derivative** compensates for error.
There are also a few other values which are used for **feedforward**, a way of compensating for external factors before
To start, create PIDController object and variables to store the P, I, and D (either do testing and/or run SysID to get the values):
private static final double kP = 1.32;
private static final double kI = 0;
private static final double kD = .0185;
PIDController pid = new PIDController(kP, kI, kD);Then, to calculate a power based on the PID, do (it returns the power/output):
pid.calculate(current, target);This is an officially licensed product of Team 4026. Decatur Robotics 2024 is not sponsored by any other Team, and is not responsible for any damages caused by using this product or trusting the programming team, which is by far the least most trustworthy team(Shadow owen money gang, we love coding the robot). By using this product, you are consenting to your information, and thus your identity to be stolen and first-born child taken.
- Editing Documentation & Markdown Syntax
- Code Team to-do List
- Code Standards
- Common Library Structure
- Interfaces
- General Setup
- Branching System
- How to Create Pull Requests
- How to Switch Branches
- Code Reviews
- Reverting Commits
- Singleton Pattern
- Software Installations
- Necessary IntelliJ Plugins
- Vendordeps
- Setting Up New Projects
- Autoformatter Set Up
- Showbot Requirements
- Autonomous
- Calling a Command Based on a Button Press
- CAN
- Clearing Sticky Faults
- Current Limits
- PID Config and Usage
- Robot.java, TeleopInit, DisabledInit
- RoboRio Ports
- SetDefaultCommand
- Wait for Time
- SlewRateLimiter
- LEDs
- InstantCommand
- PhotonVision
- Apriltags
- Camera Display on Shuffleboard
- Object Detection
- Raspberry Pi
- Network Tables
- List of Network Tables (2023)
Up to date as of SJ2, end of 2023 season