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

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

项目:Steamwork_2017    文件Robot.java   
public Robot() {
    stick = new Joystick(0);
    driveLeftFront = new Victor(LEFT_FRONT_DRIVE);
    driveLeftRear = new Victor(LEFT_REAR_DRIVE);
    driveRightFront = new Victor(RIGHT_FRONT_DRIVE);
    driveRightRear = new Victor(RIGHT_REAR_DRIVE);
    enhancedDriveLeft = new Victor(ENHANCED_LEFT_DRIVE);
    enhancedDriveRight = new Victor(ENHANCED_RIGHT_DRIVE);
    gearBox = new DoubleSolenoid(GEAR_Box_PART1,GEAR_Box_PART2);
    climber1 = new Victor(climBER_PART1);
    climber2 = new Victor(climBER_PART2);
    vexSensorBackLeft = new Ultrasonic(0,1);
    vexSensorBackRight = new Ultrasonic(2,3);
    vexSensorFrontLeft = new Ultrasonic(4,5);
    vexSensorFrontRight = new Ultrasonic(6,7);

    Skylar = new RobotDrive(driveLeftFront,driveLeftRear,driveRightFront,driveRightRear);
    OptimusPrime = new RobotDrive(enhancedDriveLeft,enhancedDriveRight);
}
项目:2014-Aerial-Assist    文件Robottemplate.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotinit() {
    // instantiate the command used for the autonomous period
    autonomousCommand = new ExampleCommand();

    frontLeft = new Victor(1); // Creating Victor motors
    frontRight = new Victor(2);
    rearLeft = new Victor(3);
    rearRight = new Victor(4);

    myDrive = new RobotDrive(frontLeft,frontRight);
    // myDrive = new RobotDrive(frontLeft,frontRight,rearLeft,rearRight);

    driveStick = new Joystick(1);

    gyro = new Gyro(1);

    // Initialize all subsystems
    CommandBase.init();
}
项目:aeronautical-facilitation    文件DriveTrain.java   
/**
 *
 */
