微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

edu.wpi.first.wpilibj.SpeedController的实例源码

项目:2017    文件PWMMotorCalibration.java   
public static void calibrateMotor (SpeedController motor)
{
    if (hasRunVictorOnce == false)
        {
            time.stop();
            time.reset();
            time.start();
            hasRunVictorOnce = true;
        }
    if (time.get() <= 2.0)
        motor.set(1.0);
    else if (time.get() >= 2.0 && time.get() <= 3.0)
        motor.set(0.0);
    else if (time.get() >= 3.0 && time.get() <= 5.0)
        motor.set(-1.0);
    else
        motor.set(0.0);

}
项目:2017    文件MecanumTransmission.java   
@Override
public SpeedController getSpeedController (MotorPosition position)
{
    switch (position)
        {
        case LEFT_FRONT:
            return this.leftFrontMotor;
        case LEFT_REAR:
            return this.leftRearMotor;
        case RIGHT_FRONT:
            return this.rightFrontMotor;
        case RIGHT_REAR:
            return this.rightRearMotor;
        default:
            return null;
        }
}
项目:2017    文件TractionTransmission.java   
@Override
public SpeedController getSpeedController(MotorPosition position)
{
    switch (position)
    {
    case LEFT_FRONT:
        return this.leftMotor;
    case LEFT_REAR:
        return this.leftMotor;
    case RIGHT_FRONT:
        return this.rightMotor;
    case RIGHT_REAR:
        return this.rightMotor;
    default:
        return null;
    }
}
项目:2017    文件TankTransmission.java   
@Override
public SpeedController getSpeedController(MotorPosition position)
{
    switch (position)
    {
    case LEFT_FRONT:
        return this.leftFrontMotor;
    case LEFT_REAR:
        return this.leftRearMotor;
    case RIGHT_FRONT:
        return this.rightFrontMotor;
    case RIGHT_REAR:
        return this.rightRearMotor;
    default:
        return null;
    }
}
项目:2017    文件Transmission_old.java   
public Transmission_old (
        final SpeedController rightFrontSpeedController,final SpeedController rightRearSpeedController,final SpeedController leftFrontSpeedController,final SpeedController leftRearSpeedController)
{
    this.isFourWheel = true;
    this.oneOrRightSpeedController = rightFrontSpeedController;
    this.leftSpeedController = leftFrontSpeedController;
    this.rightRearSpeedController = rightRearSpeedController;
    this.leftRearSpeedController = leftRearSpeedController;

    // initialize mecanum drive
    /*
     * this.mecanumDrive = new RobotDrive(this.leftSpeedController,* this.leftRearSpeedController,* this.oneOrRightSpeedController,* this.rightRearSpeedController);
     * this.mecanumDrive.setSafetyEnabled(false);
     */

    this.initPIDControllers();
    this.init();
}
项目:2017    文件Transmission_old.java   
/**
 * Constructor for a four-wheel drive transmission class with
 * already-initialized encoders
 *
 * @param rightFrontSpeedController
 * @param rightRearSpeedController
 * @param leftFrontSpeedController
 * @param leftRearSpeedController
 * @param rightFrontEncoder
 * @param rightRearEncoder
 * @param leftFrontEncoder
 * @param leftRearEncoder
 */
public Transmission_old (
        final SpeedController rightFrontSpeedController,final SpeedController leftRearSpeedController,Encoder rightFrontEncoder,Encoder rightRearEncoder,Encoder leftFrontEncoder,Encoder leftRearEncoder)
{
    this.isFourWheel = true;
    this.oneOrRightSpeedController = rightFrontSpeedController;
    this.leftSpeedController = leftFrontSpeedController;
    this.rightRearSpeedController = rightRearSpeedController;
    this.leftRearSpeedController = leftRearSpeedController;

    this.initEncoders(rightFrontEncoder,rightRearEncoder,leftFrontEncoder,leftRearEncoder);

    this.initPIDControllers();

    this.init();

}
项目:2017    文件Transmission_old.java   
/**
 * This function allows a transmission to control the
 * power of a speed controller based on the current
 * gear. This applies to any of the speed controllers
 * (either Jaguar or Victor) Note that it must be the
 * right joystick.
 *
 * @method controls
 * @param joystickInputValue
 *            - a float value which is used to set
 *            the motor speed to that value
 * @param rightSpeedController
 *            - the right or ONLY motor to
 *            control
 * @author Bob brown
 * @written Sep 20,2009
 *          -------------------------------------------------------
 */
