Java 类edu.wpi.first.wpilibj.VictorSP 实例源码

项目:R2017    文件:Shooter.java   
public Shooter() {
    shooterMotor = new VictorSP(Constants.SHOOTER);
    shooterMotor2 = new VictorSP(Constants.SHOOTER_2);

    shooterMotor.setInverted(true);
    shooterMotor2.setInverted(true);

    hallEffect = new Counter(Constants.HALL_EFFECT);
    hallEffect.setDistancePerPulse(1);
}
项目:R2017    文件:DriveTrain.java   
public DriveTrain () {
    rightMotors = new VictorSP(Constants.DRIVETRAIN_RIGHT);
    leftMotors = new VictorSP(Constants.DRIVETRAIN_LEFT);

    rightMotors.setInverted(rightInverted);
    leftMotors.setInverted(leftInverted);

    encLeft = new Encoder(Constants.ENCODER_LEFT_1, Constants.ENCODER_LEFT_2);
    encLeft.setDistancePerPulse(Constants.DRIVEWHEEL_CIRCUMFERENCE / Constants.DRIVE_PULSES_PER_REVOLUTION);

    encRight = new Encoder(Constants.ENCODER_RIGHT_1, Constants.ENCODER_RIGHT_2);
    encRight.setDistancePerPulse(Constants.DRIVEWHEEL_CIRCUMFERENCE / Constants.DRIVE_PULSES_PER_REVOLUTION);
}
项目:FRC-2016-Robot-Code    文件:Robot.java   
public void robotInit() {

        frontLeft = new VictorSP(0);
        backLeft = new VictorSP(1);       
        frontRight = new VictorSP(2);
        backRight = new VictorSP(3);
        intakeMotor = new VictorSP(4);
        compressor = new Compressor(0);
        intakeSolenoid = new Solenoid(0);


        driveTrain = new RobotDrive(frontLeft, backLeft, frontRight, backRight);

        driveTrain.setSafetyEnabled(false);
        driveTrain.setExpiration(0.1);
        driveTrain.setSensitivity(0.5);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
        driveTrain.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);

        XboxController = new Joystick(2);

        rightJoystick = new Joystick(1);

        leftJoystick = new Joystick(0);
    }
项目:1797-2017    文件:RobotMap.java   
public static void init() {

        // Drivetrain
        DRIVETRAIN_ROBOT_DRIVE = new RobotDrive(0, 1);

        DRIVETRAIN_ENCODER_LEFT = new Encoder(0, 1);
        DRIVETRAIN_ENCODER_LEFT.setDistancePerPulse(0.0481);

        DRIVETRAIN_ENCODER_RIGHT = new Encoder(2, 3, true);
        DRIVETRAIN_ENCODER_RIGHT.setDistancePerPulse(0.0481);

        // Floor Gear
        FLOORGEAR_INTAKE = new VictorSP(2);
        FLOORGEAR_LIFTER = new DoubleSolenoid(0, 1);
        FLOORGEAR_BLOCKER = new DoubleSolenoid(2, 3);

        // Climber
        CLIMBER = new VictorSP(3);

        // Passive Gear
        SLOTGEAR_HOLDER = new DoubleSolenoid(4, 5);

        // Vision
        VISION_SERVER = CameraServer.getInstance();

        VISION_CAMERA = VISION_SERVER.startAutomaticCapture("FRONT", 0);

        VISION_CAMERA.getProperty("saturation").set(20);
        VISION_CAMERA.getProperty("gain").set(50);
        VISION_CAMERA.getProperty("exposure_auto").set(1);
        VISION_CAMERA.getProperty("brightness").set(50);
        VISION_CAMERA.getProperty("exposure_absolute").set(1);
        VISION_CAMERA.getProperty("exposure_auto_priority").set(0);

    }