public DriveTrain() {
    super("DriveTrain");

    FLeftMotor = new Victor(RobotMap.FLeftMotorPWM);
    FRightMotor = new Victor(RobotMap.FRightMotorPWM);
    BLeftMotor = new Victor(RobotMap.BLeftMotorPWM);
    BRightMotor = new Victor(RobotMap.BRightMotorPWM);
    //MLeftMotor = new Victor(RobotMap.MLeftMotorPWM);
    //MRightMotor = new Victor(RobotMap.MRightMotorPWM);
    drive = new RobotDrive(FLeftMotor,BLeftMotor,FRightMotor,BRightMotor);
    //drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
    //drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft,true);

    GShiftSolDown = new Solenoid(RobotMap.DriveTrainLowGearSolenoid);
    GShiftSolUp = new Solenoid(RobotMap.DriveTrainHighGearSolenoid);
    display = DriverStationLCD.getInstance();
}
项目:PainTrain    文件PainTrain.java   
public PainTrain(){
    m_leftGearBox   = new ThreeCimBallShifter(  new Victor(1),new Victor(2),new Victor(3),new DoubleSolenoid (1,2) );

    m_rightGearBox  = new ThreeCimBallShifter(  new Victor(4),new Victor(5),new Victor(6));

    m_shooter       = new Shooter(7,8,7,9);
    m_intake        = new Intake( 3,5,10 );
    m_encodeLeft = new Encoder(2,3);
    m_encodeRight = new Encoder(5,6);

    m_compressor    = new Compressor(1,4);
    m_compressor.start();
}
项目:Nashoba-Robotics2014    文件Loader.java   
public void init() {
    if(!hasInit) {
        left = new Victor(Hardwaredefines.RIGHT_LOADER_VICTOR);
        try {
            right = new CANJaguar(Hardwaredefines.LEFT_LOADER_JAG);
        }
        catch(CANTimeoutException e) {
            System.out.println("Could not instantiate left loader jag!");
        }
        hasInit = true;
    }
    else {
        System.out.println("The loader subsystem has already "
                                        + "been initialized!");
        return;
    }
}
项目: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);
}
项目:2012    文件Loader.java   
public Loader()
{
    Conveyor = new Victor(ReboundRumble.LOADER_CONVEYOR_PWM);
    loaderInSolenoid = new Solenoid(ReboundRumble.LOADER_IN_SOLENOID_CHANNEL);
    loaderOutSolenoid = new Solenoid(ReboundRumble.LOADER_OUT_SOLENOID_CHANNEL);
    loaderUpSolenoid = new Solenoid(ReboundRumble.LOADER_UP_SOLENOID_CHANNEL);
    loaderDownSolenoid = new Solenoid(ReboundRumble.LOADER_DOWN_SOLENOID_CHANNEL);
    loaderIn = new DigitalInput(ReboundRumble.LOAD_IN_GPIO_CHANNEL);
    loaderOut = new DigitalInput(ReboundRumble.LOAD_OUT_GPIO_CHANNEL);
    loaderUp = new DigitalInput(ReboundRumble.LOAD_UP_GPIO_CHANNEL);
    loaderDown = new DigitalInput(ReboundRumble.LOAD_DOWN_GPIO_CHANNEL);
    loaderDownSolenoid.set(false);
    loaderUpSolenoid.set(true);
    loaderOutSolenoid.set(false);
    loaderInSolenoid.set(true);
}
项目:bainbridgefirst    文件Robottemplate.java   
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotinit() {
    // instantiate the command used for the autonomous period
    autonomousCommand = new ExampleCommand();

    frontLeft = new Victor(1); // Creating Victor motors
    frontRight = new Victor(2);
    rearLeft = new Victor(3);
    rearRight = new Victor(4);

    myDrive = new RobotDrive(frontLeft,rearRight);

    driveStick = new Joystick(1);

    gyro = new Gyro(1);

    // Initialize all subsystems
    CommandBase.init();
}
项目:EventBasedWiredCats    文件SystemShooter.java   
public SystemShooter() {
    super();
    wheel1 = new Victor(5); // Both bots: 5
    wheel2 = new Victor(6); // Both bots: 6

    cockOn = new Solenoid(4); //competition: 4 / practice: 1
    cockOff = new Solenoid(3); //competition: 3 / practice: 2
    fireOn = new Solenoid(6); // competition: 6 / practice: 5
    fireOff = new Solenoid(5); // competition: 5 / practice 6
    gateUp = new Solenoid(1); // competition: 1 / practice 3
    gateDown = new Solenoid(2); // competition: 2 / practice 4

    autoShoot = false;
    isShootingAngle = true;

    frisbeesShot = 0;

    enteringLoop = false;

    cockTime = WiredCats2415.textReader.getValue("cockTime");
    gatesDownTime = WiredCats2415.textReader.getValue("gatesDownTime");
    fireTime = WiredCats2415.textReader.getValue("fireTime");

    System.out.println("[WiredCats] Initialized System Shooter");
}
项目:EventBasedWiredCats    文件SystemArm.java   
public SystemArm(ControllerShooter cs) {
    super();
    this.shooter = cs;

    arm = new Victor(3); // Both bots: 3
    kp = WiredCats2415.textReader.getValue("propConstantArm");
    ki = WiredCats2415.textReader.getValue("integralConstantArm");
    kd = WiredCats2415.textReader.getValue("derivativeConstantArm");

    intakePreset = WiredCats2415.textReader.getValue("intakePreset");
    backPyramidPreset = WiredCats2415.textReader.getValue("backPyramidPreset");
    frontPyramidPreset = WiredCats2415.textReader.getValue("frontPyramidPreset");
    hoverPreset = WiredCats2415.textReader.getValue("hoverPreset");
    upperBoundHardStop = WiredCats2415.textReader.getValue("upperBoundHardStop");

    desiredArmAngle = 0;

    isManualControl = false;

    armHasBeenReset = false;

    System.out.println("[WiredCats] Initialized System Arm.");
}
项目:frc1675-2013    文件RightTankDrivePIDSubsystem.java   
public RightTankDrivePIDSubsystem() {
    super("LeftTankDrivePIDSubsystem",Kp,Ki,Kd);

    // Use these to get going:
    // setSetpoint() -  Sets where the PID controller should move the system
    //                  to
    // enable() - Enables the PID controller.
    frontRightMotor = new Victor(RobotMap.FRONT_RIGHT_DRIVE_MOTOR);
    backRightMotor = new Victor(RobotMap.BACK_RIGHT_DRIVE_MOTOR);

    rightEncoder = new Encoder(RobotMap.FRONT_RIGHT_ENCODER_A,RobotMap.FRONT_RIGHT_ENCODER_B);
    rightEncoder.start();
    rightEncoder.setdistancePerpulse(1.0);

    rampTimer = new Timer();
    rampTimer.start();
}
项目:frc1675-2013    文件LeftTankDrivePIDSubsystem.java   
public LeftTankDrivePIDSubsystem() {
    super("LeftTankDrivePIDSubsystem",Kd);

    // Use these to get going:
    // setSetpoint() -  Sets where the PID controller should move the system
    //                  to
    // enable() - Enables the PID controller.
    frontLeftMotor = new Victor(RobotMap.FRONT_LEFT_DRIVE_MOTOR);
    backLeftMotor = new Victor(RobotMap.BACK_LEFT_DRIVE_MOTOR);

    leftEncoder = new Encoder(RobotMap.FRONT_LEFT_ENCODER_A,RobotMap.FRONT_LEFT_ENCODER_B);
    leftEncoder.start();
    leftEncoder.setdistancePerpulse(1.0);

    rampTimer = new Timer();
    rampTimer.start();
}
项目:SteamWorks    文件RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTrainLeftFront = new Victor(0);
    LiveWindow.addActuator("DriveTrain","LeftFront",(Victor) driveTrainLeftFront);

    driveTrainLeftRear = new Victor(1);
    LiveWindow.addActuator("DriveTrain","LeftRear",(Victor) driveTrainLeftRear);

    driveTrainRightFront = new Victor(2);
    LiveWindow.addActuator("DriveTrain","RightFront",(Victor) driveTrainRightFront);

    driveTrainRightRear = new Victor(3);
    LiveWindow.addActuator("DriveTrain","RightRear",(Victor) driveTrainRightRear);

    driveTrainRobotDrive = new RobotDrive(driveTrainLeftFront,driveTrainLeftRear,driveTrainRightFront,driveTrainRightRear);

    driveTrainRobotDrive.setSafetyEnabled(false);
    driveTrainRobotDrive.setExpiration(0.1);
    driveTrainRobotDrive.setSensitivity(1.0);
    driveTrainRobotDrive.setMaxOutput(1.0);

    shootershooterTalon = new CANTalon(0);
    LiveWindow.addActuator("Shooter","shooterTalon",shootershooterTalon);


// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    // set this up
    gyro = new ADXRS450_Gyro();
}
项目:frc-2016    文件Intake.java   
public Intake() {
    Actuator = new DoubleSolenoid(RobotMap.solenoid.IntakeSolenoidForwards,RobotMap.solenoid.IntakeSolenoidBackwards);
    IntakeCIM = new Victor(RobotMap.Pwm.MainIntakevictor);
    IntakeCIM2 = new Victor(RobotMap.Pwm.CrossIntakevictor);

}
项目:frc-2016    文件Aimshooter.java   
public Aimshooter() {

        pot = new AnalogInput(RobotMap.Analog.ShooterPotAngle);
        pot.setPIDSourceType(PIDSourceType.kdisplacement);
        motor = new Victor(RobotMap.Pwm.ShooterangleMotor);

        anglePID = new PIDSpeedController(pot,motor,"anglePID","Aimshooter");

        updatePIDConstants();
        anglePID.set(0);
    }
项目: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();
}
项目:turtleshell    文件Robot.java   
public Robot() {
    stick = new Joystick(0);
    try {
        /* Construct Digital I/O Objects */
        pwm_out_9 = new Victor(        getChannelFromPin( PinType.PWM,9 ));
        pwm_out_8 = new Jaguar(        getChannelFromPin( PinType.PWM,8 ));
        dig_in_7  = new DigitalInput(  getChannelFromPin( PinType.DigitalIO,7 ));
        dig_in_6  = new DigitalInput(  getChannelFromPin( PinType.DigitalIO,6 ));
        dig_out_5 = new DigitalOutput( getChannelFromPin( PinType.DigitalIO,5 ));
        dig_out_4 = new DigitalOutput( getChannelFromPin( PinType.DigitalIO,4 ));
        enc_3and2 = new Encoder(       getChannelFromPin( PinType.DigitalIO,3 ),getChannelFromPin( PinType.DigitalIO,2 ));
        enc_1and0 = new Encoder(       getChannelFromPin( PinType.DigitalIO,1 ),0 ));

        /* Construct Analog I/O Objects */
        /* NOTE:  Due to a board layout issue on the navX MXP board revision */
        /* 3.3,there is noticeable crosstalk between AN IN pins 3,2 and 1. */
        /* For that reason,use of pin 3 and pin 2 is NOT RECOMMENDED.       */
        an_in_1   = new AnalogInput(   getChannelFromPin( PinType.AnalogIn,1 ));
        an_trig_0 = new AnalogTrigger( getChannelFromPin( PinType.AnalogIn,0 ));
        an_trig_0_counter = new Counter( an_trig_0 );

        an_out_1  = new Analogoutput(  getChannelFromPin( PinType.Analogout,1 ));
        an_out_0  = new Analogoutput(  getChannelFromPin( PinType.Analogout,0 ));

        /* Configure I/O Objects */
        pwm_out_9.setSafetyEnabled(false); /* disable Motor Safety for Demo */
        pwm_out_8.setSafetyEnabled(false); /* disable Motor Safety for Demo */

        /* Configure Analog Trigger */
        an_trig_0.setAveraged(true);
        an_trig_0.setLimitsVoltage(MIN_AN_TRIGGER_VOLTAGE,MAX_AN_TRIGGER_VOLTAGE);
    } catch (RuntimeException ex ) {
        DriverStation.reportError( "Error instantiating MXP pin on navX MXP:  " 
                                    + ex.getMessage(),true);
    }
}
项目:turtleshell    文件Claw.java   
public Claw() {
      super();
      motor = new Victor(7);
      contact = new DigitalInput(5);

// Let's show everything on the LiveWindow
      LiveWindow.addActuator("Claw","Motor",(Victor) motor);
      LiveWindow.addActuator("Claw","Limit Switch",contact);
  }
