001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.wpilibj.interfaces;
006
007/** Interface for 3-axis accelerometers. */
008public interface Accelerometer {
009  enum Range {
010    k2G,
011    k4G,
012    k8G,
013    k16G
014  }
015
016  /**
017   * Common interface for setting the measuring range of an accelerometer.
018   *
019   * @param range The maximum acceleration, positive or negative, that the accelerometer will
020   *     measure. Not all accelerometers support all ranges.
021   */
022  void setRange(Range range);
023
024  /**
025   * Common interface for getting the x axis acceleration.
026   *
027   * @return The acceleration along the x axis in g-forces
028   */
029  double getX();
030
031  /**
032   * Common interface for getting the y axis acceleration.
033   *
034   * @return The acceleration along the y axis in g-forces
035   */
036  double getY();
037
038  /**
039   * Common interface for getting the z axis acceleration.
040   *
041   * @return The acceleration along the z axis in g-forces
042   */
043  double getZ();
044}