项目:FRC-5800-Stronghold    文件:CommandMotor.java   
public CommandMotor(Subsystem5800 requiredSubsystem, VictorSP motor, double speed) {
    super(requiredSubsystem);
    this.motor = motor;
    this.speed = speed;
}
项目:FRC-5800-Stronghold    文件:CommandMotorTime.java   
public CommandMotorTime(Subsystem5800 requiredSubsystem, VictorSP motor, double speed, double timeout) {
    super(requiredSubsystem);
    this.setTimeout(speed);
    this.motor = motor;
    this.speed = speed;
}
项目:2017TestBench    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    motorsVictor0 = new VictorSP(0);
    LiveWindow.addActuator("Motors", "Victor0", (VictorSP) motorsVictor0);

    motorsVictor1 = new VictorSP(1);
    LiveWindow.addActuator("Motors", "Victor1", (VictorSP) motorsVictor1);


    LiveWindow.addActuator("Motors", "TalonSRX", (CANTalon) motorsCANTalon);

    electricalPowerDistributionPanel1 = new PowerDistributionPanel(0);
    LiveWindow.addSensor("Electrical", "PowerDistributionPanel 1", electricalPowerDistributionPanel1);

    sensorsAnalogGyro1 = new AnalogGyro(0);
    LiveWindow.addSensor("Sensors", "AnalogGyro 1", sensorsAnalogGyro1);
    sensorsAnalogGyro1.setSensitivity(0.007);


    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:R2017    文件:ClimberAndIntake.java   
public ClimberAndIntake(Controls controls) {
    this.controls = controls;

    climberIntakeMotor = new VictorSP(Constants.CLIMBER_INTAKE);
    climberIntakeMotor2 = new VictorSP(Constants.CLIMBER_INTAKE_2);
}
项目:R2017    文件:Indexer.java   
public Indexer() {
    indexerMotorBelt = new VictorSP(Constants.INDEXER_BELT);
    indexerMotorRoller = new VictorSP(Constants.INDEXER2_ROLLER);
}
项目:2017SteamBot2    文件:DriveTrain.java   
public DriveTrain() {
    Robot.logList.add(this);
    ahrs = new AHRS(RobotMap.Ports.AHRS);
    left = new VictorSP(RobotMap.Ports.leftDriveMotor);
    right = new VictorSP(RobotMap.Ports.rightDriveMotor);
    right.setInverted(true);

    final double gearRatio = 4/3;
    final double ticksPerRev = 2048;
    final double radius = 1.5;
    final double magic = 1/.737;
    final double calculated = (radius * 2 * Math.PI) * gearRatio * magic / ticksPerRev;

    ahrs.reset();

    leftEncoder = new Encoder(RobotMap.Ports.leftEncoderOne, RobotMap.Ports.leftEncoderTwo, true, EncodingType.k4X);
    leftEncoder.setDistancePerPulse(calculated);
    leftEncoder.setPIDSourceType(PIDSourceType.kRate);
    rightEncoder = new Encoder(RobotMap.Ports.rightEncoderOne, RobotMap.Ports.rightEncoderTwo, false, EncodingType.k4X);
    rightEncoder.setDistancePerPulse(calculated);
    rightEncoder.setPIDSourceType(PIDSourceType.kRate);

    leftPID = new PIDController(
            RobotMap.Values.driveTrainP, RobotMap.Values.driveTrainI,
            RobotMap.Values.driveTrainD, RobotMap.Values.driveTrainF, 
            new RateEncoder(leftEncoder), left);
    leftPID.setInputRange(-300, 300);
    leftPID.setOutputRange(-1, 1);
    rightPID = new PIDController(
            RobotMap.Values.driveTrainP, RobotMap.Values.driveTrainI,
            RobotMap.Values.driveTrainD, RobotMap.Values.driveTrainF, 
            new RateEncoder(rightEncoder), right);
    rightPID.setInputRange(-300, 300);
    rightPID.setOutputRange(-1, 1);

    // Let's show everything on the LiveWindow
    LiveWindow.addActuator("Drive Train", "Left Motor", (VictorSP) left);
    LiveWindow.addActuator("Drive Train", "Right Motor", (VictorSP) right);
    LiveWindow.addSensor("Drive Train", "Left Encoder", leftEncoder);
    LiveWindow.addSensor("Drive Train", "Right Encoder", rightEncoder);
    LiveWindow.addSensor("Drive Train", "Gyro", ahrs);
    LiveWindow.addActuator("Drive Train", "PID", leftPID);

}
项目:2016-Robot-Final    文件:Drive.java   
public Drive() {
// Instantiate VictorSPs
leftFront = new VictorSP(RobotMap.DriveMap.PWM_LEFT_FRONT);
leftBack = new VictorSP(RobotMap.DriveMap.PWM_LEFT_BACK);
rightFront = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_FRONT);
rightBack = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_BACK);

