本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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();
}
示例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.
}
示例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);
}
示例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);
}