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


Java EncodingType.k4X方法代码示例

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


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

示例1: initialize

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public void initialize() 
{
	rearLeftMotor = new Jaguar(0);
	frontLeftMotor = new Jaguar(1);
	liftMotor = new Jaguar(2);
	liftMotor2 = new Jaguar(3);
	liftEncoder = new Encoder(6, 7, false, EncodingType.k4X);
	
	drivetrain = new RobotDrive(rearLeftMotor, frontLeftMotor);	
	
	drivetrain.setInvertedMotor(MotorType.kFrontLeft, true);
	drivetrain.setInvertedMotor(MotorType.kFrontRight, true);

	halsensor = new DigitalInput(0);
	
	horizontalCamera = new Servo(8);
	verticalCamera = new Servo(9);
	
	solenoid = new DoubleSolenoid(0,1);
	
	gyro = new Gyro(1);
	accelerometer = new BuiltInAccelerometer();
	
	liftEncoder.reset();
	
	RobotHardwareWoodbot hardware = (RobotHardwareWoodbot)Robot.bot;
	
	LiveWindow.addActuator("Drive Train", "Front Left Motor", (Jaguar)hardware.frontLeftMotor);
	LiveWindow.addActuator("Drive Train", "Back Left Motor", (Jaguar)hardware.rearLeftMotor);
	//LiveWindow.addActuator("Drive Train", "Front Right Motor", (Jaguar)hardware.frontRightMotor);
	//LiveWindow.addActuator("Drive Train", "Back Right Motor", (Jaguar)hardware.rearRightMotor);
}
 
开发者ID:SCOTS-Bots,项目名称:FRC-2015-Robot-Java,代码行数:33,代码来源:RobotHardwareWoodbot.java

示例2: initialize

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
@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, 1, 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);
}
 
开发者ID:SCOTS-Bots,项目名称:FRC-2015-Robot-Java,代码行数:41,代码来源:RobotHardwareCompbot.java

示例3: DriveTrain

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public DriveTrain() {
    super();
    frontLeft = new CANTalon(RobotMap.DRIVE_TRAIN_FRONT_LEFT);
    frontRight = new CANTalon(RobotMap.DRIVE_TRAIN_FRONT_RIGHT);
    backLeft = new CANTalon(RobotMap.DRIVE_TRAIN_BACK_LEFT);
    backRight = new CANTalon(RobotMap.DRIVE_TRAIN_BACK_RIGHT);

    frontLeft.set(0);
    frontRight.set(0);
    backLeft.set(0);
    backRight.set(0);
    
    double voltageRampRate = 150;//20;
    frontLeft.setVoltageRampRate(voltageRampRate);
    frontRight.setVoltageRampRate(voltageRampRate);
    backLeft.setVoltageRampRate(voltageRampRate);
    backRight.setVoltageRampRate(voltageRampRate);
    
    //backRight.setCurrentLimit(0);

    setBrake(false);

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

    // Scale encoder pulses to distance in inches
    double wheelDiameter = 4.0; // inches
    double encoderToShaftRatio = 3; // 3X gear reduction
    double pulsesPerRevolution = 256;
    double stage3Ratio = 50.0 / 34.0;
    double distancePerPulse = Math.PI * wheelDiameter / (encoderToShaftRatio * pulsesPerRevolution);
    distancePerPulse /= stage3Ratio;

    leftEncoder = new Encoder(RobotMap.DRIVE_TRAIN_ENCODER_LEFT_A, RobotMap.DRIVE_TRAIN_ENCODER_LEFT_B,
    		true, EncodingType.k4X);
    leftEncoder.reset();
    leftEncoder.setDistancePerPulse(distancePerPulse);
    rightEncoder = new Encoder(RobotMap.DRIVE_TRAIN_ENCODER_RIGHT_A, RobotMap.DRIVE_TRAIN_ENCODER_RIGHT_B,
    		true, EncodingType.k4X);
    rightEncoder.reset();
    rightEncoder.setDistancePerPulse(distancePerPulse);
}
 
开发者ID:cyborgs3335,项目名称:STEAMworks,代码行数:42,代码来源:DriveTrain.java

示例4: DriveTrain

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的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

