当前位置: 首页>>代码示例>>Java>>正文


Java SpeedController类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.SpeedController的典型用法代码示例。如果您正苦于以下问题:Java SpeedController类的具体用法?Java SpeedController怎么用?Java SpeedController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SpeedController类属于edu.wpi.first.wpilibj包,在下文中一共展示了SpeedController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calibrateMotor

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
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);

}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:20,代码来源:PWMMotorCalibration.java

示例2: getSpeedController

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
@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;
        }
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:18,代码来源:MecanumTransmission.java

示例3: getSpeedController

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:18,代码来源:TractionTransmission.java

示例4: getSpeedController

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:18,代码来源:TankTransmission.java

示例5: Transmission_old

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
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();
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:25,代码来源:Transmission_old.java

示例6: controls

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:37,代码来源:Transmission_old.java

示例7: SnobotDriveTrainWithEncoders

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
/**
   * @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());

   }
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:34,代码来源:SnobotDriveTrainWithEncoders.java

示例8: ShooterControl

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
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, m_encoder,(-1)*m_speedControllerMaxRpm/4,m_speedControllerMaxRpm,0.05, 3);
    m_gearControl = gearControl;
    m_latchReleased = false;
    m_gearReleased = false;
    m_isPulledBack = false;
}
 
开发者ID:Dinoyan,项目名称:FRC-2014-robot-project,代码行数:21,代码来源:ShooterControl.java

示例9: SwervePod

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
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
}
 
开发者ID:Whillikers,项目名称:SwerveDrive,代码行数:26,代码来源:SwervePod.java

示例10: RobotDrive6

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:CarmelRobotics,项目名称:aeronautical-facilitation,代码行数:41,代码来源:RobotDrive6.java

示例11: RobotDriveSteering

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:BreakerBots,项目名称:Felix-2014,代码行数:30,代码来源:RobotDriveSteering.java

示例12: DriveTrainSubsystem

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
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);
}
 
开发者ID:SaratogaMSET,项目名称:649code2014,代码行数:17,代码来源:DriveTrainSubsystem.java

示例13: Shooter

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:grt192,项目名称:2013ultimate-ascent,代码行数:28,代码来源:Shooter.java

示例14: RelativeSpeedController

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:29,代码来源:RelativeSpeedController.java

示例15: getController

import edu.wpi.first.wpilibj.SpeedController; //导入依赖的package包/类
/**
 * 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];
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:15,代码来源:FRCSpeedControllers.java


注:本文中的edu.wpi.first.wpilibj.SpeedController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。