本文整理汇总了Java中edu.wpi.first.wpilibj.Victor类的典型用法代码示例。如果您正苦于以下问题:Java Victor类的具体用法?Java Victor怎么用?Java Victor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Victor类属于edu.wpi.first.wpilibj包,在下文中一共展示了Victor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PainTrain
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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,8,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();
}
示例2: Robot
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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);
}
示例3: robotInit
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
/**
* 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();
}
示例4: DriveTrain
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
/**
*
*/
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();
}
示例5: init
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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;
}
}
示例6: DriveTrainSubsystem
import edu.wpi.first.wpilibj.Victor; //导入依赖的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);
}
示例7: Loader
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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);
}
示例8: SystemShooter
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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");
}
示例9: SystemArm
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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.");
}
示例10: RightTankDrivePIDSubsystem
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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();
}
示例11: LeftTankDrivePIDSubsystem
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
public LeftTankDrivePIDSubsystem() {
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.
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();
}
示例12: init
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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();
}
示例13: Intake
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
public Intake() {
Actuator = new DoubleSolenoid(RobotMap.Solenoid.IntakeSolenoidForwards,
RobotMap.Solenoid.IntakeSolenoidBackwards);
IntakeCIM = new Victor(RobotMap.Pwm.MainIntakeVictor);
IntakeCIM2 = new Victor(RobotMap.Pwm.CrossIntakeVictor);
}
示例14: AimShooter
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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);
}
示例15: reset
import edu.wpi.first.wpilibj.Victor; //导入依赖的package包/类
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();
}