示例5: init

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public static void init() {
	// Sparks!
////Change for competition Robot start DONE DONE DONE DOOOONNNEE
	dTSparkController1 = new Spark(2);
	dTSparkController2 = new Spark(3);
	dTSparkController3 = new Talon(4);
	dTSparkController4 = new Talon(5);
	//dTSparkController1 = new Spark(1);
	//dTSparkController2 = new Spark(3);
	//dTSparkController3 = new Spark(2);
	//dTSparkController4 = new Spark(4);
////Change for Competition Robot end
	driveTrainRobotDrive = new RobotDrive(dTSparkController1, dTSparkController2,
	dTSparkController3, dTSparkController4);
	winchMotor = new CANTalon(7);
	armMotor = new CANTalon(8);
	
	//remember CANTalons are named by the RIO Interface ID number
	//parallelBar = new CANTalon(9);
////Change for Competition Robot start DONE DONE DONE DOOOONNNEE
	intakeRoller = new Talon(1);
	//intakeRoller = new Talon(6);
////Change for Competition Robot end
	intake = new Talon(6);
	// Encoder Code CP&P - Fred
	EncoderLeft = new Encoder(2, 3, false, EncodingType.k4X);
    LiveWindow.addSensor("Encoders", "Quadrature Encoder Left", EncoderLeft);
    EncoderLeft.setSamplesToAverage(5);
    EncoderLeft.setDistancePerPulse(1.0/360);
    //EncoderLeft.setPIDSourceParameter(PIDSourceParameter.kDistance);
    
    EncoderRight = new Encoder(4, 5, false, EncodingType.k4X);
    LiveWindow.addSensor("Encoders", "Quadrature EncoderRight", EncoderRight);
    EncoderRight.setSamplesToAverage(5);
    EncoderRight.setDistancePerPulse(1.0/360);
    
	ParallelEncoder = new Encoder(0, 1, false, EncodingType.k4X);
    LiveWindow.addSensor("Encoders", "Quadrature Encoder Arm", ParallelEncoder);
    ParallelEncoder.setSamplesToAverage(5);
    ParallelEncoder.setDistancePerPulse(1.0/360);
    
    //Ultrasonic ultra = new Ultrasonic(6,7);
    //ultra.setAutomaticMode(true);
    PressureGauge = new AnalogInput(4);
    limitSwitch = new DigitalInput(9);
    
    // Change for Practice to Competition Robot DONE DONE DONE DOOOONNNEE
    wCylinder = new Solenoid(1);
    trigger = new Solenoid(2);
    //wCylinder = new DoubleSolenoid(3, 4);
    //trigger = new DoubleSolenoid(1, 2);
    // Change for Practice to Competition Robot End
    
    
    //light = new DoubleSolenoid(3, 0, 1);
    
    navXBoard = new SerialPort(57600,SerialPort.Port.kMXP);
    byte update_rate_hz = 50;
    imu = new AHRS(navXBoard,update_rate_hz);
    pneumaticsCompressor = new Compressor(0);
    
}
 
开发者ID:FRC5442,项目名称:Bernie,代码行数:63,代码来源:RobotMap.java

