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


Java VictorSP类代码示例

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


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

示例1: Shooter

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

示例2: DriveTrain

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
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);
}
 
开发者ID:Team334,项目名称:R2017,代码行数:14,代码来源:DriveTrain.java

示例3: robotInit

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
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);
	}
 
开发者ID:GraV-Robotics,项目名称:FRC-2016-Robot-Code,代码行数:28,代码来源:Robot.java

示例4: init

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

	}
 
开发者ID:ASL-Robotics,项目名称:1797-2017,代码行数:36,代码来源:RobotMap.java

示例5: CommandMotor

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
public CommandMotor(Subsystem5800 requiredSubsystem, VictorSP motor, double speed) {
	super(requiredSubsystem);
	this.motor = motor;
	this.speed = speed;
}
 
开发者ID:FRC5800,项目名称:FRC-5800-Stronghold,代码行数:6,代码来源:CommandMotor.java

示例6: CommandMotorTime

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
public CommandMotorTime(Subsystem5800 requiredSubsystem, VictorSP motor, double speed, double timeout) {
	super(requiredSubsystem);
	this.setTimeout(speed);
	this.motor = motor;
	this.speed = speed;
}
 
开发者ID:FRC5800,项目名称:FRC-5800-Stronghold,代码行数:7,代码来源:CommandMotorTime.java

示例7: init

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
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
}
 
开发者ID:alpal23,项目名称:2017TestBench,代码行数:22,代码来源:RobotMap.java

示例8: ClimberAndIntake

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
public ClimberAndIntake(Controls controls) {
    this.controls = controls;

    climberIntakeMotor = new VictorSP(Constants.CLIMBER_INTAKE);
    climberIntakeMotor2 = new VictorSP(Constants.CLIMBER_INTAKE_2);
}
 
开发者ID:Team334,项目名称:R2017,代码行数:7,代码来源:ClimberAndIntake.java

示例9: Indexer

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
public Indexer() {
    indexerMotorBelt = new VictorSP(Constants.INDEXER_BELT);
    indexerMotorRoller = new VictorSP(Constants.INDEXER2_ROLLER);
}
 
开发者ID:Team334,项目名称:R2017,代码行数:5,代码来源:Indexer.java

示例10: DriveTrain

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
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);
	
}
 
开发者ID:Team997Coders,项目名称:2017SteamBot2,代码行数:45,代码来源:DriveTrain.java

示例11: Drive

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
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);
   }
 
开发者ID:Team236,项目名称:2016-Robot-Final,代码行数:43,代码来源:Drive.java

示例12: SpeedControllerSubsystem

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

示例13: init

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

	}
 
开发者ID:ASL-Robotics,项目名称:1797-2017,代码行数:57,代码来源:RobotMap.java

示例14: TurtleVictorSP

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
public TurtleVictorSP(int port, boolean isReversed) {
	v = new VictorSP(port);
	this.isReversed = isReversed;
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:5,代码来源:TurtleVictorSP.java

示例15: TurtleVictorSP

import edu.wpi.first.wpilibj.VictorSP; //导入依赖的package包/类
public TurtleVictorSP(int port) {
	victor = new VictorSP(port);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:4,代码来源:TurtleVictorSP.java


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