/** * Creates a new Positioner object. * * @param aGyro * The Gyro to use. * @param aDriveTrain * The DriveTrain to use. * @param aLogger * The robot's Logger. */ public Positioner(Gyro aGyro, IDriveTrain aDriveTrain, ILogger aLogger) { mXPosition = 0; mYPosition = 0; mOrientation = 0; mTotalDistance = 0; mLastDistance = 0; mLastTime = 0; mSpeed = 0; mGyro = aGyro; mDriveTrain = aDriveTrain; mTimer = new Timer(); mLogger = aLogger; mStartAngle = 0; }
/** * Creates a new Positioner object. * * @param aGyro * The Gyro to use. * @param aDriveTrain * The DriveTrain to use. * @param aLogger * The robot's Logger. */ public SimplePositioner(Gyro aGyro, IDriveTrain aDriveTrain, Logger aLogger) { mXPosition = 0; mYPosition = 0; mOrientation = 0; mTotalDistance = 0; mLastDistance = 0; mLastTime = 0; mSpeed = 0; mGyro = aGyro; mDriveTrain = aDriveTrain; mTimer = new Timer(); mLogger = aLogger; mStartAngle = 0; }
/** * Creates a new Positioner object. * * @param aGyro * The Gyro to use. * @param aDriveTrain * The DriveTrain to use. * @param aLogger * The robot's Logger. * @param aAccelerometer * The robot's accelerometer */ public Positioner(Gyro aGyro, IDriveTrain aDriveTrain, Logger aLogger, Accelerometer aAccelerometer) { mXPosition = 0; mYPosition = 0; mOrientation = 0; mTotalDistance = 0; mLastDistance = 0; mLastTime = 0; mSpeed = 0; mGyro = aGyro; mDriveTrain = aDriveTrain; mTimer = new Timer(); mLogger = aLogger; mStartAngle = 0; mVelocityX = 0; mVelocityY = 0; mAccelerometer = aAccelerometer; mErrorX = 0; mErrorY = 0; mErrorZ = 0; // TODO Get rid of these when done testing encoderXVelocity = 0; encoderYVelocity = 0; accelXVelocity = 0; accelYVelocity = 0; avgFiltXVelocity = 0; avgFiltYVelocity = 0; compFiltXVelocity = 0; compFiltYVelocity = 0; mAvgFiltXPos = 0; mAvgFiltYPos = 0; mCompFiltXPos = 0; mCompFiltYPos = 0; isFirstTime = true; }
public GyroInput(Gyro gyro) { this.gyro = gyro; type = PIDSourceType.kDisplacement; }
public PIDGyro(Gyro gyro){ this.gyro = gyro; }
/** * Creates a new Positioner object. * * @param aGyro * The Gyro to use. * @param aAccelerometer * The accelerometer to use. * @param aDriveTrain * The DriveTrain to use. * @param aLogger * The robot's Logger. */ public IMUPositioner(Gyro aGyro, Accelerometer aAccelerometer, IDriveTrain aDriveTrain, Logger aLogger) { mGyro = aGyro; mAccelerometer = aAccelerometer; mDriveTrain = aDriveTrain; mLogger = aLogger; mTimer = new Timer(); }
/** * Create a {@link Gyroscope} that uses the provided WPILib {@link Gyro}. Use this method if you need to * {@link Gyro#calibrate() calibrate} before using it. * * @param gyro the low-level WPILib gyroscope * @return the gyroscope; never null */ public static Gyroscope gyroscope(Gyro gyro) { return Gyroscope.create(gyro::getAngle, gyro::getRate); }