示例6: init

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTrainleftFrontTalon0 = new TalonSRX(0);
    LiveWindow.addActuator("DriveTrain", "leftFrontTalon0", (TalonSRX) driveTrainleftFrontTalon0);
    
    driveTrainleftBackTalon1 = new TalonSRX(1);
    LiveWindow.addActuator("DriveTrain", "leftBackTalon1", (TalonSRX) driveTrainleftBackTalon1);
    
    driveTrainrightFrontTalon2 = new TalonSRX(2);
    LiveWindow.addActuator("DriveTrain", "rightFrontTalon2", (TalonSRX) driveTrainrightFrontTalon2);
    
    driveTrainrightBackTalon3 = new TalonSRX(3);
    LiveWindow.addActuator("DriveTrain", "rightBackTalon3", (TalonSRX) driveTrainrightBackTalon3);
    
    driveTrainRobotDrive = new RobotDrive(driveTrainleftFrontTalon0, driveTrainleftBackTalon1,
          driveTrainrightFrontTalon2, driveTrainrightBackTalon3);
    
    driveTrainRobotDrive.setSafetyEnabled(true);
    driveTrainRobotDrive.setExpiration(0.1);
    driveTrainRobotDrive.setSensitivity(0.5);
    driveTrainRobotDrive.setMaxOutput(1.0);

    driveTraingyro = new Gyro(0);
    LiveWindow.addSensor("DriveTrain", "gyro", driveTraingyro);
    driveTraingyro.setSensitivity(0.007);
    driveTrainleftFrontEncoder = new Encoder(17, 18, false, EncodingType.k4X);
    LiveWindow.addSensor("DriveTrain", "leftFrontEncoder", driveTrainleftFrontEncoder);
    driveTrainleftFrontEncoder.setDistancePerPulse(1.0);
    driveTrainleftFrontEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);
    driveTrainleftBackEncoder = new Encoder(19, 20, false, EncodingType.k4X);
    LiveWindow.addSensor("DriveTrain", "leftBackEncoder", driveTrainleftBackEncoder);
    driveTrainleftBackEncoder.setDistancePerPulse(1.0);
    driveTrainleftBackEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);
    driveTrainrightFrontEncoder = new Encoder(21, 22, false, EncodingType.k4X);
    LiveWindow.addSensor("DriveTrain", "rightFrontEncoder", driveTrainrightFrontEncoder);
    driveTrainrightFrontEncoder.setDistancePerPulse(1.0);
    driveTrainrightFrontEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);
    driveTrainrightBackEncoder = new Encoder(23, 24, false, EncodingType.k4X);
    LiveWindow.addSensor("DriveTrain", "rightBackEncoder", driveTrainrightBackEncoder);
    driveTrainrightBackEncoder.setDistancePerPulse(1.0);
    driveTrainrightBackEncoder.setPIDSourceParameter(PIDSourceParameter.kRate);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
 
开发者ID:sfhsfembot,项目名称:RecycledRushDriveTrain,代码行数:45,代码来源:RobotMap.java

示例7: init

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTrainleftMotor = new Talon(0);
    LiveWindow.addActuator("DriveTrain", "leftMotor", (Talon) driveTrainleftMotor);
    
    driveTrainrightMotor = new Talon(1);
    LiveWindow.addActuator("DriveTrain", "rightMotor", (Talon) driveTrainrightMotor);
    
    driveTrainMotors = new RobotDrive(driveTrainleftMotor, driveTrainrightMotor);
    
    driveTrainMotors.setSafetyEnabled(true);
    driveTrainMotors.setExpiration(0.1);
    driveTrainMotors.setSensitivity(0.5);
    driveTrainMotors.setMaxOutput(1.0);
    

    driveTrainwheelRotations = new Encoder(2, 3, false, EncodingType.k4X);
    LiveWindow.addSensor("DriveTrain", "wheelRotations", driveTrainwheelRotations);
    driveTrainwheelRotations.setDistancePerPulse(0.102);
    driveTrainwheelRotations.setPIDSourceParameter(PIDSourceParameter.kRate);
    driveTraingyro = new Gyro(0);
    LiveWindow.addSensor("DriveTrain", "gyro", driveTraingyro);
    driveTraingyro.setSensitivity(0.0015);
    driveTrainrangeFinder = new AnalogInput(1);
    LiveWindow.addSensor("DriveTrain", "rangeFinder", driveTrainrangeFinder);
    
    armSolenoid = new DoubleSolenoid(0, 0, 1);      
    LiveWindow.addActuator("Arms", "armSolenoid", armSolenoid);
    
    armWidthLimit = new DigitalInput(1);
    LiveWindow.addSensor("Arms", "armWidthLimit", armWidthLimit);
    
    elevatorlimitSwitch = new DigitalInput(0);
    LiveWindow.addSensor("Elevator", "limitSwitch", elevatorlimitSwitch);
    
    elevatorSolenoid = new DoubleSolenoid(0, 6, 7);      
    LiveWindow.addActuator("Elevator", "elevatorSolenoid", elevatorSolenoid);
    
    rcSolenoid = new DoubleSolenoid(0, 4, 5); 
    LiveWindow.addActuator("RC Picker Upper Sole", "rcSolenoid", rcSolenoid);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
 