public void controls (final double joystickInputValue,// the input value from the
        // joystick that controls this
        // speed controller
        final SpeedController rightSpeedController)
// if we only have one Motor
// to control then we consider
// it to be the right Motor
{
    // -------------------------------------
    // call the ControlSpeedController() with
    // the correct motor direction
    // -------------------------------------
    this.controlSpeedController(joystickInputValue *
            this.rightJoystickIsReversed.get(),rightSpeedController,WhichJoystick.ONE_JOYSTICK);
}
项目:2016    文件PWMMotorCalibration.java   
public static void calibrateMotor (SpeedController motor)
{
    if (hasRunVictorOnce == false)
        {
            time.stop();
            time.reset();
            time.start();
            hasRunVictorOnce = true;
        }
    if (time.get() <= 2.0)
        motor.set(1.0);
    else if (time.get() >= 2.0 && time.get() <= 3.0)
        motor.set(0.0);
    else if (time.get() >= 3.0 && time.get() <= 5.0)
        motor.set(-1.0);
    else
        motor.set(0.0);

}
项目:2016    文件Transmission_old.java   
public Transmission_old (
        final SpeedController rightFrontSpeedController,* this.rightRearSpeedController);
     * this.mecanumDrive.setSafetyEnabled(false);
     */

    this.initPIDControllers();
    this.init();
}
项目:2016    文件Transmission_old.java   
/**
 * Constructor for a four-wheel drive transmission class with
 * already-initialized encoders
 *
 * @param rightFrontSpeedController
 * @param rightRearSpeedController
 * @param leftFrontSpeedController
 * @param leftRearSpeedController
 * @param rightFrontEncoder
 * @param rightRearEncoder
 * @param leftFrontEncoder
 * @param leftRearEncoder
 */
public Transmission_old (
        final SpeedController rightFrontSpeedController,leftRearEncoder);

    this.initPIDControllers();

    this.init();

}
项目:2016    文件Transmission_old.java   
/**
 * This function allows a transmission to control the
 * power of a speed controller based on the current
 * gear. This applies to any of the speed controllers
 * (either Jaguar or Victor) Note that it must be the
 * right joystick.
 *
 * @method controls
 * @param joystickInputValue
 *            - a float value which is used to set
 *            the motor speed to that value
 * @param rightSpeedController
 *            - the right or ONLY motor to
 *            control
 * @author Bob brown
 * @written Sep 20,WhichJoystick.ONE_JOYSTICK);
}
项目:snobot-2017    文件SnobotDriveTrainWithEncoders.java   
/**
   * @param aLeftMotor
   *                  The First Left Motor
   * @param aLeftMotorB
   *                   The Second Left Motor
   * @param aRightMotor
   *                   The First Right Motor
   * @param aRightMotorB
   *                    The Second Right Motor
   * @param aDriverJoyStick
   *                       The Driver Joystick
   * @param aLogger
   *               The Logger
   *               
    */
   public SnobotDriveTrainWithEncoders(
        SpeedController aLeftMotor,SpeedController aLeftMotorB,SpeedController aRightMotor,SpeedController aRightMotorB,Encoder aLeftEncoder,Encoder aRightEncoder,IDriverJoystick aDriverJoyStick,Logger aLogger)
   {
       super(aLeftMotor,aLeftMotorB,aRightMotor,aRightMotorB,aDriverJoyStick,aLogger);

       mLeftEncoder = aLeftEncoder;
       mRightEncoder = aRightEncoder;

       mLeftEncoder.setdistancePerpulse(Properties2016.sLEFT_ENCODER_disT_PER_pulse.getValue());
       mRightEncoder.setdistancePerpulse(Properties2016.sRIGHT_ENCODER_disT_PER_pulse.getValue());

   }