项目:2015RobotCode    文件ArmElevator.java   
@Override
public void initialize() {

    m_victor = new Victor(RobotMap.LIFT_MOTOR);
    m_victor.enableDeadbandElimination(true);
    m_victor.setExpiration(Victor.DEFAULT_SAFETY_EXPIRATION);

    m_encoder = new Encoder(RobotMap.ENCODER_dio_PORTA,RobotMap.ENCODER_dio_PORTB,true);
    m_encoder.setSamplesToAverage(10);

    m_maxLimit = new DigitalInput(RobotMap.LIMIT_dio_PORT1);
    max_counter = new Counter(m_maxLimit);

}
项目:4500-2014    文件Winch.java   
Winch(JoyStickCustom inStick){
    winchRelease=new Pneumatics(1,2);
    winch= new Victor(5);

    states[0]="WINDING";
    states[1]="RELEASING";
    states[2]="HOLDING";
    setState(HOLDING1);//same as holding used to be

    limitSwitch= new DigitalInput(4);

    secondStick = inStick;
    winchE= new Encoder(3,2);
    winchE.start();
}
项目:4500-2014    文件Robottemplate.java   
public void robotinit(){
    driveStick= new JoyStickCustom(1,DEADZONE);
    secondStick=new JoyStickCustom(2,DEADZONE);

    frontLeft= new Talon(1);
    rearLeft= new Talon(2);
    frontRight= new Talon(3);
    rearRight= new Talon(4);

    timer=new Timer();
    timer.start();

    armM = new Victor(7);
    rollers =new Victor(6);

    mainDrive=new RobotDrive(frontLeft,rearRight);

    mainDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight,true);
    mainDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight,true);

    armP = new AnalogPotentiometer(1);
    distance= new AnalogChannel(2);
    ultra=new Ultrasonic(6,7);
    ultra.setAutomaticMode(true);

    compress=new Compressor(5,1);

    handJoint=new Pneumatics(3,4);

    //ultra = new Ultrasonic(6,5);
    //ultra.setAutomaticMode(true);

    winch = new Winch(secondStick);

}
项目:Team3310FRC2014    文件EncoderPIDSubsystem.java   
public EncoderPIDSubsystem(String name,double kP,double kI,double kD,int motorChannel,int encoderAChannel,int encoderBChannel,boolean reverseEncoder,double gearRatioEncoderToOutput) {
    super(name,kP,kI,kD);
    try {
        m_motorController = new Victor(motorChannel);
        m_encoder = new Encoder(1,encoderAChannel,1,encoderBChannel,reverseEncoder,CounterBase.EncodingType.k4X);
        double degPerpulse = 360.0 / gearRatioEncoderToOutput / DEFAULT_pulseS_PER_ROTATION;
        m_encoder.setdistancePerpulse(degPerpulse);
        resetZeroPosition();
    } catch (Exception e) {
        System.out.println("UnkNown error initializing " + getName() + "-EncoderPIDSubsystem.  Message = " + e.getMessage());
    }
}
项目:Team3310FRC2014    文件EncoderPIDSubsystem.java   
public EncoderPIDSubsystem(String name,double wheelDiameter,double gearRatioEncoderToWheel) {
    super(name,CounterBase.EncodingType.k4X);
        double distancePerpulse = Math.PI * wheelDiameter / gearRatioEncoderToWheel / DEFAULT_pulseS_PER_ROTATION;
        m_encoder.setdistancePerpulse(distancePerpulse);
        resetZeroPosition();
    } catch (Exception e) {
        System.out.println("UnkNown error initializing " + getName() + "-EncoderPIDSubsystem.  Message = " + e.getMessage());
    }
}
项目:Team3310FRC2014    文件Intake.java   
public Intake() {
    super("Intake",RobotMap.INTAKE_EXTEND_PNEUMATIC_MODULE_ID,RobotMap.INTAKE_EXTEND_PNEUMATIC_RELAY_ID,RobotMap.INTAKE_RETRACT_PNEUMATIC_MODULE_ID,RobotMap.INTAKE_RETRACT_PNEUMATIC_RELAY_ID);
    try {
        m_ballDetectSwitch1 = new DigitalInput(RobotMap.BALL_INTAKE_1_DSC_dio_ID);
        m_motorControllerTop = new Victor(RobotMap.INTAKE_TOP_DSC_PWM_ID);
        m_motorControllerBottom = new Victor(RobotMap.INTAKE_BottOM_DSC_PWM_ID);             
    } catch (Exception e) {
        System.out.println("UnkNown error initializing " + getName() + ".  Message = " + e.getMessage());
    }
}
项目:Team3310FRC2014    文件MotorTest.java   
public MotorTest(int numMotors) {
    super("MotorTestSubsystem");

    try {
        m_motorController = new Victor[numMotors];

        for (int motorId = 0; motorId < numMotors; motorId++) {
            m_motorController[motorId] = new Victor(motorId+1);
        }
    } catch (Exception e) {
        System.out.println("UnkNown error initializing " + getName() + ".  Message = " + e.getMessage());
    }
}
项目:2013_drivebase_proto    文件WsDriveSpeed.java   
public WsDriveSpeed(String name,int channel1,int channel2) {
    this.motorSpeed = new DoubleSubject(name);
    this.victor1 = new Victor(channel1);
    this.victor2 = new Victor(channel2);

    motorSpeed.setValue(0.0);
}
项目:Robot2014    文件Winch.java   
/**
 * the winch of the shooter device
 */