// Create list of motors
leftMotors = new ArrayList<SpeedController>();
leftMotors.add(leftFront);
leftMotors.add(leftBack);

rightMotors = new ArrayList<SpeedController>();
rightMotors.add(rightFront);
rightMotors.add(rightBack);

// Instantiate Encoders
leftEncoder = new Encoder(RobotMap.DriveMap.DIO_ENCODER_LEFT_A, RobotMap.DriveMap.DIO_ENCODER_LEFT_B);
rightEncoder = new Encoder(RobotMap.DriveMap.DIO_ENCODER_RIGHT_A, RobotMap.DriveMap.DIO_ENCODER_RIGHT_B);

// Invert VictorSPs
leftFront.setInverted(RobotMap.DriveMap.INV_LEFT_FRONT);
leftBack.setInverted(RobotMap.DriveMap.INV_LEFT_BACK);
rightFront.setInverted(RobotMap.DriveMap.INV_RIGHT_FRONT);
rightBack.setInverted(RobotMap.DriveMap.INV_RIGHT_BACK);

// Invert Encoders
// leftEncoder.setReverseDirection(RobotMap.DriveMap.INV_ENCODER_LEFT);
// rightEncoder.setReverseDirection(RobotMap.DriveMap.INV_ENCODER_RIGHT);

// Set distance per pulse
leftEncoder.setDistancePerPulse(RobotMap.DriveMap.DISTANCE_PER_PULSE);
rightEncoder.setDistancePerPulse(RobotMap.DriveMap.DISTANCE_PER_PULSE);

// Instantiate solenoid
solenoid = new DoubleSolenoid(RobotMap.DriveMap.SOL_FORWARD, RobotMap.DriveMap.SOL_REVERSE);

// Instantiate drivesides

leftSide = new DriveSide(leftMotors, leftEncoder);
rightSide = new DriveSide(rightMotors, rightEncoder);
   }
项目:2016-Robot    文件:Drive.java   
public Drive() {
// Instantiate VictorSPs
leftFront = new VictorSP(RobotMap.DriveMap.PWM_LEFT_FRONT);
leftBack = new VictorSP(RobotMap.DriveMap.PWM_LEFT_BACK);
rightFront = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_FRONT);
rightBack = new VictorSP(RobotMap.DriveMap.PWM_RIGHT_BACK);

// Create list of motors
leftMotors = new ArrayList<SpeedController>();
leftMotors.add(leftFront);
leftMotors.add(leftBack);

rightMotors = new ArrayList<SpeedController>();
rightMotors.add(rightFront);
rightMotors.add(rightBack);

// Instantiate Encoders
leftEncoder = new Encoder(RobotMap.DriveMap.DIO_ENCODER_LEFT_A, RobotMap.DriveMap.DIO_ENCODER_LEFT_B);
rightEncoder = new Encoder(RobotMap.DriveMap.DIO_ENCODER_RIGHT_A, RobotMap.DriveMap.DIO_ENCODER_RIGHT_B);

// Invert VictorSPs
leftFront.setInverted(RobotMap.DriveMap.INV_LEFT_FRONT);
leftBack.setInverted(RobotMap.DriveMap.INV_LEFT_BACK);
rightFront.setInverted(RobotMap.DriveMap.INV_RIGHT_FRONT);
rightBack.setInverted(RobotMap.DriveMap.INV_RIGHT_BACK);

// Invert Encoders
// leftEncoder.setReverseDirection(RobotMap.DriveMap.INV_ENCODER_LEFT);
// rightEncoder.setReverseDirection(RobotMap.DriveMap.INV_ENCODER_RIGHT);

// Set distance per pulse
leftEncoder.setDistancePerPulse(RobotMap.DriveMap.DISTANCE_PER_PULSE);
rightEncoder.setDistancePerPulse(RobotMap.DriveMap.DISTANCE_PER_PULSE);

// Instantiate solenoid
solenoid = new DoubleSolenoid(RobotMap.DriveMap.SOL_FORWARD, RobotMap.DriveMap.SOL_REVERSE);

// Instantiate drivesides

leftSide = new DriveSide(leftMotors, leftEncoder);
rightSide = new DriveSide(rightMotors, rightEncoder);
   }