项目:FRC-2014-robot-project    文件ShooterControl.java   
ShooterControl(Encoder encoder,SpeedController pullBackSpeedController,double speedControllerMaxRpm,DigitalInput limitSwitch,DoubleSolenoid gearControl,Servo latchServo,Relay angleControl)
{
    m_latchReleaseServo = latchServo;
    m_currentState = SHOOTER_CONTROL_STATE_WAIT;
    m_encoder = encoder;
    m_pullBackSpeedController = pullBackSpeedController;
    m_angleControl = angleControl;
    m_speedControllerMaxRpm = speedControllerMaxRpm;
    m_limitSwitch = limitSwitch;
    m_pullBackEncoderRpm = new EncoderRPM();
    m_pullBackEncoderRpm.Init(m_pullBackSpeedController,m_encoder,(-1)*m_speedControllerMaxRpm,m_speedControllerMaxRpm,0.05,100,m_limitSwitch);
    m_releaseFromMidptEncoderRpm = new EncoderRPM();
    m_releaseFromMidptEncoderRpm.Init(m_pullBackSpeedController,(-1)*m_speedControllerMaxRpm/4,3);
    m_gearControl = gearControl;
    m_latchReleased = false;
    m_gearReleased = false;
    m_isPulledBack = false;
}
项目:SwerveDrive    文件SwervePod.java   
public SwervePod(SpeedController turningMotor,SpeedController driveMotor,Encoder encoder,double encoderdistancePerTick,Angularsensor directionSensor) {
    // Initialize motors //
    _turningMotor = turningMotor;
    _driveMotor = driveMotor;

    // Initialize sensors //
    _encoder = encoder;
    _encoder.setPIDSourceParameter(PIDSource.PIDSourceParameter.kRate);
    _encoder.setdistancePerpulse(encoderdistancePerTick);
    _encoder.start();
    _directionSensor = directionSensor;

    // Initialize PID loops //
    // Turning //
    PIDTurning = new PIDController(Kp_turning,Ki_turning,Kd_turning,_directionSensor,_turningMotor);
    PIDTurning.setoutputRange(minSpeed,maxSpeed);
    PIDTurning.setContinuous(true);
    PIDTurning.setAbsolutetolerance(tolerance_turning);
    PIDTurning.enable();

    // Linear driving //
    PIDDriving = new PIDController(Kp_driving,Ki_driving,Kd_driving,_encoder,_driveMotor);
    PIDDriving.setoutputRange(minSpeed,maxSpeed);
    PIDDriving.disable(); //Todo: Enable
}
项目:aeronautical-facilitation    文件RobotDrive6.java   
/**
 * Constructor for RobotDrive with 6 motors specified as SpeedController
 * objects. Speed controller input version of RobotDrive (see prevIoUs
 * comments).
 *
 * @param rearLeftMotor The back left SpeedController object used to drive
 * the robot.
 * @param frontLeftMotor The front left SpeedController object used to drive
 * the robot
 * @param rearRightMotor The back right SpeedController object used to drive
 * the robot.
 * @param frontRightMotor The front right SpeedController object used to
 * drive the robot.
 * @param middleLeftMotor The middle left SpeedController object used to
 * drive the robot.
 * @param middleRightMotor The middle right SpeedController object used to
 * drive the robot.
 */
public RobotDrive6(SpeedController frontLeftMotor,SpeedController rearLeftMotor,SpeedController frontRightMotor,SpeedController rearRightMotor,SpeedController middleLeftMotor,SpeedController middleRightMotor) {
    if (frontLeftMotor == null || rearLeftMotor == null || frontRightMotor == null || rearRightMotor == null) {
        m_frontLeftMotor = m_rearLeftMotor = m_frontRightMotor = m_rearRightMotor = null;
        throw new NullPointerException("Null motor provided");
    }
    m_frontLeftMotor = frontLeftMotor;
    m_rearLeftMotor = rearLeftMotor;
    m_frontRightMotor = frontRightMotor;
    m_rearRightMotor = rearRightMotor;
    m_middleLeftMotor = middleLeftMotor;
    m_middleRightMotor = middleRightMotor;
    m_sensitivity = kDefaultSensitivity;
    m_maxOutput = kDefaultMaxOutput;
    for (int i = 0; i < kMaxnumberOfMotors; i++) {
        m_invertedMotors[i] = 1;
    }
    m_allocatedSpeedControllers = false;
    setupMotorSafety();
    drive(0,0);
}
项目:Felix-2014    文件RobotDriveSteering.java   
/**
 * Constructor for RobotDrive with 2 motors specified as SpeedController
 * objects. The SpeedController version of the constructor enables programs
 * to use the RobotDrive classes with subclasses of the SpeedController
 * objects,for example,versions with ramping or reshaping of the curve to
 * suit motor bias or dead-band elimination.
 *
 * @param leftMotor The left SpeedController object used to drive the robot.
 * @param rightMotor the right SpeedController object used to drive the
 * robot.
 */