开发者ID:FRC-5506,项目名称:RecycleRush,代码行数:44,代码来源:RobotMap.java

示例8: init

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public static void init()
{
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
       driveTrainLeftFront = new Talon(0);
       LiveWindow.addActuator("DriveTrain", "Left Front", (Talon) driveTrainLeftFront);
       
       driveTrainLeftRear = new Talon(1);
       LiveWindow.addActuator("DriveTrain", "Left Rear", (Talon) driveTrainLeftRear);
       
       driveTrainRightFront = new Talon(2);
       LiveWindow.addActuator("DriveTrain", "Right Front", (Talon) driveTrainRightFront);
       
       driveTrainRightRear = new Talon(3);
       LiveWindow.addActuator("DriveTrain", "Right Rear", (Talon) driveTrainRightRear);
       
       driveTrainHolonomicDrive = new RobotDrive(driveTrainLeftFront, driveTrainLeftRear,
             driveTrainRightFront, driveTrainRightRear);
       
       driveTrainHolonomicDrive.setSafetyEnabled(false);
       driveTrainHolonomicDrive.setExpiration(0.1);
       driveTrainHolonomicDrive.setSensitivity(0.5);
       driveTrainHolonomicDrive.setMaxOutput(1.0);

       driveTrainHolonomicDrive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
       driveTrainHolonomicDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
       forkliftMotor = new Talon(4);
       LiveWindow.addActuator("Forklift", "Motor", (Talon) forkliftMotor);
       
       forkliftEncoder = new Encoder(0, 1, false, EncodingType.k4X);
       LiveWindow.addSensor("Forklift", "Encoder", forkliftEncoder);
       forkliftEncoder.setDistancePerPulse(0.012);
       forkliftEncoder.setPIDSourceParameter(PIDSourceParameter.kDistance);
       rollerMotor = new Talon(5);
       LiveWindow.addActuator("Roller", "Motor", (Talon) rollerMotor);
       
       stabilizerBackLeft = new Servo(6);
       LiveWindow.addActuator("Stabilizer", "Back Left", stabilizerBackLeft);
       
       stabilizerBackRight = new Servo(8);
       LiveWindow.addActuator("Stabilizer", "Back Right", stabilizerBackRight);
       
       stabilizerFrontLeft = new Servo(7);
       LiveWindow.addActuator("Stabilizer", "Front Left", stabilizerFrontLeft);
       
       stabilizerFrontRight = new Servo(9);
       LiveWindow.addActuator("Stabilizer", "Front Right", stabilizerFrontRight);
       

   // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

       driveTrainGyro = new HVAGyro(0);
       LiveWindow.addSensor("DriveTrain", "Gyro", driveTrainGyro);
       driveTrainGyro.setSensitivity(0.007);
  
	powerDistributionPanel = new PowerDistributionPanel();
}
 
开发者ID:HVA-FRC-3824,项目名称:HolonomicDrive,代码行数:57,代码来源:RobotMap.java

