edu.wpi.first.wpilibj.AnalogModule的实例源码

项目:SwerveDrive    文件AbsoluteAnalogEncoder.java   
public AbsoluteAnalogEncoder(int channel,double minVoltage,double maxVoltage,double offsetdegrees,int analogSampleRate,double analogTriggerThresholdDifference) { //Todo: Implement direction
    super(channel);
    _channel = channel;
    if (minVoltage >= maxVoltage) throw new IllegalArgumentException("Minimum voltage must be less than maximum voltage");
    if (offsetdegrees < 0 || offsetdegrees > 360) throw new IllegalArgumentException("Offset must be between 0 and 360 degrees");

    // Initialize analog trigger //
    _analogTrigger = new AnalogTrigger(channel);
    _analogTrigger.setFiltered(true);
    _analogTrigger.setLimitsVoltage(minVoltage + analogTriggerThresholdDifference,maxVoltage - analogTriggerThresholdDifference);
    AnalogTriggerOutput _analogTriggerFalling = new AnalogTriggerOutput(_analogTrigger,AnalogTriggerOutput.Type.kFallingpulse);
    AnalogTriggerOutput _analogTriggerRising = new AnalogTriggerOutput(_analogTrigger,AnalogTriggerOutput.Type.kRisingpulse);

    // Set analog module sampling rate //        
    AnalogModule module = (AnalogModule) Module.getModule(ModulePresence.ModuleType.kAnalog,DEFAULT_ANALOG_MODULE);
    module.setSampleRate(analogSampleRate);

    // Initialize turn counter //
    _turnCounter = new Counter();
    _turnCounter.setupdownCounterMode();
    _turnCounter.setupsource(_analogTriggerRising);
    _turnCounter.setDownSource(_analogTriggerFalling);
    _turnCounter.start();

    _minVoltage = minVoltage;
    _maxVoltage = maxVoltage;
    _offsetdegrees = offsetdegrees;
}
项目:RobotCode2014    文件BlackBoxSubPacket.java   
private static byte [] createAnalogPacket(int module) {
        byte [] data = new byte[9 + headerSize];
        generateHeader(data,headerSize,1);
        data[headerSize] = (byte)module;
        for (int i = 0; i < 8; i++) {
            data[i+headerSize+1] = (byte)(5 / AnalogModule.getInstance(module).getVoltage(i+1) * 255);
//          data[i+headerSize+1] = 0;
        }
        return data;
    }
项目:RobotCode2013    文件BlackBoxSubPacket.java   
private static byte [] createAnalogPacket(int module) {
        byte [] data = new byte[9 + headerSize];
        generateHeader(data,1);
        data[headerSize] = (byte)module;
        for (int i = 0; i < 8; i++) {
            data[i+headerSize+1] = (byte)(5 / AnalogModule.getInstance(module).getVoltage(i+1) * 255);
//          data[i+headerSize+1] = 0;
        }
        return data;
    }
项目:2012    文件UltraSonicSensor.java   
/**
 * Constructor that uses the default module slot
 * 
 * @param analogChannel channel the ultrasonic sensor is connected to on the
 *                      cRIO 9201 module.
 */
public UltraSonicSensor(int analogChannel)
{
    channel = analogChannel;
    ultrasonicSensor =  AnalogModule.getInstance(1);
}
项目:2013    文件Ultrasonic.java   
/**
 * Constructor that uses the default module slot
 *
 * @param analogChannel channel the ultrasonic sensor is connected to on the
 * cRIO 9201 module.
 */
public Ultrasonic(int analogChannel) {
    channel = analogChannel;
    ultrasonicSensor = AnalogModule.getInstance(1);
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...