Exemplo n.º 1
0
  public SpeedController() {
    speedController.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    speedController.configEncoderCodesPerRev(20);

    speedController.setP(0.75);
    speedController.setI(0.01);
    speedController.setD(0.0);

    speedController.setCloseLoopRampRate(.01);
  }
 public MasterCANTalon(int port) {
   talon = new CANTalon(port);
   talon.setFeedbackDevice(FeedbackDevice.CtreMagEncoder_Relative);
   talon.reverseSensor(false);
   talon.setProfile(0);
   talon.setF(0.1722);
   talon.setP(0.1);
   talon.setI(0);
   talon.setD(0);
   talon.configNominalOutputVoltage(+0.0f, -0.0f);
   talon.configPeakOutputVoltage(+12.0f, -12.0f);
   talon.changeControlMode(TalonControlMode.Speed);
 }
Exemplo n.º 3
0
  /**
   * Set the PID Controller gain parameters. Set the proportional, integral, and differential
   * coefficients.
   *
   * @param p Proportional coefficient
   * @param i Integral coefficient
   * @param d Differential coefficient
   */
  public synchronized void setPID(double p, double i, double d) {
    m_P = p;
    m_I = i;
    m_D = d;

    m_talon.setProfile(0);
    m_talon.setP(p);
    m_talon.setI(i);
    m_talon.setD(d);

    if (m_debugging) {
      SmartDashboard.putNumber(m_name + " P", m_talon.getP());
      SmartDashboard.putNumber(m_name + " I", m_talon.getI());
      SmartDashboard.putNumber(m_name + " D", m_talon.getD());
    }
  }