當前位置: 首頁>>代碼示例>>Java>>正文


Java AnalogChannel類代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.AnalogChannel的典型用法代碼示例。如果您正苦於以下問題:Java AnalogChannel類的具體用法?Java AnalogChannel怎麽用?Java AnalogChannel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnalogChannel類屬於edu.wpi.first.wpilibj包,在下文中一共展示了AnalogChannel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Winch

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
/**
 * A private constructor to prevent multiple instances from being created.
 */
private Winch(){
	winchMotor = new Talon(RobotMap.winchMotor.getInt());
	winchInputSwitch = new DigitalInput(RobotMap.winchLimitSwitch.getInt());
	winchSolenoid = new MomentaryDoubleSolenoid(
			RobotMap.winchExtPort.getInt(),RobotMap.winchRetPort.getInt());
	winchBallSensor = new AnalogChannel(RobotMap.winchBallSensorPort.getInt());
	intakeBallSensor = new AnalogChannel(RobotMap.intakeBallSensorPort.getInt());
	ballPresent = new Debouncer(RobotMap.ballPresentTime.getDouble());
	ballNotPresent = new Debouncer(RobotMap.ballPresentTime.getDouble());
	ballSettled = new Debouncer(RobotMap.ballSettleTime.getDouble());
	ballPresentOnWinch = new Debouncer(RobotMap.ballPresentOnWinchTime.getDouble());
	
	winchPotentiometer =
			new AnalogChannel(RobotMap.potentiometerPort.getInt());
	winchEncoder = new AverageEncoder(
			RobotMap.winchEncoderA.getInt(),
			RobotMap.winchEncoderB.getInt(),
			RobotMap.winchEncoderPulsePerRot,
			RobotMap.winchEncoderDistPerTick,
			RobotMap.winchEncoderReverse,
			RobotMap.winchEncodingType, RobotMap.winchSpeedReturnType,
			RobotMap.winchPosReturnType, RobotMap.winchAvgEncoderVal);
	winchEncoder.start();
}
 
開發者ID:Team2168,項目名稱:2014_Main_Robot,代碼行數:28,代碼來源:Winch.java

示例2: robotInit

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
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,rearLeft,frontRight,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);
    
}
 
開發者ID:4500robotics,項目名稱:4500-2014,代碼行數:36,代碼來源:RobotTemplate.java

示例3: InfraredSwitch

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public InfraredSwitch(int pInfraredDetectorChannel, AnalogChannel pAnalogVoltageMeter, double pHammerLevel, int pOnState, boolean pForceStateChange) {
    infraredDetector = new AnalogChannel(pInfraredDetectorChannel);
    analogVoltageMeter = pAnalogVoltageMeter;
    hammerLevel = pHammerLevel;
    onState = pOnState;
    setForceStateChange(pForceStateChange);
}
 
開發者ID:TaylorRobotics,項目名稱:TitanRobot2014,代碼行數:8,代碼來源:InfraredSwitch.java

示例4: Potentiometer

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public Potentiometer(int pPotentiometerChannel, AnalogChannel pAnalogVoltageMeter, boolean pReverse) {
    potentiometer = new AnalogChannel(pPotentiometerChannel);
    analogVoltageMeter = pAnalogVoltageMeter;
    scaled = false;
    scale = 0.0;
    minValue = 0.0;
    maxValue = 0.0;
    reverse = pReverse;
}
 
開發者ID:TaylorRobotics,項目名稱:TitanRobot2014,代碼行數:10,代碼來源:Potentiometer.java

示例5: Sensors

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public Sensors() {
    //initializing everything
    rightDriveEncoder = new Encoder(4, 3);
    leftDriveEncoder = new Encoder(2, 1);
    leftRangeFinder = new AnalogChannel(1, 1);
    rightRangeFinder = new AnalogChannel(1, 2);
    rightDriveEncoder.setDistancePerPulse(.08168);
}
 
開發者ID:FRCTeam3182,項目名稱:FRC2014,代碼行數:9,代碼來源:Sensors.java

示例6: robotInit

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public void robotInit(){
	analog = new AnalogChannel(4);
	joystick = new LogitechPro(1);
	attack = new LogitechAttack(2);
	leftMotor = new Motor(1,"Jaguar Speed Controller");
	rightMotor = new Motor(2, "Jaguar Speed Controller");
	drive = new DriveTrain(leftMotor, rightMotor);
}
 
開發者ID:frc-4931,項目名稱:2014-Robot,代碼行數:9,代碼來源:DiagnosticRobot.java

示例7: Throttle

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public Throttle( String name,
                 int sliderChannel,
                 double voltageRange,
                 int percentChangeBeforeDetection ) {
    this.name = name;
    this.slider = new AnalogChannel(sliderChannel);
    this.voltageRange = Math.abs(voltageRange);
    this.speedChangeBeforeDetection = inRange(percentChangeBeforeDetection / 100);
}
 
