Java 类edu.wpi.first.wpilibj.interfaces.Accelerometer.Range 实例源码

项目:FRC2549-2016    文件:DrivetrainSubsystem.java   
public DrivetrainSubsystem(){
    leftMotor = RobotMap.leftDriveMotor.getController();
    rightMotor = RobotMap.rightDriveMotor.getController();
    drive = new RobotDrive(leftMotor, rightMotor);

    accelerometer = new IntegratedBuiltinAccelerometer(Range.k2G);

    leftEncoder = new Encoder(RobotMap.leftEncoder[0], RobotMap.leftEncoder[1]);
    rightEncoder = new Encoder(RobotMap.rightEncoder[0], RobotMap.rightEncoder[1]);
    leftEncoder.setReverseDirection(true);
    rightEncoder.setReverseDirection(true);

    driveGyro = new AnalogGyro(RobotMap.driveGyroPort);
    driveGyro.reset();
    driveGyro.setSensitivity(0.007);


}
项目:RecycleRush2015    文件:Robot.java   
public Robot() {
    super("Sailors", 0x612);
    this.sdTable = NetworkTable.getTable("SmartDashboard");

    Talon winchMotor = new Talon(Channels.WINCH_MOTOR);

    Console.debug("Creating and Initializing Controls/Motor Scheme/Senses...");
    this.control = new DualJoystickControl(JOYSTICK_LEFT, JOYSTICK_RIGHT);
    this.control.setMagnitudeThreshold(MAG_STICK_DEADBAND);
    this.control.setTwistThreshold(TWIST_STICK_DEADBAND);
    this.motors = MotorScheme.Builder.newFourMotorDrive(FL_DMOTOR, RL_DMOTOR, FR_DMOTOR, RR_DMOTOR).setInverted(false, true).setDriveManager(DriveManager.MECANUM_POLAR).addMotor(winchMotor).build();
    this.motors.getRobotDrive().setMaxOutput(DRIVE_SCALE_FACTOR);
    this.senses = BasicSense.makeBuiltInSense(Range.k4G);
    this.pneumatics = new PneumaticControl();
    this.winch = new WinchControl(winchMotor, this.upWinchValue, this.downWinchValue);

    Console.debug("Initializing Button Actions...");
    this.control.putButtonAction(ID_SWAP_JOYSTICKS, "Swap Joysticks", this.control::swapJoysticks, Hand.BOTH);
    this.control.putButtonAction(ID_DISABLE_TWIST, "Toggle Left Twist", () -> this.control.toggleDisableTwistAxis(Hand.LEFT), Hand.LEFT);
    this.control.putButtonAction(ID_DISABLE_TWIST, "Toggle Right Twist", () -> this.control.toggleDisableTwistAxis(Hand.RIGHT), Hand.RIGHT);

    Console.debug("Starting Camera Capture...");
    this.camera = new USBCamera();
    this.camera.setSize(CameraSize.MEDIUM);
    CameraStream.INSTANCE.startAutomaticCapture(this.camera);
    Console.debug(String.format("Resolution: %dx%d | Quality: %s | FPS: %s", this.camera.getSize().WIDTH, this.camera.getSize().HEIGHT, this.camera.getQuality().name(), this.camera.getFPS().kFPS));
}
项目:strongback-java    文件:Hardware.java   
/**
 * Create a new {@link ThreeAxisAccelerometer} for the ADXL345 with the desired range using the specified I2C port.
 *
 * @param port the I2C port used by the accelerometer
 * @param range the desired range of the accelerometer
 * @return the accelerometer; never null
 */
public static ThreeAxisAccelerometer accelerometer(I2C.Port port, Range range) {
    if (port == null) throw new IllegalArgumentException("The I2C port must be specified");
    if (range == null) throw new IllegalArgumentException("The accelerometer range must be specified");
    ADXL345_I2C accel = new ADXL345_I2C(port, range);
    return ThreeAxisAccelerometer.create(accel::getX, accel::getY, accel::getZ);
}
项目:strongback-java    文件:Hardware.java   
/**
 * Create a new {@link ThreeAxisAccelerometer} for the ADXL345 with the desired range using the specified SPI port.
 *
 * @param port the SPI port used by the accelerometer
 * @param range the desired range of the accelerometer
 * @return the accelerometer; never null
 */
public static ThreeAxisAccelerometer accelerometer(SPI.Port port, Range range) {
    if (port == null) throw new IllegalArgumentException("The I2C port must be specified");
    if (range == null) throw new IllegalArgumentException("The accelerometer range must be specified");
    ADXL345_SPI accel = new ADXL345_SPI(port, range);
    return ThreeAxisAccelerometer.create(accel::getX, accel::getY, accel::getZ);
}
项目:atalibj    文件:Acceleration.java   
/**
 * Sets the measuring range of an accelerometer.
 *
 * @param range the maximum acceleration, positive or negative, that the
 * accelerometer will measure
 */
public static void setRange(Range range) {
    accelerometer.setRange(range);
}