public Winch() {
    rightMotor = new Victor(RobotMap.rightShooterMotor);
    leftMotor = new Victor(RobotMap.leftShooterMotor);
    limitSwitch = new DigitalInput(RobotMap.shooterLimitSwitch);
    winch = new Piston(RobotMap.shooterExtended,RobotMap.shooterRetracted);
}
项目:Robot2014    文件Drivetrain.java   
/**
 * controls the drive train motors of the robot
 */
public Drivetrain() {
    left = new Victor(RobotMap.leftMotors);
    leftTwo = new Victor(RobotMap.leftTwoMotors);
    right = new Victor(RobotMap.rightMotors);
    rightTwo = new Victor(RobotMap.rightTwoMotors);
}
项目:PainTrain    文件Shooter.java   
public Shooter(int encoderA,int encoderB,int victor1,int victor2,int victor3) {
    m_encode = new Encoder(encoderA,encoderB);
    m_encode.start();
    m_encode.reset();
    m_motor1 = new Victor(victor1);
    m_motor2 = new Victor(victor2);
    m_motor3 = new Victor(victor3);
    m_shoottimer = new Timer();
    m_retractTimer = new Timer();

}
项目:PainTrain    文件Intake.java   
Intake(int solenoid1Port1,int solenoid2Port1,int victorNumber){
    m_leftSolenoid  = new DoubleSolenoid(solenoid1Port1,solenoid1Port1 +1);
    m_rightSolenoid = new DoubleSolenoid(solenoid2Port1,solenoid2Port1 +1);
    m_intakeMotor   = new Victor(victorNumber);
    m_solenoidTime  = new NerdyTimer(.05);
    m_solenoidTime.start();
}
项目:TitanRobot2014    文件SpeedControllerFactory.java   
public TitanSpeedController create(int pChannel,Class<?> pClass,Switch pForwardLimitSwitch,Switch pReverseLimitSwitch,boolean pInvertDirection) {
    TitanSpeedController controller;
    if (pClass.equals(Talon.class)) {
        controller = new TitanSpeedController(new Talon(pChannel),pForwardLimitSwitch,pReverseLimitSwitch,pInvertDirection);
    }
    else if (pClass.equals(Victor.class)) {
        controller = new TitanSpeedController(new Victor(pChannel),pInvertDirection);
    }
    else {
        controller = new TitanSpeedController(new Jaguar(pChannel),pInvertDirection);
    }

    return controller;
}
项目:TitanRobot2014    文件SpeedControllerFactory.java   
public TitanSpeedController create(int pChannel,Class pClass,pInvertDirection);
    }

    return controller;
}
项目:Veer    文件O_SwerveModule.java   
public O_SwerveModule(O_Point center,int CimPort,int turnPort,int turnEncoderA,int turnEncoderB,int zeroPort,double zeroOffset,boolean reverseEncoder){
    location = center;
    cim = new Victor(RobotMap.driveModule,CimPort);
    cim.setExpiration(0.5);
    turnMotor = new Talon(RobotMap.turnModule,turnPort);
    turnMotor.setExpiration(0.5);
    turnEncoder = new O_TurnEncoder(turnEncoderA,turnEncoderB,zeroPort,zeroOffset,reverseEncoder);
    turn = new PIDController(1.0,0.1,turnEncoder,turnMotor,.0010) {{
        setInputRange(-180,180);
        setoutputRange(-.85,.85);
        setContinuous();
        enable();
    }};
}
项目:FRC-2015    文件MotorClass.java   
public void ControlToggleRunMotor(Victor vMotor,int speed) {
    if (!toggleMotor) {
        vMotor.set(speed);
        toggleMotor = true;
    }else if (toggleMotor) {
        vMotor.set(0.0);
        toggleMotor = false;
    }
}
项目:FRC-2015    文件MotorClass.java   
public void ControlHoldRunMotor(Victor vMotor,int speed,boolean holdingButton) {
    if (holdingButton) {
        vMotor.set(speed);
    }else{
        vMotor.set(0.0);
    }
}
项目:FRC-2015    文件MotorClass.java   
public void AutoRunMotor(Victor vMotor,int seconds) {
    queueThread(new Runnable() {
        public void run() {
            R.autonomousCounter = 0;
            while ((Math.floor(R.autonomousCounter / loopsPerSecond)) <= seconds) {
                vMotor.set(speed);
                Timer.delay(timerDelay);    
            }
            vMotor.set(0.0);
        }
    });
}
项目:FRC-2015-Robot-Java    文件RobotHardwareCompbot.java   
@Override
public void initialize()