開發者ID:frc-4931,項目名稱:2014-Robot,代碼行數:10,代碼來源:Throttle.java

示例8: init

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public static void init()
{

driveTrainRightVictor = new Victor(1, 1);
driveTrainLeftVictor = new Victor(1, 3);
loaderVictor = new Victor(1, 2);
CatapultVictor = new Victor(1, 4);  

FireSolenoidSpike = new Relay(2);
PrimeSolenoidSpike = new Relay(3);
lightSpike = new Relay(7);
compressorSpike = new Relay(8);
       
gyro = new Gyro(1);
ultrasonic = new AnalogChannel(3);

limitSwitch = new DigitalInput(3);
pressureSwitch = new DigitalInput(2);
        
LiveWindow.addActuator("Drive Train", "Right Victor", (Victor) driveTrainRightVictor);
LiveWindow.addActuator("Drive Train", "Left Victor", (Victor) driveTrainLeftVictor);

robotDriveTrain = new RobotDrive(driveTrainLeftVictor, driveTrainRightVictor);

robotDriveTrain.setSafetyEnabled(true);
robotDriveTrain.setExpiration(0.1);
robotDriveTrain.setSensitivity(0.5);
robotDriveTrain.setMaxOutput(1.0);
}
 
開發者ID:lucaswalter,項目名稱:Staley-Robotics-2014,代碼行數:30,代碼來源:RobotMap.java

示例9: FalconGyro

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
/**
 * Gyro constructor with a precreated analog channel object. Use this
 * constructor when the analog channel needs to be shared. There is no
 * reference counting when an AnalogChannel is passed to the gyro.
 * 
 * @param channel
 *            The AnalogChannel object that the gyro is connected to.
 */
public FalconGyro(AnalogChannel channel) {
	m_analog = channel;
	if (m_analog == null) {
		System.err
				.println("Analog channel supplied to Gyro constructor is null");
	} else {
		m_channelAllocated = false;
		initGyro();
	}
}
 
開發者ID:Team2168,項目名稱:2014_Main_Robot,代碼行數:19,代碼來源:FalconGyro.java

示例10: RobotHardware

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public RobotHardware() {
    try {
        // Initializes the Jaguar motor controllers for driving
        CANJaguar frontLeftJaguar = new CANJaguar(Constants.FRONT_LEFT_MOTOR_PORT);
        CANJaguar backLeftJaguar = new CANJaguar(Constants.BACK_LEFT_MOTOR_PORT);
        CANJaguar frontRightJaguar = new CANJaguar(Constants.FRONT_RIGHT_MOTOR_PORT);
        CANJaguar backRightJaguar = new CANJaguar(Constants.BACK_RIGHT_MOTOR_PORT);

        // Initializes the controller for the four driving motors and reverses two of them
        driveControl = new RobotDrive(frontLeftJaguar, backLeftJaguar, frontRightJaguar, backRightJaguar);
        driveControl.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
        driveControl.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
    } catch (CANTimeoutException ex) {
        ex.printStackTrace();
    }

    // Initialize joysticks
    driverJoystick = new Joystick(Constants.DRIVER_JOYSTICK_PORT);
    secondJoystick = new Joystick(Constants.SECOND_JOYSTICK_PORT);

    sonar = new AnalogChannel(Constants.ANALOG_SONAR_PORT);

    compressor = new Compressor(Constants.COMPRESSOR_PRESSURE_SWITCH_CHANNEL, Constants.COMPRESSOR_RELAY_CHANNEL);
    doubleSol = new DoubleSolenoid(Constants.DOUBLE_SOLENOID_FORWARD_CHANNEL, Constants.DOUBLE_SOLENOID_REVERSE_CHANNEL);
    sol1 = new Solenoid(Constants.SOLENOID_PORT_1);
    sol2 = new Solenoid(Constants.SOLENOID_PORT_2);
}
 
開發者ID:KProskuryakov,項目名稱:FRC623Robot2014,代碼行數:28,代碼來源:RobotHardware.java

示例11: Piston

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public Piston(int extendPort, int retractPort, int readerport){
    extend = new Solenoid(extendPort);
    retract = new Solenoid(retractPort);
    isSolenoid = true;
    pressureReaderport = readerport;
    ai = new AnalogChannel(pressureReaderport);
}
 
開發者ID:IpFruion,項目名稱:RobotBlueTwilight2013,代碼行數:8,代碼來源:Piston.java

示例12: Elevator

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public Elevator() {
    super("Elevator", Kp, Ki, Kd);
    
    motor = new Jaguar(RobotMap.elevatorMotor);
    pot = new AnalogChannel(RobotMap.elevatorPot);

    // Set default position and start PID
    setSetpoint(STOW);
    enable();
}
 