public RobotDriveSteering(SpeedController leftMotor,SpeedController rightMotor) {
    if (leftMotor == null || rightMotor == null) {
        m_rearLeftMotor = m_rearRightMotor = null;
        throw new NullPointerException("Null motor provided");
    }
    m_frontLeftMotor = null;
    m_rearLeftMotor = leftMotor;
    m_frontRightMotor = null;
    m_rearRightMotor = rightMotor;
    m_sensitivity = kDefaultSensitivity;
    m_maxOutput = kDefaultMaxOutput;
    for (int i = 0; i < kMaxnumberOfMotors; i++) {
        m_invertedMotors[i] = 1;
    }
    m_allocatedSpeedControllers = false;
    setupMotorSafety();
    drive(0,0);
}
项目:Felix-2014    文件RobotDriveSteering.java   
/**
 * Constructor for RobotDrive with 4 motors specified as SpeedController
 * objects. Speed controller input version of RobotDrive (see prevIoUs
 * comments).
 *
 * @param rearLeftMotor The back left SpeedController object used to drive
 * the robot.
 * @param frontLeftMotor The front left SpeedController object used to drive
 * the robot
 * @param rearRightMotor The back right SpeedController object used to drive
 * the robot.
 * @param frontRightMotor The front right SpeedController object used to
 * drive the robot.
 */
public RobotDriveSteering(SpeedController frontLeftMotor,SpeedController rearRightMotor) {
    if (frontLeftMotor == null || rearLeftMotor == null || frontRightMotor == null || rearRightMotor == null) {
        m_frontLeftMotor = m_rearLeftMotor = m_frontRightMotor = m_rearRightMotor = null;
        throw new NullPointerException("Null motor provided");
    }
    m_frontLeftMotor = frontLeftMotor;
    m_rearLeftMotor = rearLeftMotor;
    m_frontRightMotor = frontRightMotor;
    m_rearRightMotor = rearRightMotor;
    m_sensitivity = kDefaultSensitivity;
    m_maxOutput = kDefaultMaxOutput;
    for (int i = 0; i < kMaxnumberOfMotors; i++) {
        m_invertedMotors[i] = 1;
    }
    m_allocatedSpeedControllers = false;
    setupMotorSafety();
    drive(0,0);
}
项目:649code2014    文件DriveTrainSubsystem.java   
public DriveTrainSubsystem() {
    motors = new SpeedController[RobotMap.DRIVE_TRAIN.MOTORS.length];
    for (int i = 0; i < RobotMap.DRIVE_TRAIN.MOTORS.length; i++) {
        motors[i] = new Victor(RobotMap.DRIVE_TRAIN.MOTORS[i]);
    }
    doubleSidedPid = new PIDController649(EncoderBasedDriving.AUTO_DRIVE_P,EncoderBasedDriving.AUTO_DRIVE_I,EncoderBasedDriving.AUTO_DRIVE_D,this,this);
    doubleSidedPid.setAbsolutetolerance(EncoderBasedDriving.ABSOLUTE_TOLERANCE);
    doubleSidedPid.setoutputRange(-EncoderBasedDriving.MAX_MOTOR_POWER,EncoderBasedDriving.MAX_MOTOR_POWER);
    encoders = new Encoder[RobotMap.DRIVE_TRAIN.ENCODERS.length / 2];
    for (int x = 0; x < RobotMap.DRIVE_TRAIN.ENCODERS.length; x += 2) {
        encoders[x / 2] = new Encoder(RobotMap.DRIVE_TRAIN.ENCODERS[x],RobotMap.DRIVE_TRAIN.ENCODERS[x + 1],x == 0,EncodingType.k2X);
        encoders[x / 2].setdistancePerpulse(EncoderBasedDriving.ENCODER_disTANCE_PER_pulse);
    }
    lastRates = new Vector();
    shifterSolenoid = new DoubleSolenoid(RobotMap.DRIVE_TRAIN.FORWARD_SOLENOID_CHANNEL,RobotMap.DRIVE_TRAIN.REVERSE_SOLENOID_CHANNEL);
}
项目:2013ultimate-ascent    文件Shooter.java   
/**
 * Creates a new shooter.
 *
 * @param shooterMotor1
 * @param shooterMotor2
 * @param Feeder
 * @param raiser
 * @param flywheelEncoder
 * @param raiserPot
 */