{
    //PWM
    liftMotor = new Victor(0); //2);
    leftMotors = new Victor(1);
    rightMotors = new Victor(2); //0);
    armMotors = new Victor(3);
    transmission = new Servo(7);

    //CAN
    armSolenoid = new DoubleSolenoid(4,5);

    //dio
    liftEncoder = new Encoder(0,false,EncodingType.k4X);
    liftBottomLimit = new DigitalInput(2);
    liftTopLimit = new DigitalInput(3);
    backupLiftBottomLimit = new DigitalInput(5);

    switch1 = new DigitalInput(9);
    switch2 = new DigitalInput(8);

    //ANALOG
    gyro = new Gyro(0);

    //roboRio
    accelerometer = new BuiltInAccelerometer();

    //Stuff
    drivetrain = new RobotDrive(leftMotors,rightMotors);

    liftSpeedratio = 1; //Half power default
    liftGear = 1;
    driverSpeedratio = 1;
    debounceComp = 0;

    drivetrain.setInvertedMotor(MotorType.kRearLeft,true);
    drivetrain.setInvertedMotor(MotorType.kRearRight,true);
}
项目:649code2014    文件ClawPivotSubsystem.java   
public ClawPivotSubsystem() {
    super("ClawSubsystem");
    motor = new Victor(RobotMap.CLAW_PIVOT.MOTOR);
    potentiometer = new AnalogPotentiometer(RobotMap.CLAW_PIVOT.POTENTIOMETER);
    clawPID = new PIDController649(kP,kD,potentiometer,this);
    clawPID.setAbsolutetolerance(0.01);
    clawPID.setoutputRange(MAX_FORWARD_SPEED,MAX_BACKWARD_SPEED);
}
项目:2014-robot    文件Pickup.java   
/**
     * Creates a pickup object using the controlPack and sensorPack
     */
    public Pickup(){
        //motors
        rightPickupupdown = new Victor(Channels.PICKUP_RAISE_LOWER_RIGHT_CHANNEL);
        leftPickupupdown = new Victor(Channels.PICKUP_RAISE_LOWER_LEFT_CHANNEL);//was (1,CONSTANT)
        pickupRoller = new Victor(Channels.PICKUP_ROLLER_CHANNEL);

//        pickupEncoder = new Encoder(Channels.PICKUP_ENCODER_A_CHANNEL,Channels.PICKUP_ENCODER_B_CHANNEL);
//        sensors
//        pickupLoweredSwitch = new DigitalInput(Channels.PICKUP_LOWERED_CHANNEL);
//        pickupLiftedSwitch = new DigitalInput(Channels.PICKUP_RAISED_CHANNEL);

        controls = ControlPack.getInstance();
        System.out.println("Pickup online");
    }

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