示例9: WsDriveBase

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public WsDriveBase(String name) {
    super(name);

    WHEEL_DIAMETER_config = new DoubleConfigFileParameter(this.getClass().getName(), "wheel_diameter", 6);
    TICKS_PER_ROTATION_config = new DoubleConfigFileParameter(this.getClass().getName(), "ticks_per_rotation", 360.0);
    THROTTLE_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "throttle_low_gear_accel_factor", 0.250);
    HEADING_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "heading_low_gear_accel_factor", 0.500);
    THROTTLE_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "throttle_high_gear_accel_factor", 0.125);
    HEADING_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "heading_high_gear_accel_factor", 0.250);
    MAX_HIGH_GEAR_PERCENT_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_high_gear_percent", 0.80);
    ENCODER_GEAR_RATIO_config = new DoubleConfigFileParameter(this.getClass().getName(), "encoder_gear_ratio", 7.5);
    DEADBAND_config = new DoubleConfigFileParameter(this.getClass().getName(), "deadband", 0.05);
    SLOW_TURN_FORWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "slow_turn_forward_speed", 0.16);
    SLOW_TURN_BACKWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "slow_turn_backward_speed", -0.19);
    FEED_FORWARD_VELOCITY_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(), "feed_forward_velocity_constant", 1.00);
    FEED_FORWARD_ACCELERATION_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(), "feed_forward_acceleration_constant", 0.00018);
    MAX_ACCELERATION_DRIVE_PROFILE_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_acceleration_drive_profile", 600.0);
    MAX_SPEED_INCHES_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_speed_inches_lowgear", 90.0);
    DECELERATION_VELOCITY_THRESHOLD_config = new DoubleConfigFileParameter(this.getClass().getName(), "deceleration_velocity_threshold", 48.0);
    DECELERATION_MOTOR_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "deceleration_motor_speed", 0.3);
    STOPPING_DISTANCE_AT_MAX_SPEED_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(), "stopping_distance_at_max_speed_lowgear", 10.0);
    DRIVE_OFFSET_config = new AutonomousDoubleConfigFileParameter("DriveOffset", 1.00);
    USE_LEFT_SIDE_FOR_OFFSET_config = new AutonomousBooleanConfigFileParameter("UseLeftDriveForOffset", true);
    QUICK_TURN_CAP_config = new DoubleConfigFileParameter(this.getClass().getName(), "quick_turn_cap", 10.0);
    QUICK_TURN_ANTITURBO_config = new DoubleConfigFileParameter(this.getClass().getName(), "quick_turn_antiturbo", 10.0);

    //Anti-Turbo button
    registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_8);
    //Turbo button
    registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_7);
    //Shifter Button
    registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_6);
    //Left/right slow turn buttons
    registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_1);
    registerForJoystickButtonNotification(WsJoystickButtonEnum.DRIVER_BUTTON_3);

    //Initialize the drive base encoders
    leftDriveEncoder = new Encoder(2, 3, true, EncodingType.k4X);
    leftDriveEncoder.reset();
    leftDriveEncoder.start();
    rightDriveEncoder = new Encoder(4, 5, false, EncodingType.k4X);
    rightDriveEncoder.reset();
    rightDriveEncoder.start();

    //Initialize the gyro
    //@TODO: Get the correct port
    driveHeadingGyro = new Gyro(1);

    //Initialize the PIDs
    driveDistancePidInput = new WsDriveBaseDistancePidInput();
    driveDistancePidOutput = new WsDriveBaseDistancePidOutput();
    driveDistancePid = new WsPidController(driveDistancePidInput, driveDistancePidOutput, "WsDriveBaseDistancePid");

    driveHeadingPidInput = new WsDriveBaseHeadingPidInput();
    driveHeadingPidOutput = new WsDriveBaseHeadingPidOutput();
    driveHeadingPid = new WsPidController(driveHeadingPidInput, driveHeadingPidOutput, "WsDriveBaseHeadingPid");

    driveSpeedPidInput = new WsDriveBaseSpeedPidInput();
    driveSpeedPidOutput = new WsDriveBaseSpeedPidOutput();
    driveSpeedPid = new WsSpeedPidController(driveSpeedPidInput, driveSpeedPidOutput, "WsDriveBaseSpeedPid");
    continuousAccelerationFilter = new ContinuousAccelFilter(0, 0, 0);
    init();
}
 
开发者ID:wildstang111,项目名称:2013_drivebase_proto,代码行数:64,代码来源:WsDriveBase.java