public Shooter(SpeedController shooterMotor1,SpeedController shooterMotor2,GRTSolenoid Feeder,SpeedController raiser,GRTEncoder flywheelEncoder,Potentiometer raiserPot,GRTSwitch lowerLimit) {
    super("Shooter mech");
    this.Feeder = Feeder;
    this.shooterMotor1 = shooterMotor1;
    this.shooterMotor2 = shooterMotor2;
    this.raiser = raiser;
    this.flywheelEncoder = flywheelEncoder;
    this.raiserPot = raiserPot;

    updateConstants();
    lowerLimit.addListener(this);
    raiserPot.addListener(this);

    GRTConstants.addListener(this);
}
项目:grtframeworkv7    文件Shooter.java   
/**
 * Creates a new shooter.
 *
 * @param shooterMotor1
 * @param shooterMotor2
 * @param Feeder
 * @param raiser
 * @param flywheelEncoder
 * @param raiserPot
 */
public Shooter(SpeedController shooterMotor1,GRTSwitch lowerLimit) {
    super("Shooter mech");
    this.Feeder = Feeder;
    this.shooterMotor1 = shooterMotor1;
    this.shooterMotor2 = shooterMotor2;
    this.raiser = raiser;
    this.flywheelEncoder = flywheelEncoder;
    this.raiserPot = raiserPot;

    updateConstants();
    lowerLimit.addListener(this);
    raiserPot.addListener(this);

    GRTConstants.addListener(this);
}
项目:2017    文件Transmission_old.java   
/**
 * This function allows a transmission to control the
 * power of two speed controllers based on the current
 * gear. This is used with the left and right
 * drive motors,left and right joysticks and the two
 * buttons that denote whether or not to upshift or downshift.
 *
 * @method Controls
 * @param upShiftSwitch
 *            - boolean - used to denote whether or not to
 *            upshift at this time
 * @param downShiftSwitch
 *            - boolean - used to denote whether or not to
 *            downshift at this time
 * @param leftJoystickInputValue
 *            - float - used to set
 *            the left motor speed to that value
 * @param leftSpeedController
 *            - SpeedController - controls the left motor
 * @param rightJoystickInputValue
 *            - float - used to set
 *            the right motor speed to that value
 * @param rightSpeedController
 *            - SpeedController - controls the right motor
 * @author Bob brown
 * @written Jan 13,2011
 *          -------------------------------------------------------
 */
public void controls (final boolean upShiftSwitch,// the switch that denotes an upShift
        final boolean downShiftSwitch,// the switch that denotes an downShift
        final double leftJoystickInputValue,// the input value from the left
        // joystick that controls the
        // left speed controller
        final SpeedController leftSpeedController,// the left Motor speed controller
        final double rightJoystickInputValue,// the input value from the right
        // joystick that controls the
        // right speed controller
        final SpeedController rightSpeedController)
