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