001/*----------------------------------------------------------------------------*/
002/* Copyright (c) FIRST 2014. 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 $(WIND_BASE)/WPILib.  */
005/*----------------------------------------------------------------------------*/
006package edu.wpi.first.wpilibj.interfaces;
007
008/**
009 * Interface for 3-axis accelerometers
010 */
011public interface Accelerometer {
012        public enum Range
013        {
014                k2G,
015                k4G,
016                k8G,
017                k16G
018        }
019
020        /**
021         * Common interface for setting the measuring range of an accelerometer.
022         *
023         * @param range The maximum acceleration, positive or negative, that the
024         * accelerometer will measure.  Not all accelerometers support all ranges.
025         */
026        public void setRange(Range range);
027
028        /**
029         * Common interface for getting the x axis acceleration
030         *
031         * @return The acceleration along the x axis in g-forces
032         */
033        public double getX();
034
035        /**
036         * Common interface for getting the y axis acceleration
037         *
038         * @return The acceleration along the y axis in g-forces
039         */
040        public double getY();
041
042        /**
043         * Common interface for getting the z axis acceleration
044         *
045         * @return The acceleration along the z axis in g-forces
046         */
047        public double getZ();
048}