示例10: DriveBase

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public DriveBase(String name) {
    super(name);

    WHEEL_DIAMETER_config = new DoubleConfigFileParameter(this.getClass().getName(), "wheel_diameter", 6);
    TICKS_PER_ROTATION_config = new DoubleConfigFileParameter(this.getClass().getName(), "ticks_per_rotation", 360.0);
    THROTTLE_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "throttle_low_gear_accel_factor", 0.250);
    HEADING_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "heading_low_gear_accel_factor", 0.500);
    THROTTLE_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "throttle_high_gear_accel_factor", 0.125);
    HEADING_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "heading_high_gear_accel_factor", 0.250);
    MAX_HIGH_GEAR_PERCENT_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_high_gear_percent", 0.80);
    ENCODER_GEAR_RATIO_config = new DoubleConfigFileParameter(this.getClass().getName(), "encoder_gear_ratio", 7.5);
    DEADBAND_config = new DoubleConfigFileParameter(this.getClass().getName(), "deadband", 0.05);
    SLOW_TURN_FORWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "slow_turn_forward_speed", 0.16);
    SLOW_TURN_BACKWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "slow_turn_backward_speed", -0.19);
    FEED_FORWARD_VELOCITY_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(), "feed_forward_velocity_constant", 1.00);
    FEED_FORWARD_ACCELERATION_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(), "feed_forward_acceleration_constant", 0.00018);
    MAX_ACCELERATION_DRIVE_PROFILE_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_acceleration_drive_profile", 600.0);
    MAX_SPEED_INCHES_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_speed_inches_lowgear", 90.0);
    DECELERATION_VELOCITY_THRESHOLD_config = new DoubleConfigFileParameter(this.getClass().getName(), "deceleration_velocity_threshold", 48.0);
    DECELERATION_MOTOR_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "deceleration_motor_speed", 0.3);
    STOPPING_DISTANCE_AT_MAX_SPEED_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(), "stopping_distance_at_max_speed_lowgear", 10.0);
    DRIVE_OFFSET_config = new AutonomousDoubleConfigFileParameter("DriveOffset", 1.00);
    USE_LEFT_SIDE_FOR_OFFSET_config = new AutonomousBooleanConfigFileParameter("UseLeftDriveForOffset", true);
    QUICK_TURN_CAP_config = new DoubleConfigFileParameter(this.getClass().getName(), "quick_turn_cap", 10.0);
    QUICK_TURN_ANTITURBO_config = new DoubleConfigFileParameter(this.getClass().getName(), "quick_turn_antiturbo", 10.0);

    //Anti-Turbo button
    registerForJoystickButtonNotification(JoystickButtonEnum.DRIVER_BUTTON_8);
    //Turbo button
    registerForJoystickButtonNotification(JoystickButtonEnum.DRIVER_BUTTON_7);
    //Shifter Button
    registerForJoystickButtonNotification(JoystickButtonEnum.DRIVER_BUTTON_6);

    //Initialize the drive base encoders
    leftDriveEncoder = new Encoder(2, 3, true, EncodingType.k4X);
    leftDriveEncoder.reset();
    leftDriveEncoder.start();
    rightDriveEncoder = new Encoder(4, 5, false, EncodingType.k4X);
    rightDriveEncoder.reset();
    rightDriveEncoder.start();

    //Initialize the gyro
    //@TODO: Get the correct port
    driveHeadingGyro = new Gyro(1);

    continuousAccelerationFilter = new ContinuousAccelFilter(0, 0, 0);
    driveSpeedPidInput = new DriveBaseSpeedPidInput();
    driveSpeedPidOutput = new DriveBaseSpeedPidOutput();
    driveSpeedPid = new SpeedPidController(driveSpeedPidInput, driveSpeedPidOutput, "DriveBaseSpeedPid");
    init();
}
 
开发者ID:wildstang111,项目名称:2014_software,代码行数:52,代码来源:DriveBase.java

示例11: WsDriveBase

