Exploit database

GH-ab1a20fab9474c4d9d492a1991945c22

8872/centerstage

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2019-11358

1,181 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files6

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/util/wpilib/PIDSubsystem.java

Java · 2,489 bytes
package org.firstinspires.ftc.teamcode.util.wpilib;

import androidx.annotation.NonNull;
import com.arcrobotics.ftclib.command.SubsystemBase;
import com.arcrobotics.ftclib.controller.PIDController;

public abstract class PIDSubsystem extends SubsystemBase {
    protected final PIDController m_controller;
    protected boolean m_enabled = true;
    /**
     * A subsystem that uses a {@link PIDController} to control an output. The controller is run
     * synchronously from the subsystem's periodic() method.
     *
     */
    public PIDSubsystem(PIDController controller, double intialPosition) {
        m_controller = controller;
    }

    /**
     * Creates a new PIDSubsystem. Initial setpoint is zero.
     *
     * @param controller the PIDController to use
     */
    public PIDSubsystem(PIDController controller) {
        this(controller, 0);
    }

    @Override
    public void periodic() {
        if (m_enabled) {
            useOutput(m_controller.calculate(getMeasurement()), getSetpoint());
        }
    }

    public PIDController getController() {
        return m_controller;
    }

    /**
     * Sets the setpoint for the subsystem.
     *
     * @param setpoint the setpoint for the subsystem
     */
    public void setSetpoint(double setpoint) {
        m_controller.setSetPoint(setpoint);
    }

    /**
     * Returns the current setpoint of the subsystem.
     *
     * @return The current setpoint
     */
    public double getSetpoint() {
        return m_controller.getSetPoint();
    }

    /**
     * Uses the output from the PIDController.
     *
     * @param output the output of the PIDController
     * @param setpoint the setpoint of the PIDController (for feedforward)
     */
    protected abstract void useOutput(double output, double setpoint);

    /**
     * Returns the measurement of the process variable used by the PIDController.
     *
     * @return the measurement of the process variable
     */
    protected abstract double getMeasurement();

    /** Enables the PID control. Resets the controller. */
    public void enable() {
        m_enabled = true;
        m_controller.reset();
    }

    /** Disables the PID control. Sets output to zero. */
    public void disable() {
        m_enabled = false;
        useOutput(0, 0);
    }

    /**
     * Returns whether the controller is enabled.
     *
     * @return Whether the controller is enabled.
     */
    public boolean isEnabled() {
        return m_enabled;
    }
}