// the right Motor speed controller
{
    // -------------------------------------
    // make the gears correct as the user wants
    // them Now.
    // -------------------------------------
    this.checkShiftButtons(upShiftSwitch,downShiftSwitch);
    // -------------------------------------
    // since we have two motors to control,// call controls() to process the input
    // -------------------------------------
    this.controls(leftJoystickInputValue,leftSpeedController,rightJoystickInputValue,rightSpeedController);
}
项目:2017    文件Transmission_old.java   
/**
 * This function allows a transmission to control the
 * power of two speed controllers based on the current
 * gear. This is most often used with the left and right
 * drive motors. This applies to any of the speed controllers
 * (either Jaguar or Victor). That is the
 * joystick that can be reversed if it is necessary.
 *
 * @method Controls
 * @param leftJoystickInputValue
 *            - a float value which is used to set
 *            the left motor speed to that value
 * @param leftSpeedController
 *            - controls the left motor
 * @param rightJoystickInputValue
 *            - a float value which is used to set
 *            the right motor speed to that value
 * @param rightSpeedController
 *            - controls the right motor
 * @author Bob brown
 * @written Sep 20,2009
 *          -------------------------------------------------------
 */
public void controls (final double leftJoystickInputValue,// the input value from the right
        // joystick that controls the
        // right speed controller
        final SpeedController rightSpeedController)
// the right Motor speed controller
{
    // -------------------------------------
    // since we have two motors to control,// call the ControlSpeedController() with
    // the correct motor direction
    // -------------------------------------

    this.controlSpeedController(leftJoystickInputValue *
            this.leftJoystickIsReversed.get(),WhichJoystick.LEFT_JOYSTICK);
    this.controlSpeedController(rightJoystickInputValue *
            this.rightJoystickIsReversed.get(),WhichJoystick.RIGHT_JOYSTICK);
}
项目:2017    文件RelativeSpeedController.java   
/**
 * constructor
 *
 * @method RelativeSpeedController
 * @param speedController
 *            The speed controller to control with
 *            veLocity commands
 * @param maxSpeed
 *            The maximum speed that a command of 1.0
 *            should represent
 * @author Josh Shields
 * @written Jan 15,2011
 *          -------------------------------------------------------
 */
public RelativeSpeedController (final SpeedController speedController,// The
        // speed
        // controller
        // to
        // control
        // with
        // veLocity
        // commands
        final double maxSpeed) // The maximum speed that a command of 1.0
                               // should represent
{
    this.speedController = speedController;
    this.maxSpeed = maxSpeed;
}
项目:FlashLib    文件FRCSpeedControllers.java   
/**
 * Gets a controller held in this container by the index
 * @param index the index of the controller
 * @return a controller from the container
 * @throws IllegalArgumentException if the index is negative
 * @throws indexoutofboundsexception if the index exceeds the array size
 */
public SpeedController getController(int index){
    if(index < 0) throw new IllegalArgumentException("Index must be non-negative");
    else if(index >= motor_controllers.length) 
        throw new indexoutofboundsexception("Index out of bounds of list - " + motor_controllers.length);

    return motor_controllers[index];
}
项目:FlashLib    文件FRCSpeedControllers.java   
/**
 * {@inheritDoc}
 * <p>
 * Sets all the speed controllers contained in this object .
 * </p>
 */
@Override
public void enableBrakeMode(boolean mode) {
    this.brakeMode = mode;
    for(int i = 0; i < motor_controllers.length; i++){
        SpeedController c = motor_controllers[i];
        if(c instanceof CANTalon)
            ((CANTalon)c).enableBrakeMode(mode);
    }
}
项目:Sprocket    文件Motor.java   
public Motor(SpeedController motor) {
    if(motor == null) {
        throw new IllegalArgumentException("SpeedController argument was null when instantiating Motor object");
    }


    this.motor = motor;
    if(motor instanceof CANTalon) {
        motorType = MotorType.CANTALON;
    } else if(motor instanceof Talon) {
        motorType = MotorType.TALON;
    } else {
        motorType = MotorType.UNKNowN;
    }



    switch(motorType) {
        case CANTALON:
            CANTalon cMotor = (CANTalon) motor;
            cMotor.changeControlMode(CANTalon.TalonControlMode.PercentVbus);
            cMotor.enableBrakeMode(true);
        break;
        default:
        break;
    }

}
项目:frc-2016    文件MultiSpeedController.java   
@Override
public void set(double setpoint) {
    _setpoint = (setpoint < -1.0 ? -1.0 : (setpoint > 1.0 ? 1.0 : setpoint));

    for (SpeedController sc : _controllers) {
        sc.set(_setpoint);
    }
}
项目:frc-2016    文件MultiSpeedController.java   
@Override
public void setInverted(boolean isInverted) {
    _isInverted = isInverted;

    for (SpeedController sc : _controllers) {
        sc.setInverted(_isInverted);
    }
}
项目:swerve-code    文件SwerveModule.java   
/**
 * Swerve Module basic constructor without drive PID
 * 
 * @param _spinController
 * @param _driveController
 * @param _spinEncoder
 */