import edu.wpi.first.wpilibj.CounterBase.EncodingType; //导入方法依赖的package包/类
public WsDriveBase(String name) {
    super(name);

    WHEEL_DIAMETER_config = new DoubleConfigFileParameter(this.getClass().getName(), "wheel_diameter", 6);
    TICKS_PER_ROTATION_config = new DoubleConfigFileParameter(this.getClass().getName(), "ticks_per_rotation", 360.0);
    THROTTLE_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "throttle_low_gear_accel_factor", 0.250);
    HEADING_LOW_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "heading_low_gear_accel_factor", 0.500);
    THROTTLE_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "throttle_high_gear_accel_factor", 0.125);
    HEADING_HIGH_GEAR_ACCEL_FACTOR_config = new DoubleConfigFileParameter(this.getClass().getName(), "heading_high_gear_accel_factor", 0.250);
    MAX_HIGH_GEAR_PERCENT_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_high_gear_percent", 0.80);
    ENCODER_GEAR_RATIO_config = new DoubleConfigFileParameter(this.getClass().getName(), "encoder_gear_ratio", 7.5);
    DEADBAND_config = new DoubleConfigFileParameter(this.getClass().getName(), "deadband", 0.05);
    SLOW_TURN_FORWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "slow_turn_forward_speed", 0.16);
    SLOW_TURN_BACKWARD_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "slow_turn_backward_speed", -0.19);
    FEED_FORWARD_VELOCITY_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(), "feed_forward_velocity_constant", 1.00);
    FEED_FORWARD_ACCELERATION_CONSTANT_config = new DoubleConfigFileParameter(this.getClass().getName(), "feed_forward_acceleration_constant", 0.00018);
    MAX_ACCELERATION_DRIVE_PROFILE_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_acceleration_drive_profile", 600.0);
    MAX_SPEED_INCHES_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(), "max_speed_inches_lowgear", 90.0);
    DECELERATION_VELOCITY_THRESHOLD_config = new DoubleConfigFileParameter(this.getClass().getName(), "deceleration_velocity_threshold", 48.0);
    DECELERATION_MOTOR_SPEED_config = new DoubleConfigFileParameter(this.getClass().getName(), "deceleration_motor_speed", 0.3);
    STOPPING_DISTANCE_AT_MAX_SPEED_LOWGEAR_config = new DoubleConfigFileParameter(this.getClass().getName(), "stopping_distance_at_max_speed_lowgear", 10.0);
    DRIVE_OFFSET_config = new AutonomousDoubleConfigFileParameter("DriveOffset", 1.00);
    USE_LEFT_SIDE_FOR_OFFSET_config = new AutonomousBooleanConfigFileParameter("UseLeftDriveForOffset", true);
    QUICK_TURN_CAP_config = new DoubleConfigFileParameter(this.getClass().getName(), "quick_turn_cap", 10.0);
    QUICK_TURN_ANTITURBO_config = new DoubleConfigFileParameter(this.getClass().getName(), "quick_turn_antiturbo", 10.0);

    //Anti-Turbo button
    Subject subject = WsInputManager.getInstance().getOiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON8);
    subject.attach(this);
    //Turbo button
    subject = WsInputManager.getInstance().getOiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON7);
    subject.attach(this);
    //Shifter Button
    subject = WsInputManager.getInstance().getOiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON6);
    subject.attach(this);
    //Left/right slow turn buttons
    subject = WsInputManager.getInstance().getOiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON1);
    subject.attach(this);
    subject = WsInputManager.getInstance().getOiInput(WsInputManager.DRIVER_JOYSTICK).getSubject(WsDriverJoystickButtonEnum.BUTTON3);
    subject.attach(this);

    //Initialize the drive base encoders
    leftDriveEncoder = new Encoder(2, 3, true, EncodingType.k4X);
    leftDriveEncoder.reset();
    leftDriveEncoder.start();
    rightDriveEncoder = new Encoder(4, 5, false, EncodingType.k4X);
    rightDriveEncoder.reset();
    rightDriveEncoder.start();

    //Initialize the gyro
    //@TODO: Get the correct port
    driveHeadingGyro = new Gyro(1);

    //Initialize the PIDs
    driveDistancePidInput = new WsDriveBaseDistancePidInput();
    driveDistancePidOutput = new WsDriveBaseDistancePidOutput();
    driveDistancePid = new WsPidController(driveDistancePidInput, driveDistancePidOutput, "WsDriveBaseDistancePid");

    driveHeadingPidInput = new WsDriveBaseHeadingPidInput();
    driveHeadingPidOutput = new WsDriveBaseHeadingPidOutput();
    driveHeadingPid = new WsPidController(driveHeadingPidInput, driveHeadingPidOutput, "WsDriveBaseHeadingPid");
    
    driveSpeedPidInput = new WsDriveBaseSpeedPidInput();
    driveSpeedPidOutput = new WsDriveBaseSpeedPidOutput();
    driveSpeedPid = new WsSpeedPidController(driveSpeedPidInput, driveSpeedPidOutput, "WsDriveBaseSpeedPid");
    continuousAccelerationFilter = new ContinuousAccelFilter(0, 0, 0); 
    init();
}
 
开发者ID:wildstang111,项目名称:2013_robot_software,代码行数:69,代码来源:WsDriveBase.java


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