001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.wpilibj.pidwrappers; 006 007import edu.wpi.first.wpilibj.AnalogAccelerometer; 008import edu.wpi.first.wpilibj.AnalogInput; 009import edu.wpi.first.wpilibj.PIDSource; 010import edu.wpi.first.wpilibj.PIDSourceType; 011 012/** 013 * Wrapper so that PIDSource is implemented for AnalogAccelerometer for old PIDController. 014 * 015 * @deprecated Use {@link edu.wpi.first.math.controller.PIDController} which doesn't require this 016 * wrapper. 017 */ 018@Deprecated(since = "2022", forRemoval = true) 019public class PIDAnalogAccelerometer extends AnalogAccelerometer implements PIDSource { 020 protected PIDSourceType m_pidSource = PIDSourceType.kDisplacement; 021 022 public PIDAnalogAccelerometer(int channel) { 023 super(channel); 024 } 025 026 public PIDAnalogAccelerometer(AnalogInput channel) { 027 super(channel); 028 } 029 030 @Override 031 public void setPIDSourceType(PIDSourceType pidSource) { 032 m_pidSource = pidSource; 033 } 034 035 @Override 036 public PIDSourceType getPIDSourceType() { 037 return m_pidSource; 038 } 039 040 /** 041 * Get the Acceleration for the PID Source parent. 042 * 043 * @return The current acceleration in Gs. 044 */ 045 @Override 046 public double pidGet() { 047 return getAcceleration(); 048 } 049}