/* * // Set these properties based on your robot drivetrain/encoder config: * encoder.Resolution = 44; // 44 ticks per revolution * encoder.WheelDiameter = 2.0; // 2 inch wheel diameter * encoder.WheelEncoderId = WheelEncoderId.Encoder1; * * // Clear encoder value: * encoder.Clear(); * * // If you're interested in absolute distance, then use this: * encoder.DistanceChangedThreshold = 0.25; // 0.25 inches * encoder.DistanceChanged += new * HardwareComponentEventHandler(encoder_DistanceChanged); * * // If you're interested in ticks, then use this: * encoder.CountChangedThreshold = 10; // 10 ticks; * encoder.CountChanged += new * HardwareComponentEventHandler(encoder_CountChanged); */ private IWheelEncoder CreateWheelEncoder(IAbstractRobotHardware brick, WheelEncoderId id, int frequency, int threshold) { IWheelEncoder encoder = brick.produceWheelEncoder(id, frequency, 1, threshold); // Frequency milliseconds // Resolution must be set to avoid divide by zero in WheelEncoder.cs // CountChangedThreshold ticks encoder.CountChanged += new HardwareComponentEventHandler(encoder_CountChanged); return(encoder); }
public IWheelEncoder produceWheelEncoder(WheelEncoderId wheelEncoderId, int updateFrequency, int resolution, int countChangedThreshold) { return(new WheelEncoder(tokenSource.Token)); }
/* // Set these properties based on your robot drivetrain/encoder config: encoder.Resolution = 44; // 44 ticks per revolution encoder.WheelDiameter = 2.0; // 2 inch wheel diameter encoder.WheelEncoderId = WheelEncoderId.Encoder1; // Clear encoder value: encoder.Clear(); // If you're interested in absolute distance, then use this: encoder.DistanceChangedThreshold = 0.25; // 0.25 inches encoder.DistanceChanged += new HardwareComponentEventHandler(encoder_DistanceChanged); // If you're interested in ticks, then use this: encoder.CountChangedThreshold = 10; // 10 ticks; encoder.CountChanged += new HardwareComponentEventHandler(encoder_CountChanged); */ private IWheelEncoder CreateWheelEncoder(IAbstractRobotHardware brick, WheelEncoderId id, int frequency, int threshold) { IWheelEncoder encoder = brick.produceWheelEncoder(id, frequency, 1, threshold); // Frequency milliseconds // Resolution must be set to avoid divide by zero in WheelEncoder.cs // CountChangedThreshold ticks encoder.CountChanged += new HardwareComponentEventHandler(encoder_CountChanged); return encoder; }
public IWheelEncoder produceWheelEncoder(WheelEncoderId wheelEncoderId, int updateFrequency, int resolution, int countChangedThreshold) { return new WheelEncoder(tokenSource.Token); }