当前位置: 首页>>代码示例>>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;未经允许,请勿转载。