public SwerveModule(SpeedController _spinController,SpeedController _driveController,Encoder _spinEncoder) {
    this.name = "";
    this.spinController = _spinController;
    this.driveController = _driveController;
    this.spinEncoder = _spinEncoder;
    this.driveEncoder = null;
    spinLoop = new PIDLoop("" + this.spinController.toString(),.1,new PIDEncoder(this.spinEncoder)); // generic PID values in here,they need to be tuned or input
}
项目:swerve-code    文件SwerveModule.java   
/**
 * Swerve Module basic constructor
 * 
 * @param _spinController SpeedController of the spin motor
 * @param _driveController SpeedController of the drive motor
 * @param _spinEncoder Encoder to tell the angle of the drive wheel (may be changed to a Potentiometer)
 * @param _driveEncoder Encoder to tell the position of the drive wheel (may be changed to a Potentiometer)
 */
public SwerveModule(SpeedController _spinController,Encoder _spinEncoder,Encoder _driveEncoder) {
    this.name = "";
    this.spinController = _spinController;
    this.driveController = _driveController;
    this.spinEncoder = _spinEncoder;
    this.driveEncoder = _driveEncoder;
    spinLoop = new PIDLoop("" + this.spinController.toString(),they need to be tuned or input
    driveLoop = new PIDLoop("" + this.driveController.toString(),new PIDEncoder(this.driveEncoder));
}
项目:swerve-code    文件SwerveModule.java   
/**
 * Swerve Module constructor with a name
 * 
 * @param _name the name of the module
 * @param _spinController SpeedController of the spin motor
 * @param _driveController SpeedController of the drive motor
 * @param _spinEncoder Encoder to tell the angle of the drive wheel (may be changed to a Potentiometer)
 * @param _driveEncoder Encoder to tell the position of the drive wheel (may be changed to a Potentiometer)
 */
public SwerveModule(String _name,SpeedController _spinController,Encoder _driveEncoder) {
    this.name = _name;
    this.spinController = _spinController;
    this.driveController = _driveController;
    this.spinEncoder = _spinEncoder;
    this.driveEncoder = _driveEncoder;
    spinLoop = new PIDLoop(this.name + "spin",they need to be tuned or input
    driveLoop = new PIDLoop(this.name + "drive",new PIDEncoder(this.driveEncoder));
}
项目:PCRobotClient    文件Robot.java   
public void reset() {
    for (int i = 0; i < motors.length; i++) {
        if (motors[i] == null) {
            continue;
        }
        if (motors[i] instanceof CANTalon) {
            ((CANTalon) motors[i]).delete();
        } else if (motors[i] instanceof Victor) {
            ((Victor) motors[i]).free();
        }
    }
    motors = new SpeedController[64];

    for (int i = 0; i < solenoids.length; i++) {
        if (solenoids[i] == null) {
            continue;
        }
        solenoids[i].free();
    }
    solenoids = new Solenoid[64];

    for (int i = 0; i < relays.length; i++) {
        if (relays[i] == null) {
            continue;
        }
        relays[i].free();
    }
    relays = new Relay[64];

    for (int i = 0; i < analogInputs.length; i++) {
        if (analogInputs[i] == null) {
            continue;
        }
        analogInputs[i].free();
    }
    analogInputs = new AnalogInput[64];

    if (compressor != null)
    compressor.free();
}
项目:2016    文件ManipulatorArm.java   
public ManipulatorArm (SpeedController armMotorController,SpeedController intakeMotor,Robotpotentiometer armPot,irsensor ballIsInArmSensor)
{
    this.motor = armMotorController;
    this.armPot = armPot;
    this.intakeMotor = intakeMotor;
    this.hasBallSensor = ballIsInArmSensor;
}
项目:2016    文件TransmissionMecanum.java   
/** Transmission class to control a four-wheel mecanum drive robot.
    *
    * @param rightFrontSpeedController
    * @param rightRearSpeedController
    * @param leftFrontSpeedController
    * @param leftRearSpeedController
*
    * @author Noah Golmant
    *         #written 23 July 2015 */
   public TransmissionMecanum (SpeedController rightFrontSpeedController,SpeedController rightRearSpeedController,SpeedController leftFrontSpeedController,SpeedController leftRearSpeedController)
       {
       super(rightFrontSpeedController,rightRearSpeedController,leftFrontSpeedController,leftRearSpeedController);

       }
项目:2016    文件Transmission_old.java   
/**
 * This function allows a transmission to control the
 * power of two speed controllers based on the current
 * gear. This is used with the left and right
 * drive motors,rightSpeedController);
}
项目:2016    文件Transmission_old.java   
/**
 * This function allows a transmission to control the
 * power of two speed controllers based on the current
 * gear. This is most often used with the left and right
 * drive motors. This applies to any of the speed controllers
 * (either Jaguar or Victor). That is the
 * joystick that can be reversed if it is necessary.
 *
 * @method Controls
 * @param leftJoystickInputValue
 *            - a float value which is used to set
 *            the left motor speed to that value
 * @param leftSpeedController
 *            - controls the left motor
 * @param rightJoystickInputValue
 *            - a float value which is used to set
 *            the right motor speed to that value
 * @param rightSpeedController
 *            - controls the right motor
 * @author Bob brown
 * @written Sep 20,WhichJoystick.RIGHT_JOYSTICK);
}
项目:Stronghold2016    文件GearBox.java   
public GearBox(SpeedController motor1,SpeedController motor2,SpeedController motor3,DoubleSolenoid shifter) {
    m_motor1 = motor1;
    m_motor2 = motor2;
    m_motor3 = motor3;

    m_encoder = encoder;
    m_shifter = shifter;
}
项目:snobot-2017    文件SnobotDriveTrain.java   
/**
 * Takes 2 speed controllers and joy stick arguments
 * 
 * @param aSpeedControllerLeft
 *            Argument for left Speed Controller
 * @param aSpeedControllerRight
 *            Argument for right Speed Controller
 * @param aDriverJoystick
 *            Argument Driver Joy stick
 */
public SnobotDriveTrain(
        SpeedController aSpeedControllerLeft,SpeedController aSpeedControllerRight,DriverJoystick aDriverJoystick)
{
    mSpeedControllerLeft = aSpeedControllerLeft;
    mSpeedControllerRight = aSpeedControllerRight;
    mRobotDrive = new RobotDrive(mSpeedControllerLeft,mSpeedControllerRight);
    mJoystick = aDriverJoystick;

    mRobotDrive.setSafetyEnabled(false);
}
项目:snobot-2017    文件SnobotShooter.java   
public SnobotShooter(SpeedController aShooterMotor,Solenoid aShooterSolenoid,OperatorJoystick aShooterJoystick)
{
    mShooterJoystick = aShooterJoystick;
    mShooterSolenoid = aShooterSolenoid;
    mShooterMotor = aShooterMotor;
       mIncreaseSpeedButton = new LatchedButton();
       mDecreaseSpeedButton = new LatchedButton();
}
项目:snobot-2017    文件SnobotDriveTrain.java   
public SnobotDriveTrain(
        SpeedController aLeftMotor,Encoder aLeftDriveEncoder,Encoder aRightDriveEncoder,IDriverJoystick aDriverJoystick,ILogger aLogger)
{
    super(aLeftMotor,null,aDriverJoystick,aLogger);
    mLeftDriveEncoder = aLeftDriveEncoder;
    mRightDriveEncoder = aRightDriveEncoder;

    mLeftDriveEncoder.setdistancePerpulse(Properties2017.sLEFT_ENCODER_disT_PER_pulse.getValue());
    mRightDriveEncoder.setdistancePerpulse(Properties2017.sRIGHT_ENCODER_disT_PER_pulse.getValue());
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。