项目:r2016    文件:SpeedControllerSubsystem.java   
public SpeedControllerSubsystem(SpeedControllerSubsystemType type, final int channel) {
    switch(type) {
    case CAN_JAGUAR:
        this._controller = new CANJaguar(channel);
        break;

    case CAN_TALON:
        this._controller = new CANTalon(channel);
        break;

    case JAGUAR:
        this._controller = new Jaguar(channel);
        break;

    case SD540:
        this._controller = new SD540(channel);
        break;

    case SPARK:
        this._controller = new Spark(channel);
        break;

    case TALON:
        this._controller = new Talon(channel);
        break;

    case TALON_SRX:
        this._controller = new TalonSRX(channel);
        break;

    case VICTOR:
        this._controller = new Victor(channel);
        break;

    case VICTOR_SP:
        this._controller = new VictorSP(channel);
        break;

    default:
        break;
    }
}
项目:1797-2017    文件:RobotMap.java   
public static void init() {

        // Drivetrain
        DRIVETRAIN_ROBOT_DRIVE = new RobotDrive(0, 1);

        DRIVETRAIN_ENCODER_LEFT = new Encoder(0, 1);
        DRIVETRAIN_ENCODER_LEFT.setDistancePerPulse(0.0481);

        DRIVETRAIN_ENCODER_RIGHT = new Encoder(2, 3, true);
        DRIVETRAIN_ENCODER_RIGHT.setDistancePerPulse(0.0481);

        // Floor Gear
        FLOORGEAR_INTAKE = new VictorSP(2);
        FLOORGEAR_LIFTER = new DoubleSolenoid(0, 1);
        FLOORGEAR_BLOCKER = new DoubleSolenoid(2, 3);

        // Climber
        CLIMBER = new VictorSP(3);

        // Passive Gear
        SLOTGEAR_HOLDER = new DoubleSolenoid(4, 5);

        // Storage
        STORAGE_INTAKE = new VictorSP(4);
        STORAGE_AGITATOR = new VictorSP(5);

        // Shooter
        SHOOTER_CONVEYOR = new VictorSP(6);
        SHOOTER_WHEELS = new VictorSP(7);
        SHOOTER_ENCODER = new Encoder(4, 5);
        SHOOTER_ENCODER.setPIDSourceType(PIDSourceType.kRate);
        SHOOTER_PID = new PIDController(1, 0, 0, SHOOTER_ENCODER, SHOOTER_WHEELS);

        // Vision
        VISION_SERVER = CameraServer.getInstance();

        VISION_CAMERA = VISION_SERVER.startAutomaticCapture("FRONT", 0);
        VISION_CAMERA.setResolution(kVISION_WIDTH, kVISION_HEIGHT);
        kVISION_CENTER_X = kVISION_WIDTH / 2 - 0.5;
        kVISION_FOCAL_LENGTH = kVISION_WIDTH / (2 * Math.tan(Math.toRadians(kVISION_FOV / 2)));

        VISION_CAMERA.getProperty("saturation").set(20);
        VISION_CAMERA.getProperty("gain").set(0);
        VISION_CAMERA.getProperty("exposure_auto").set(1);
        VISION_CAMERA.getProperty("brightness").set(50);
        VISION_CAMERA.getProperty("exposure_absolute").set(1);
        VISION_CAMERA.getProperty("exposure_auto_priority").set(0);

        VISION_PIPELINE = new GripPipeline();

        VISION_SINK = VISION_SERVER.getVideo();

        // Network
        NETWORKTABLE = NetworkTable.getTable("Network Table");

    }
项目:turtleshell    文件:TurtleVictorSP.java   
public TurtleVictorSP(int port, boolean isReversed) {
    v = new VictorSP(port);
    this.isReversed = isReversed;
}
项目:turtleshell    文件:TurtleVictorSP.java   
public TurtleVictorSP(int port) {
    victor = new VictorSP(port);
}
项目:strongback-java    文件:Hardware.java   
/**
 * Create a motor driven by a VEX Robotics Victor SP speed controller on the specified channel, with a custom speed
 * limiting function.
 *
 * @param channel the channel the controller is connected to
 * @param speedLimiter function that will be used to limit the speed (input voltage); may not be null
 * @return a motor on the specified channel
 */
public static Motor victorSP(int channel, DoubleToDoubleFunction speedLimiter) {
    return new HardwareMotor(new VictorSP(channel), speedLimiter);
}