開發者ID:TeamParadise,項目名稱:GearsBot,代碼行數:11,代碼來源:Elevator.java

示例13: Wrist

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public Wrist() {
    super("Wrist", Kp, Ki, Kd);
    motor = new Victor(RobotMap.wristMotor);
    pot = new AnalogChannel(RobotMap.wristPot);
    
    // Set the starting setpoint and have PID start running in the background
    setSetpoint(STOW);
    enable(); // - Enables the PID controller.
}
 
開發者ID:TeamParadise,項目名稱:GearsBot,代碼行數:10,代碼來源:Wrist.java

示例14: Canon

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
public Canon(ReserveBallon reserve) {
    mReserve = reserve;
    mjControl = JoystickDevice.GetCoPilot();
    mjAngleDeTir = new Jaguar(PwmDevice.mCanonAngleDeTir);
    mfAngleDeTir = new FiltrePasseBas(25);
    mjOrientationDeTir = new Jaguar(PwmDevice.mCanonOrientationDeTir);
    mfOrientationDeTir = new FiltrePasseBas(25);
    msTir = new Solenoid(SolenoidDevice.mCanonTir);
    msTirRev = new Solenoid(SolenoidDevice.mCanonTirRev);

    mdLimiteRotationGauche = new DigitalInput(DigitalDevice.mCanonLimiteRotationGauche);
    mdLimiteRotationDroite = new DigitalInput(DigitalDevice.mCanonLimiteRotationDroite);

    mjCanonHaut = new Jaguar(PwmDevice.mCanonMoteurHaut);
    mfCanonHaut = new FiltrePasseBas(25);
    macCanonHaut = new AnalogChannel(AnalogDevice.mCanonMoteurHaut);
    mpidCanonHaut = new PIDController(Kp,Ki, Kd, macCanonHaut, mjCanonHaut);
    mpidCanonHaut.setInputRange(0.0, 4095.0);
    mpidCanonHaut.setOutputRange(-1.0, 1.0);

    mjCanonBas = new Jaguar(PwmDevice.mCanonMoteurBas);
    mfCanonBas = new FiltrePasseBas(25);
    macCanonBas = new AnalogChannel(AnalogDevice.mCanonMoteurBas);
    mpidCanonBas = new PIDController(Kp,Ki, Kd, macCanonBas, mjCanonBas);
    mpidCanonBas.setInputRange(0.0, 4095.0);
    mpidCanonBas.setOutputRange(-1.0, 1.0);
    
    mRangeFinder = new RangeFinder(5);
    
    maAngle = new ADXL345_I2C(1, ADXL345_I2C.DataFormat_Range.k8G);
    maRef = new ADXL345_I2C(1, ADXL345_I2C.DataFormat_Range.k8G);
    
    msTir.set(false);
    msTirRev.set(true);
}
 
開發者ID:amalo,項目名稱:Hyperion3360-2012,代碼行數:36,代碼來源:Canon.java

示例15: Tilter

import edu.wpi.first.wpilibj.AnalogChannel; //導入依賴的package包/類
private Tilter() {
    leadscrew = new BoundedTalon(Constants.TILTER_CHANNEL, Constants.TILTER_UPPER_LIMIT_SWITCH_CHANNEL, Constants.TILTER_LOWER_LIMIT_SWITCH_CHANNEL);
    accel = new ADXL345_I2C(Constants.ACCELEROMETER_CHANNEL, ADXL345_I2C.DataFormat_Range.k2G);
    accelMeasurements = new Vector();
    updateAccel();        
    pendulum = new AnalogChannel(Constants.PENDULUM_CHANNEL);
    enc = new Encoder(Constants.LEADSCREW_ENCODER_A_CHANNEL, Constants.LEADSCREW_ENCODER_B_CHANNEL);
    enc.setDistancePerPulse(Constants.TILTER_DISTANCE_PER_PULSE);
    enc.start();
    Thread t = new Thread(new Runnable() {
        public void run() {
            Tilter.net = new NetworkIO();
        }
    });
    t.start();
    controller = new PIDController(Constants.PVAL_T, Constants.IVAL_T, Constants.DVAL_T, enc, new PIDOutput() {
        public void pidWrite(double output) {
            setLeadscrewMotor(output);
        }
    }); 
    controller.setPercentTolerance(0.01);
    controller.disable();
    updatePID();
    initialReadingTimer = new Timer();
    initialReadingTimer.schedule(new TimerTask() {

        public void run() {
            initialLeadLength = calcLeadscrewLength(getAveragedAccelBasedAngle());
        }
    }, INITIAL_ANGLE_MEASUREMENT_DELAY);
}
 
開發者ID:Team694,項目名稱:desiree,代碼行數:32,代碼來源:Tilter.java


注:本文中的edu.wpi.first.wpilibj.AnalogChannel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。